summaryrefslogtreecommitdiff
path: root/core/settings
Side-by-side diff
Diffstat (limited to 'core/settings') (more/less context) (show whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp28
-rw-r--r--core/settings/light-and-power/light.h3
2 files changed, 30 insertions, 1 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 8b98672..68c2929 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -43,4 +43,5 @@
#include <qpushbutton.h>
#include <qgroupbox.h>
+#include <qcombobox.h>
#include <opie/odevice.h>
@@ -63,5 +64,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
}
if (m_cres) {
- GroupLight->setTitle(tr("Backlight & Contrast"));
+ GroupLight->setTitle(tr("Backlight && Contrast"));
+ GroupLight_ac->setTitle(GroupLight->title());
} else {
contrast->hide();
@@ -69,4 +71,13 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
}
+ QStrList freq = ODevice::inst()->cpuFrequencies();
+ if ( freq.count() ) {
+ frequency->insertStrList( freq );
+ frequency_ac->insertStrList( freq );
+ } else {
+ frequency->hide();
+ frequency_ac->hide();
+ }
+
Config config ( "apm" );
config. setGroup ( "Battery" );
@@ -80,4 +91,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
LcdOffOnly-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
+ // CPU frequency
+ frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
+
int bright = config. readNumEntry ( "Brightness", 127 );
int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
@@ -108,4 +122,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
+ // CPU frequency
+ frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
+
bright = config. readNumEntry ( "Brightness", 255 );
brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
@@ -148,4 +165,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
}
+ connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
}
@@ -190,4 +208,10 @@ void LightSettings::setContrast ( int contr )
}
+void LightSettings::setFrequency ( int index )
+{
+qWarning("LightSettings::setFrequency(%d)", index);
+ ODevice::inst ( )-> setCpuFrequency(index);
+}
+
void LightSettings::resetBacklight ( )
{
@@ -209,4 +233,5 @@ void LightSettings::accept ( )
if (m_cres)
config. writeEntry ( "Contrast", contrast-> value () );
+ config. writeEntry ( "Freq", frequency->currentItem() );
// ac
@@ -219,4 +244,5 @@ void LightSettings::accept ( )
if (m_cres)
config. writeEntry ( "Contrast", contrast_ac-> value () );
+ config. writeEntry ( "Freq", frequency_ac->currentItem() );
// only make light sensor stuff appear if the unit has a sensor
diff --git a/core/settings/light-and-power/light.h b/core/settings/light-and-power/light.h
index 4a8bf6b..c48e5f6 100644
--- a/core/settings/light-and-power/light.h
+++ b/core/settings/light-and-power/light.h
@@ -31,4 +31,5 @@
#include <qstringlist.h>
+#include <qlistbox.h>
#include "lightsettingsbase.h"
@@ -52,4 +53,5 @@ protected slots:
void setBacklight ( int );
void setContrast ( int );
+ void setFrequency ( int );
void resetBacklight ( );
@@ -58,4 +60,5 @@ private:
int m_cres;
int m_oldcontrast;
+ int m_oldfreq;
QTimer *m_resettimer;
QStringList m_sensordata;