[PATCH 3 of 5] Save the autostart and autoupdate settings

Wald Commits scm-commit at wald.intevation.org
Thu Apr 24 12:45:21 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1398335304 -7200
# Node ID 9be337ea1e3c4563176dbd911c1dc02507cff95b
# Parent  242f2bf5417ee2ed631905cdcc12f1ce4e8c635d
Save the autostart and autoupdate settings.

diff -r 242f2bf5417e -r 9be337ea1e3c ui/mainwindow.cpp
--- 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();
diff -r 242f2bf5417e -r 9be337ea1e3c ui/mainwindow.h
--- 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


More information about the Trustbridge-commits mailing list