From 43c56d53a40764c1a0bd0a5ce99dc186d2f82aee Mon Sep 17 00:00:00 2001 From: Daniel Klaffenbach Date: Wed, 10 Nov 2010 00:28:52 +0100 Subject: [PATCH] Add support for saving maximum frequency on power kernel Call "kernel-config default" to save the current maximum frequency on power kernels. --- src/data/scripts/QCPUFreq.helper | 4 ++++ src/mainwindow.cpp | 20 ++++++++++++++++++++ src/mainwindow.h | 1 + 3 files changed, 25 insertions(+) diff --git a/src/data/scripts/QCPUFreq.helper b/src/data/scripts/QCPUFreq.helper index a867e8a..c911753 100755 --- a/src/data/scripts/QCPUFreq.helper +++ b/src/data/scripts/QCPUFreq.helper @@ -13,6 +13,10 @@ case "$1" in /sbin/modprobe bq27x00_battery exit 0 ;; + "save") + /usr/sbin/kernel-config default + exit 0 + ;; "set_maxfreq") #set scaling_max_freq echo $2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 518c7e1..5749f65 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -81,6 +81,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged())); connect(ui->sr_box, SIGNAL(clicked()), this, SLOT(setSmartReflex())); connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); + connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save())); connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings())); connect(settings, SIGNAL(settingsChanged()), this, SLOT(applySettings())); @@ -355,6 +356,11 @@ void MainWindow::init() } else { this->minFreq = min.toInt(); } + + //enable save option on power kernels + if (settings->usePowerKernel()) { + ui->actionSave->setEnabled(true); + } } @@ -453,6 +459,20 @@ void MainWindow::orientationChanged() /** + * Saves the current maximim frequency as default (only on power kernel). + */ +void MainWindow::save() +{ + if (settings->usePowerKernel()) { + callHelper( "save", "null" ); + #if defined(Q_WS_MAEMO_5) + QMaemo5InformationBox::information(this, tr( "The current frequency settings have been saved as default." ), QMaemo5InformationBox::DefaultTimeout); + #endif + } +} + + +/** * Checks the settings if the "bq27x00_battery" needs to be loaded. */ void MainWindow::setAdvancedTemperature() diff --git a/src/mainwindow.h b/src/mainwindow.h index 0d0bdcc..aae3b9d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -46,6 +46,7 @@ public slots: void applySettings(); void orientationChanged(); void refresh(); + void save(); void setAdvancedTemperature(); void setAutoRotation(); void setSmartReflex(); -- 1.7.9.5