-rw-r--r-- | core/settings/light-and-power/light.cpp | 28 | ||||
-rw-r--r-- | core/settings/light-and-power/light.h | 3 |
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 @@ -44,2 +44,3 @@ #include <qgroupbox.h> +#include <qcombobox.h> @@ -64,3 +65,4 @@ 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 { @@ -70,2 +72,11 @@ 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" ); @@ -81,2 +92,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // CPU frequency + frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); + int bright = config. readNumEntry ( "Brightness", 127 ); @@ -109,2 +123,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // CPU frequency + frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); + bright = config. readNumEntry ( "Brightness", 255 ); @@ -149,2 +166,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } + connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); } @@ -191,2 +209,8 @@ void LightSettings::setContrast ( int contr ) +void LightSettings::setFrequency ( int index ) +{ +qWarning("LightSettings::setFrequency(%d)", index); + ODevice::inst ( )-> setCpuFrequency(index); +} + void LightSettings::resetBacklight ( ) @@ -210,2 +234,3 @@ void LightSettings::accept ( ) config. writeEntry ( "Contrast", contrast-> value () ); + config. writeEntry ( "Freq", frequency->currentItem() ); @@ -220,2 +245,3 @@ void LightSettings::accept ( ) config. writeEntry ( "Contrast", contrast_ac-> value () ); + config. writeEntry ( "Freq", frequency_ac->currentItem() ); 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 @@ -32,2 +32,3 @@ #include <qstringlist.h> +#include <qlistbox.h> #include "lightsettingsbase.h" @@ -53,2 +54,3 @@ protected slots: void setContrast ( int ); + void setFrequency ( int ); void resetBacklight ( ); @@ -59,2 +61,3 @@ private: int m_oldcontrast; + int m_oldfreq; QTimer *m_resettimer; |