From: Daniel Klaffenbach Date: Mon, 27 Dec 2010 10:45:47 +0000 (+0100) Subject: Ask for confirmation before applying new maximum frequency. X-Git-Tag: v0.4.3~9 X-Git-Url: https://vcs.maemo.org/git/?p=qcpufreq;a=commitdiff_plain;h=3486a72377cf05ba70a4a8d7e374741670d32002 Ask for confirmation before applying new maximum frequency. This adds an option in the settings widget to enable a confirmation dialog before actually applying a new maximum frequency. This should prevent accidental changes. --- diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2d43625..e71837f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -146,9 +146,24 @@ void MainWindow::adjustFreq() max = "599000"; } - callHelper( "set_maxfreq", max ); + if (settings->useConfirmation()) { + QMessageBox box; + box.setStandardButtons(QMessageBox::Apply | QMessageBox::Cancel); + box.setDefaultButton(QMessageBox::Apply); + box.setIcon(QMessageBox::Question); + box.setText(tr("The frequency changed.")); + box.setInformativeText("Do you want to use ? as new default frequency?"); + int ret = box.exec(); + + if (ret != QMessageBox::Apply) { + refresh(); + return; + } + } + callHelper( "set_maxfreq", max ); refresh(); + } diff --git a/src/settings.cpp b/src/settings.cpp index eaa72f1..a4b7b6f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -38,6 +38,7 @@ Settings::Settings(QWidget *parent) : //read values from config file autoRotate = settings.value("main/autorotate", true).toBool(); + confirmApply = settings.value("main/confirm_apply", true).toBool(); overclocking = settings.value("main/overclocking", false).toBool(); advancedTemperature = settings.value("main/advanced_temperature", false).toBool(); @@ -122,6 +123,7 @@ bool Settings::platformMaemo() void Settings::reset() { ui->checkBox_rotate->setChecked(autoRotate); + ui->checkBox_confirmapply->setChecked(confirmApply); ui->checkBox_oc->setChecked(overclocking); ui->checkBox_temperature->setChecked(advancedTemperature); } @@ -135,10 +137,12 @@ void Settings::reset() void Settings::save() { autoRotate = ui->checkBox_rotate->isChecked(); + confirmApply = ui->checkBox_confirmapply->isChecked(); overclocking = ui->checkBox_oc->isChecked(); advancedTemperature = ui->checkBox_temperature->isChecked(); settings.setValue("main/autorotate", autoRotate); + settings.setValue("main/confirm_apply", confirmApply); settings.setValue("main/overclocking", overclocking); settings.setValue("main/advanced_temperature", advancedTemperature); @@ -177,6 +181,16 @@ bool Settings::useAdvancedTemperature() /** + * Do we need to display a confirmation dialog before applying new + * frequencies? + */ +bool Settings::useConfirmation() +{ + return confirmApply; +} + + +/** * Returns true if auto-Rotate is enabled. */ bool Settings::useAutoRotate() diff --git a/src/settings.h b/src/settings.h index 87c8463..c6b08e9 100644 --- a/src/settings.h +++ b/src/settings.h @@ -37,6 +37,7 @@ public: bool platformMaemo(); bool useAdvancedTemperature(); bool useAutoRotate(); + bool useConfirmation(); bool useOverclocking(); bool usePowerKernel(); @@ -51,6 +52,7 @@ signals: private: bool advancedTemperature; bool autoRotate; + bool confirmApply; bool overclocking; bool powerKernel; bool kernelConfigInstalled; diff --git a/src/settings.ui b/src/settings.ui index 45464d1..0e1d5ee 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -6,8 +6,8 @@ 0 0 - 308 - 134 + 364 + 183 @@ -20,6 +20,16 @@ + + + Please have a look at the QCPUFreq help for an explanation of these settings! + + + true + + + + Enable auto-rotation @@ -27,6 +37,13 @@ + + + Confirm frequency before applying + + + + Enable overclocking @@ -42,9 +59,6 @@ - - Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Save diff --git a/src/src.pro b/src/src.pro index a441e65..43b41c2 100644 --- a/src/src.pro +++ b/src/src.pro @@ -4,6 +4,7 @@ # #------------------------------------------------- +QT -= gui dbus xml QT += core gui maemo5 TARGET = QCPUFreq @@ -28,8 +29,8 @@ FORMS += mainwindow.ui \ TRANSLATIONS = de.ts zh.ts -CONFIG += mobility -MOBILITY = +#CONFIG += mobility +#MOBILITY = symbian { TARGET.UID3 = 0xeb3802d4