(www) Update index page
[quandoparte] / application / settingsdialog.cpp
index ff5e0a4..ccb085d 100644 (file)
@@ -19,6 +19,7 @@ Boston, MA 02110-1301, USA.
 
 */
 
+#include <settings.h>
 #include "settingsdialog.h"
 #include "ui_settingsdialog.h"
 
@@ -34,13 +35,39 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
 #endif
     ui(new Ui::SettingsDialog)
 {
+    Settings *settings = Settings::instance();
+
     ui->setupUi(this);
+
+    bool showStationPreference = settings->stationViewPreferred();
+    ui->showLastStationCheckBox->setChecked(showStationPreference);
+    connect(ui->showLastStationCheckBox, SIGNAL(toggled(bool)),
+            SLOT(showStationChanged(bool)));
+
+    bool checkingInterval = settings->checkingInterval();
+    ui->periodicUpdateCheckBox->setChecked(checkingInterval > 30000);
+    connect(ui->periodicUpdateCheckBox, SIGNAL(toggled(bool)),
+            SLOT(periodicUpdateToggled(bool)));
+#if 0
 #ifdef Q_WS_MAEMO_5
     ui->formLayout->addWidget(updateIntervalButton);
 #endif
+#endif
 }
 
 SettingsDialog::~SettingsDialog()
 {
     delete ui;
 }
+
+void SettingsDialog::showStationChanged(bool newValue)
+{
+    Settings *settings = Settings::instance();
+    settings->setStationViewPreferred(newValue);
+}
+
+void SettingsDialog::periodicUpdateToggled(bool checked)
+{
+    Settings *settings = Settings::instance();
+    settings->setCheckingInterval(checked ? 120000 : 0);
+}