changeset 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 0f4331ed4e83
files ui/mainwindow.cpp ui/mainwindow.h
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
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();
--- a/ui/mainwindow.h	Thu Apr 24 12:02:20 2014 +0200
+++ b/ui/mainwindow.h	Thu Apr 24 12:28:24 2014 +0200
@@ -80,6 +80,9 @@
     void installCerts();
     void newSWAvailable(const QString& fileName, const QDateTime& modDate);
 
+    void saveAutoUpdate(int state);
+    void saveAutoStart(int state);
+
     /** @brief saves the currently unselected certificates
      *
      * This creates / updates a qsettings section that

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