author | sandman <sandman> | 2002-10-28 04:43:12 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-28 04:43:12 (UTC) |
commit | f3c9e44d9d694a0a803fb6a7d79cfa8d173b9864 (patch) (side-by-side diff) | |
tree | 311e3d30ef5d8fe4713c6ea3cbf0af6abdb8cd57 | |
parent | 226ddd19ef0adeb279c3a864e24cbfcf556b2f17 (diff) | |
download | opie-f3c9e44d9d694a0a803fb6a7d79cfa8d173b9864.zip opie-f3c9e44d9d694a0a803fb6a7d79cfa8d173b9864.tar.gz opie-f3c9e44d9d694a0a803fb6a7d79cfa8d173b9864.tar.bz2 |
The brightness sliders do not need a reversed logik anymore, since they are
horizontal now
-rw-r--r-- | core/settings/light-and-power/light.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index aa36e06..572f8ea 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp @@ -59,4 +59,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) { + int res = ODevice::inst ( )-> displayBrightnessResolution ( ); if ( ODevice::inst()->hasLightSensor() ) { @@ -82,17 +83,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) // battery check and slider LcdOffOnly->setChecked( config.readBoolEntry("LcdOffOnly",false)); - int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); - initbright = config.readNumEntry("Brightness",255); - brightness->setMaxValue( maxbright ); - brightness->setTickInterval( QMAX(1,maxbright/16) ); - brightness->setLineStep( QMAX(1,maxbright/16) ); - brightness->setPageStep( QMAX(1,maxbright/16) ); - brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); + + initbright = config. readNumEntry ( "Brightness", 255 ); + brightness-> setMaxValue ( res - 1 ); + brightness-> setTickInterval ( QMAX( 1, res / 16 )); + brightness-> setLineStep ( QMAX( 1, res / 16 )); + brightness-> setPageStep ( QMAX( 1, res / 16 )); + brightness-> setValue (( initbright * ( res - 1 ) + 127 ) / 255 ); // light sensor auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); - - config.setGroup( "AC" ); // ac spinboxes @@ -103,11 +102,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) // ac check and slider LcdOffOnly_2_3->setChecked( config.readBoolEntry("LcdOffOnly",false)); - int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); - initbright_ac = config.readNumEntry("Brightness",255); - brightness_ac_3->setMaxValue( maxbright_ac ); - brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) ); - brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) ); - brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); - brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); + + initbright_ac = config. readNumEntry ( "Brightness", 255 ); + brightness_ac_3-> setMaxValue ( res - 1 ); + brightness_ac_3-> setTickInterval ( QMAX( 1, res / 16 )); + brightness_ac_3-> setLineStep ( QMAX( 1, res / 16 )); + brightness_ac_3-> setPageStep ( QMAX( 1, res / 16 )); + brightness_ac_3-> setValue (( initbright_ac * ( res - 1 ) + 127 ) / 255 ); // light sensor @@ -139,5 +138,4 @@ void LightSettings::slotSliderTicks( int steps ) { static void set_fl(int bright) { - qDebug ( QString( "Brightness" ).arg( bright ) ); QCopEnvelope e("QPE/System", "setBacklight(int)" ); e << bright; @@ -193,7 +191,7 @@ void LightSettings::accept() if ( ODevice::inst()->hasLightSensor() ) { config.setGroup( "Battery" ); - config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); + config.writeEntry( "LightSensor", auto_brightness->isChecked() ); config.setGroup( "AC" ); - config.writeEntry( "LightSensor", (int)auto_brightness_ac_3->isChecked() ); + config.writeEntry( "LightSensor", auto_brightness_ac_3->isChecked() ); //config.writeEntry( "Steps", LightStepSpin->value() ); //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); |