author | schurig <schurig> | 2003-06-06 14:32:51 (UTC) |
---|---|---|
committer | schurig <schurig> | 2003-06-06 14:32:51 (UTC) |
commit | 802e9457b1bc158c61849755215fe2a5bad6231d (patch) (side-by-side diff) | |
tree | 81b8a5cdb9d4b5beaee2f18eec6ca995ec8e77d2 /core/settings/light-and-power/light.cpp | |
parent | 225486a1c3714b4b0c0e60286df13d8ede029768 (diff) | |
download | opie-802e9457b1bc158c61849755215fe2a5bad6231d.zip opie-802e9457b1bc158c61849755215fe2a5bad6231d.tar.gz opie-802e9457b1bc158c61849755215fe2a5bad6231d.tar.bz2 |
frequency change works now
Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 30 |
1 files changed, 28 insertions, 2 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 @@ -39,12 +39,13 @@ #include <qtabwidget.h> #include <qslider.h> #include <qtimer.h> #include <qspinbox.h> #include <qpushbutton.h> #include <qgroupbox.h> +#include <qcombobox.h> #include <opie/odevice.h> #include "sensor.h" using namespace Opie; @@ -59,28 +60,41 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) auto_brightness-> hide ( ); CalibrateLightSensor-> hide ( ); auto_brightness_ac-> hide ( ); CalibrateLightSensor_ac-> hide ( ); } if (m_cres) { - GroupLight->setTitle(tr("Backlight & Contrast")); + GroupLight->setTitle(tr("Backlight && Contrast")); + GroupLight_ac->setTitle(GroupLight->title()); } else { contrast->hide(); contrast_ac->hide(); } + 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" ); // battery spinboxes interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); // battery check and slider - LcdOffOnly-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); + 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 ); brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); @@ -104,12 +118,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); // ac check and slider 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 )); brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); brightness_ac-> setValue ( bright ); @@ -144,12 +161,13 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); if (m_cres) { connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); } + connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); } LightSettings::~LightSettings ( ) { } @@ -186,12 +204,18 @@ void LightSettings::setContrast ( int contr ) { if (contr == -1) contr = m_oldcontrast; ODevice::inst ( )-> setDisplayContrast(contr); } +void LightSettings::setFrequency ( int index ) +{ +qWarning("LightSettings::setFrequency(%d)", index); + ODevice::inst ( )-> setCpuFrequency(index); +} + void LightSettings::resetBacklight ( ) { setBacklight ( -1 ); setContrast ( -1 ); } @@ -205,22 +229,24 @@ void LightSettings::accept ( ) config. writeEntry ( "Dim", interval_dim-> value ( )); config. writeEntry ( "LightOff", interval_lightoff-> value ( )); config. writeEntry ( "Suspend", interval_suspend-> value ( )); config. writeEntry ( "Brightness", brightness-> value () ); if (m_cres) config. writeEntry ( "Contrast", contrast-> value () ); + config. writeEntry ( "Freq", frequency->currentItem() ); // ac config. setGroup ( "AC" ); config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); config. writeEntry ( "Dim", interval_dim_ac-> value ( )); config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); config. writeEntry ( "Brightness", brightness_ac-> value () ); 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 if ( ODevice::inst ( )-> hasLightSensor ( )) { config. setGroup ( "Battery" ); config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); config. writeEntry ( "LightSensorData", m_sensordata, ';' ); |