comparison ui/mainwindow.cpp @ 499:077b4342d69b

Default autostart to true and change setting to bool
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 25 Apr 2014 10:16:46 +0000
parents fa56a9403939
children 20973a56d5ec
comparison
equal deleted inserted replaced
498:5ec7d3a36ba6 499:077b4342d69b
390 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)), 390 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)),
391 this, SLOT(saveAutoUpdate(int))); 391 this, SLOT(saveAutoUpdate(int)));
392 connect(mAutoStartOption, SIGNAL(stateChanged(int)), 392 connect(mAutoStartOption, SIGNAL(stateChanged(int)),
393 this, SLOT(saveAutoStart(int))); 393 this, SLOT(saveAutoStart(int)));
394 mSettings.beginGroup("settings"); 394 mSettings.beginGroup("settings");
395 int autoUpdate = mSettings.value("autoupdate").toInt(); 395 bool autoUpdate = mSettings.value("autoupdate", false).toBool();
396 int autoStart = mSettings.value("autostart").toInt(); 396 bool autoStart = mSettings.value("autostart", true).toBool();
397 mSettings.endGroup(); 397 mSettings.endGroup();
398 mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked); 398 mAutoUpdateOption->setCheckState(autoUpdate ? Qt::Checked : Qt::Unchecked);
399 mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked); 399 mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked);
400 400
401 401
402 // The buttons. 402 // The buttons.
403 bottomLayout->setAlignment(Qt::AlignBottom); 403 bottomLayout->setAlignment(Qt::AlignBottom);
404 installButton = new QPushButton(tr("Install selected")); 404 installButton = new QPushButton(tr("Install selected"));
730 } 730 }
731 731
732 void MainWindow::saveAutoUpdate(int state) 732 void MainWindow::saveAutoUpdate(int state)
733 { 733 {
734 mSettings.beginGroup("settings"); 734 mSettings.beginGroup("settings");
735 mSettings.setValue("autoupdate", state); 735 mSettings.setValue("autoupdate", state != Qt::Unchecked);
736 mSettings.endGroup(); 736 mSettings.endGroup();
737 } 737 }
738 738
739 void MainWindow::saveAutoStart(int state) 739 void MainWindow::saveAutoStart(int state)
740 { 740 {
741 mSettings.beginGroup("settings"); 741 mSettings.beginGroup("settings");
742 mSettings.setValue("autostart", state); 742 mSettings.setValue("autostart", state != Qt::Unchecked);
743 mSettings.endGroup(); 743 mSettings.endGroup();
744 } 744 }
745 745
746 void MainWindow::closeApp() 746 void MainWindow::closeApp()
747 { 747 {

http://wald.intevation.org/projects/trustbridge/