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 @@ -17,5 +17,5 @@ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; @@ -35,4 +35,5 @@ #endif +#include <qlabel.h> #include <qcheckbox.h> #include <qtabwidget.h> @@ -55,4 +56,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) m_cres = ODevice::inst ( )-> displayContrastResolution ( ); + // check whether to show the light sensor stuff + if ( !ODevice::inst ( )-> hasLightSensor ( )) { auto_brightness-> hide ( ); @@ -61,4 +64,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) CalibrateLightSensor_ac-> hide ( ); } + + // check whether to show the contrast stuff + if (m_cres) { GroupLight->setTitle(tr("Backlight && Contrast")); @@ -69,4 +75,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) } + // check whether to show the cpu frequency stuff + QStrList freq = ODevice::inst()->allowedCpuFrequencies(); if ( freq.count() ) { @@ -74,8 +82,19 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) frequency_ac->insertStrList( freq ); } else { + frequencyLabel->hide(); frequency->hide(); + frequencyLabel_ac->hide(); frequency_ac->hide(); } + // 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" ); config. setGroup ( "Battery" ); @@ -92,5 +111,8 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); - 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 ); brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); @@ -111,5 +133,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) config. setGroup ( "AC" ); - + // ac spinboxes interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); @@ -123,4 +145,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); + // hinge action + closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); + bright = config. readNumEntry ( "Brightness", 255 ); brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); @@ -140,6 +165,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); - - // advanced settings + + // warnings config. setGroup ( "Warnings" ); warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); @@ -151,10 +176,10 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { - tabs-> setCurrentPage ( 0 ); + tabs-> setCurrentPage ( 0 ); } else { tabs-> setCurrentPage ( 1 ); } - + connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); @@ -163,8 +188,11 @@ 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) ) ); + 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 ( ) { } @@ -192,9 +220,9 @@ void LightSettings::setBacklight ( int bright ) QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); e << bright; - + if ( bright != -1 ) { m_resettimer-> stop ( ); m_resettimer-> start ( 4000, true ); - } + } } @@ -202,5 +230,4 @@ void LightSettings::setContrast ( int contr ) { if (contr == -1) contr = m_oldcontrast; - ODevice::inst ( )-> setDisplayContrast(contr); } @@ -208,5 +235,5 @@ void LightSettings::setContrast ( int contr ) void LightSettings::setFrequency ( int index ) { -qWarning("LightSettings::setFrequency(%d)", index); + qWarning("LightSettings::setFrequency(%d)", index); ODevice::inst ( )-> setCurrentCpuFrequency(index); } @@ -218,4 +245,9 @@ void LightSettings::resetBacklight ( ) } +void LightSettings::setCloseHingeAction ( int index ) +{ + qWarning("LightSettings::setCloseHingeStatus(%d)", index); +} + void LightSettings::accept ( ) { @@ -232,4 +264,5 @@ void LightSettings::accept ( ) config. writeEntry ( "Contrast", contrast-> value () ); config. writeEntry ( "Freq", frequency->currentItem() ); + config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); // ac @@ -243,6 +276,7 @@ void LightSettings::accept ( ) config. writeEntry ( "Contrast", contrast_ac-> value () ); 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 ( )) { config. setGroup ( "Battery" ); @@ -276,5 +310,5 @@ void LightSettings::done ( int r ) m_resettimer-> stop ( ); resetBacklight ( ); - + LightSettingsBase::done ( r ); close ( ); |