changeset 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 5ec7d3a36ba6
children 4f972b1f4996
files ui/main.cpp ui/mainwindow.cpp
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ui/main.cpp	Fri Apr 25 10:16:18 2014 +0000
+++ b/ui/main.cpp	Fri Apr 25 10:16:46 2014 +0000
@@ -48,10 +48,10 @@
 
     QSettings settings;
     settings.beginGroup("settings");
-    int autoStart = settings.value("autostart").toInt();
+    bool autoStart = settings.value("autostart", true).toBool();
     settings.endGroup();
 
-    if (trayMode && autoStart <= 0) {
+    if (trayMode && !autoStart) {
         return 0;
     }
 
--- a/ui/mainwindow.cpp	Fri Apr 25 10:16:18 2014 +0000
+++ b/ui/mainwindow.cpp	Fri Apr 25 10:16:46 2014 +0000
@@ -392,11 +392,11 @@
     connect(mAutoStartOption, SIGNAL(stateChanged(int)),
         this, SLOT(saveAutoStart(int)));
     mSettings.beginGroup("settings");
-    int autoUpdate = mSettings.value("autoupdate").toInt();
-    int autoStart = mSettings.value("autostart").toInt();
+    bool autoUpdate = mSettings.value("autoupdate", false).toBool();
+    bool autoStart = mSettings.value("autostart", true).toBool();
     mSettings.endGroup();
-    mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked);
-    mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked);
+    mAutoUpdateOption->setCheckState(autoUpdate ? Qt::Checked : Qt::Unchecked);
+    mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked);
 
 
     // The buttons.
@@ -732,14 +732,14 @@
 void MainWindow::saveAutoUpdate(int state)
 {
     mSettings.beginGroup("settings");
-    mSettings.setValue("autoupdate", state);
+    mSettings.setValue("autoupdate", state != Qt::Unchecked);
     mSettings.endGroup();
 }
 
 void MainWindow::saveAutoStart(int state)
 {
     mSettings.beginGroup("settings");
-    mSettings.setValue("autostart", state);
+    mSettings.setValue("autostart", state != Qt::Unchecked);
     mSettings.endGroup();
 }
 

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