author | mickeyl <mickeyl> | 2003-12-29 16:52:29 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-29 16:52:29 (UTC) |
commit | 2ecab614a6b91658b1608c62134cd14e257e55b7 (patch) (side-by-side diff) | |
tree | 806d351238f4719f0c4ef6a720d9ff4e008003ea /core/settings/light-and-power/light.cpp | |
parent | 8224dfc07a698d4c40cb240d315dc81b67512015 (diff) | |
download | opie-2ecab614a6b91658b1608c62134cd14e257e55b7.zip opie-2ecab614a6b91658b1608c62134cd14e257e55b7.tar.gz opie-2ecab614a6b91658b1608c62134cd14e257e55b7.tar.bz2 |
- add customization of the action to take when closing the hinge
- hide hinge customization on models which doesn't support that
- hide frequency label on models which doesn't support changing the CPU frequency
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 | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 6115178..d6d09a1 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -18,3 +18,3 @@ ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU @@ -36,2 +36,3 @@ +#include <qlabel.h> #include <qcheckbox.h> @@ -56,2 +57,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // check whether to show the light sensor stuff + if ( !ODevice::inst ( )-> hasLightSensor ( )) { @@ -62,2 +65,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } + + // check whether to show the contrast stuff + if (m_cres) { @@ -70,2 +76,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // check whether to show the cpu frequency stuff + QStrList freq = ODevice::inst()->allowedCpuFrequencies(); @@ -75,3 +83,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } else { + frequencyLabel->hide(); frequency->hide(); + frequencyLabel_ac->hide(); frequency_ac->hide(); @@ -79,2 +89,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // check whether to show the hinge action stuff + + if ( !ODevice::inst()->hasHingeSensor() ) { + closeHingeLabel->hide(); + closeHingeAction->hide(); + closeHingeLabel_ac->hide(); + closeHingeAction_ac->hide(); + } + Config config ( "apm" ); @@ -93,3 +112,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) - int bright = config. readNumEntry ( "Brightness", 127 ); + // hinge action + closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); + + int bright = config. readNumEntry ( "Brightness", 127 ); int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); @@ -112,3 +134,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) config. setGroup ( "AC" ); - + // ac spinboxes @@ -124,2 +146,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) + // hinge action + closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); + bright = config. readNumEntry ( "Brightness", 255 ); @@ -141,4 +166,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); - - // advanced settings + + // warnings config. setGroup ( "Warnings" ); @@ -152,3 +177,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { - tabs-> setCurrentPage ( 0 ); + tabs-> setCurrentPage ( 0 ); } @@ -157,3 +182,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } - + connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); @@ -164,6 +189,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } - connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); + connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); + connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); + connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); + connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); } -LightSettings::~LightSettings ( ) +LightSettings::~LightSettings ( ) { @@ -193,3 +221,3 @@ void LightSettings::setBacklight ( int bright ) e << bright; - + if ( bright != -1 ) { @@ -197,3 +225,3 @@ void LightSettings::setBacklight ( int bright ) m_resettimer-> start ( 4000, true ); - } + } } @@ -203,3 +231,2 @@ void LightSettings::setContrast ( int contr ) if (contr == -1) contr = m_oldcontrast; - ODevice::inst ( )-> setDisplayContrast(contr); @@ -209,3 +236,3 @@ void LightSettings::setFrequency ( int index ) { -qWarning("LightSettings::setFrequency(%d)", index); + qWarning("LightSettings::setFrequency(%d)", index); ODevice::inst ( )-> setCurrentCpuFrequency(index); @@ -219,2 +246,7 @@ void LightSettings::resetBacklight ( ) +void LightSettings::setCloseHingeAction ( int index ) +{ + qWarning("LightSettings::setCloseHingeStatus(%d)", index); +} + void LightSettings::accept ( ) @@ -233,2 +265,3 @@ void LightSettings::accept ( ) config. writeEntry ( "Freq", frequency->currentItem() ); + config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); @@ -244,4 +277,5 @@ void LightSettings::accept ( ) config. writeEntry ( "Freq", frequency_ac->currentItem() ); + config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); - // only make light sensor stuff appear if the unit has a sensor + // only make light sensor stuff appear if the unit has a sensor if ( ODevice::inst ( )-> hasLightSensor ( )) { @@ -277,3 +311,3 @@ void LightSettings::done ( int r ) resetBacklight ( ); - + LightSettingsBase::done ( r ); |