Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 38 |
1 files changed, 36 insertions, 2 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 @@ -34,6 +34,7 @@ #include <qpe/qcopenvelope_qws.h> #endif +#include <qlabel.h> #include <qcheckbox.h> #include <qtabwidget.h> #include <qslider.h> @@ -54,12 +55,17 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); m_cres = ODevice::inst ( )-> displayContrastResolution ( ); + // check whether to show the light sensor stuff + if ( !ODevice::inst ( )-> hasLightSensor ( )) { auto_brightness-> hide ( ); CalibrateLightSensor-> hide ( ); auto_brightness_ac-> hide ( ); CalibrateLightSensor_ac-> hide ( ); } + + // check whether to show the contrast stuff + if (m_cres) { GroupLight->setTitle(tr("Backlight && Contrast")); GroupLight_ac->setTitle(GroupLight->title()); @@ -68,15 +74,28 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) contrast_ac->hide(); } + // check whether to show the cpu frequency stuff + QStrList freq = ODevice::inst()->allowedCpuFrequencies(); if ( freq.count() ) { frequency->insertStrList( freq ); 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" ); @@ -91,6 +110,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) // CPU frequency frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); + // 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 )); @@ -122,6 +144,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) // CPU frequency 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 )); brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); @@ -140,7 +165,7 @@ 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 ); lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); @@ -163,6 +188,9 @@ 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_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 ( ) @@ -201,7 +229,6 @@ void LightSettings::setBacklight ( int bright ) void LightSettings::setContrast ( int contr ) { if (contr == -1) contr = m_oldcontrast; - ODevice::inst ( )-> setDisplayContrast(contr); } @@ -217,6 +244,11 @@ void LightSettings::resetBacklight ( ) setContrast ( -1 ); } +void LightSettings::setCloseHingeAction ( int index ) +{ + qWarning("LightSettings::setCloseHingeStatus(%d)", index); +} + void LightSettings::accept ( ) { Config config ( "apm" ); @@ -231,6 +263,7 @@ void LightSettings::accept ( ) if (m_cres) config. writeEntry ( "Contrast", contrast-> value () ); config. writeEntry ( "Freq", frequency->currentItem() ); + config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); // ac config. setGroup ( "AC" ); @@ -242,6 +275,7 @@ void LightSettings::accept ( ) if (m_cres) 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 if ( ODevice::inst ( )-> hasLightSensor ( )) { |