summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp36
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
@@ -58,6 +58,7 @@ using namespace Opie;
58LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) 58LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
59 : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) 59 : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp )
60{ 60{
61 int res = ODevice::inst ( )-> displayBrightnessResolution ( );
61 62
62 if ( ODevice::inst()->hasLightSensor() ) { 63 if ( ODevice::inst()->hasLightSensor() ) {
63 // Not supported yet - hide until implemented 64 // Not supported yet - hide until implemented
@@ -81,19 +82,17 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
81 82
82 // battery check and slider 83 // battery check and slider
83 LcdOffOnly->setChecked( config.readBoolEntry("LcdOffOnly",false)); 84 LcdOffOnly->setChecked( config.readBoolEntry("LcdOffOnly",false));
84 int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); 85
85 initbright = config.readNumEntry("Brightness",255); 86 initbright = config. readNumEntry ( "Brightness", 255 );
86 brightness->setMaxValue( maxbright ); 87 brightness-> setMaxValue ( res - 1 );
87 brightness->setTickInterval( QMAX(1,maxbright/16) ); 88 brightness-> setTickInterval ( QMAX( 1, res / 16 ));
88 brightness->setLineStep( QMAX(1,maxbright/16) ); 89 brightness-> setLineStep ( QMAX( 1, res / 16 ));
89 brightness->setPageStep( QMAX(1,maxbright/16) ); 90 brightness-> setPageStep ( QMAX( 1, res / 16 ));
90 brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); 91 brightness-> setValue (( initbright * ( res - 1 ) + 127 ) / 255 );
91 92
92 // light sensor 93 // light sensor
93 auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); 94 auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 );
94 95
95
96
97 config.setGroup( "AC" ); 96 config.setGroup( "AC" );
98 // ac spinboxes 97 // ac spinboxes
99 interval_dim_ac_3->setValue( config.readNumEntry( "Dim", 20 )); 98 interval_dim_ac_3->setValue( config.readNumEntry( "Dim", 20 ));
@@ -102,13 +101,13 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
102 101
103 // ac check and slider 102 // ac check and slider
104 LcdOffOnly_2_3->setChecked( config.readBoolEntry("LcdOffOnly",false)); 103 LcdOffOnly_2_3->setChecked( config.readBoolEntry("LcdOffOnly",false));
105 int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); 104
106 initbright_ac = config.readNumEntry("Brightness",255); 105 initbright_ac = config. readNumEntry ( "Brightness", 255 );
107 brightness_ac_3->setMaxValue( maxbright_ac ); 106 brightness_ac_3-> setMaxValue ( res - 1 );
108 brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) ); 107 brightness_ac_3-> setTickInterval ( QMAX( 1, res / 16 ));
109 brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) ); 108 brightness_ac_3-> setLineStep ( QMAX( 1, res / 16 ));
110 brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); 109 brightness_ac_3-> setPageStep ( QMAX( 1, res / 16 ));
111 brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); 110 brightness_ac_3-> setValue (( initbright_ac * ( res - 1 ) + 127 ) / 255 );
112 111
113 // light sensor 112 // light sensor
114 auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensor",0) != 0 ); 113 auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensor",0) != 0 );
@@ -138,7 +137,6 @@ void LightSettings::slotSliderTicks( int steps ) {
138 137
139static void set_fl(int bright) 138static void set_fl(int bright)
140{ 139{
141 qDebug ( QString( "Brightness" ).arg( bright ) );
142 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 140 QCopEnvelope e("QPE/System", "setBacklight(int)" );
143 e << bright; 141 e << bright;
144} 142}
@@ -192,9 +190,9 @@ void LightSettings::accept()
192 // only make light sensor stuff appear if the unit has a sensor 190 // only make light sensor stuff appear if the unit has a sensor
193 if ( ODevice::inst()->hasLightSensor() ) { 191 if ( ODevice::inst()->hasLightSensor() ) {
194 config.setGroup( "Battery" ); 192 config.setGroup( "Battery" );
195 config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); 193 config.writeEntry( "LightSensor", auto_brightness->isChecked() );
196 config.setGroup( "AC" ); 194 config.setGroup( "AC" );
197 config.writeEntry( "LightSensor", (int)auto_brightness_ac_3->isChecked() ); 195 config.writeEntry( "LightSensor", auto_brightness_ac_3->isChecked() );
198 //config.writeEntry( "Steps", LightStepSpin->value() ); 196 //config.writeEntry( "Steps", LightStepSpin->value() );
199 //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); 197 //onfig.writeEntry( "MinValue", LightMinValueSlider->value() );
200 //config.writeEntry( "Shift", LightShiftSpin->value() ); 198 //config.writeEntry( "Shift", LightShiftSpin->value() );