diff ui/mainwindow.cpp @ 481:9be337ea1e3c

Save the autostart and autoupdate settings.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 24 Apr 2014 12:28:24 +0200
parents 242f2bf5417e
children fa56a9403939
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Thu Apr 24 12:02:20 2014 +0200
+++ b/ui/mainwindow.cpp	Thu Apr 24 12:28:24 2014 +0200
@@ -347,7 +347,17 @@
     settingsLayout->addWidget(mAutoUpdateOption);
     settingsLayout->addWidget(mAutoStartOption);
     settingsBox->setLayout(settingsLayout);
-//    connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate()));
+    connect(mAutoUpdateOption, SIGNAL(stateChanged(int)),
+        this, SLOT(saveAutoUpdate(int)));
+    connect(mAutoStartOption, SIGNAL(stateChanged(int)),
+        this, SLOT(saveAutoStart(int)));
+    mSettings.beginGroup("settings");
+    int autoUpdate = mSettings.value("autoupdate").toInt();
+    int autoStart = mSettings.value("autostart").toInt();
+    mSettings.endGroup();
+    mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked);
+    mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked);
+
 
     // The buttons.
     bottomLayout->setAlignment(Qt::AlignBottom);
@@ -679,6 +689,20 @@
     return mSettings.status() == QSettings::NoError;
 }
 
+void MainWindow::saveAutoUpdate(int state)
+{
+    mSettings.beginGroup("settings");
+    mSettings.setValue("autoupdate", state);
+    mSettings.endGroup();
+}
+
+void MainWindow::saveAutoStart(int state)
+{
+    mSettings.beginGroup("settings");
+    mSettings.setValue("autostart", state);
+    mSettings.endGroup();
+}
+
 void MainWindow::closeApp()
 {
     saveUnselectedCertificates();

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