comparison 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
comparison
equal deleted inserted replaced
480:242f2bf5417e 481:9be337ea1e3c
345 mAutoUpdateOption = new QCheckBox(tr("Autoupdate")); 345 mAutoUpdateOption = new QCheckBox(tr("Autoupdate"));
346 mAutoStartOption = new QCheckBox(tr("Autostart")); 346 mAutoStartOption = new QCheckBox(tr("Autostart"));
347 settingsLayout->addWidget(mAutoUpdateOption); 347 settingsLayout->addWidget(mAutoUpdateOption);
348 settingsLayout->addWidget(mAutoStartOption); 348 settingsLayout->addWidget(mAutoStartOption);
349 settingsBox->setLayout(settingsLayout); 349 settingsBox->setLayout(settingsLayout);
350 // connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate())); 350 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)),
351 this, SLOT(saveAutoUpdate(int)));
352 connect(mAutoStartOption, SIGNAL(stateChanged(int)),
353 this, SLOT(saveAutoStart(int)));
354 mSettings.beginGroup("settings");
355 int autoUpdate = mSettings.value("autoupdate").toInt();
356 int autoStart = mSettings.value("autostart").toInt();
357 mSettings.endGroup();
358 mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked);
359 mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked);
360
351 361
352 // The buttons. 362 // The buttons.
353 bottomLayout->setAlignment(Qt::AlignBottom); 363 bottomLayout->setAlignment(Qt::AlignBottom);
354 installButton = new QPushButton(tr("Install selected")); 364 installButton = new QPushButton(tr("Install selected"));
355 installButton->setFixedHeight(80); 365 installButton->setFixedHeight(80);
677 mSettings.endGroup(); 687 mSettings.endGroup();
678 mSettings.sync(); 688 mSettings.sync();
679 return mSettings.status() == QSettings::NoError; 689 return mSettings.status() == QSettings::NoError;
680 } 690 }
681 691
692 void MainWindow::saveAutoUpdate(int state)
693 {
694 mSettings.beginGroup("settings");
695 mSettings.setValue("autoupdate", state);
696 mSettings.endGroup();
697 }
698
699 void MainWindow::saveAutoStart(int state)
700 {
701 mSettings.beginGroup("settings");
702 mSettings.setValue("autostart", state);
703 mSettings.endGroup();
704 }
705
682 void MainWindow::closeApp() 706 void MainWindow::closeApp()
683 { 707 {
684 saveUnselectedCertificates(); 708 saveUnselectedCertificates();
685 qApp->quit(); 709 qApp->quit();
686 } 710 }

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