summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-27 16:56:57 (UTC)
committer harlekin <harlekin>2002-10-27 16:56:57 (UTC)
commit3bdf11c7117e28cda91a1447b8510d7deba94b99 (patch) (unidiff)
treebd319dc62298cc1237adbc889beea099a1bbe409
parent27a2748d4a5893a888b19d3ed453be29cac0d75b (diff)
downloadopie-3bdf11c7117e28cda91a1447b8510d7deba94b99.zip
opie-3bdf11c7117e28cda91a1447b8510d7deba94b99.tar.gz
opie-3bdf11c7117e28cda91a1447b8510d7deba94b99.tar.bz2
light sensor more generell, not only ipaq
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 77c6b40..fb40adc 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -128,33 +128,33 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
128 brightness->setLineStep( QMAX(1,maxbright/16) ); 128 brightness->setLineStep( QMAX(1,maxbright/16) );
129 brightness->setPageStep( QMAX(1,maxbright/16) ); 129 brightness->setPageStep( QMAX(1,maxbright/16) );
130 brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); 130 brightness->setValue( (maxbright*255 - initbright*maxbright)/255 );
131 131
132 // ac check and slider 132 // ac check and slider
133 LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 ); 133 LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 );
134 int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); 134 int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( );
135 initbright_ac = config.readNumEntry("BrightnessAC",255); 135 initbright_ac = config.readNumEntry("BrightnessAC",255);
136 brightness_ac_3->setMaxValue( maxbright_ac ); 136 brightness_ac_3->setMaxValue( maxbright_ac );
137 brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) ); 137 brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) );
138 brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) ); 138 brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) );
139 brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); 139 brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) );
140 brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); 140 brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 );
141 141
142 142
143 // ipaq sensor 143 // ipaq sensor
144 config.setGroup( "Ipaqlightsensor" ); 144 config.setGroup( "lightsensor" );
145 auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); 145 auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 );
146 auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",0) != 0 ); 146 auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",0) != 0 );
147 //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); 147 //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) );
148 //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); 148 //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) );
149 //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; 149 //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ;
150 //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); 150 //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) );
151 151
152 // advanced settings 152 // advanced settings
153 Config conf("apm"); 153 Config conf("apm");
154 conf.setGroup( "warnings" ); 154 conf.setGroup( "warnings" );
155 warnintervalBox->setValue( conf.readNumEntry("checkinterval", 10000)/1000 ); 155 warnintervalBox->setValue( conf.readNumEntry("checkinterval", 10000)/1000 );
156 lowSpinBox->setValue( conf.readNumEntry("powerverylow", 10 ) ); 156 lowSpinBox->setValue( conf.readNumEntry("powerverylow", 10 ) );
157 criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) ); 157 criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) );
158 158
159 connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); 159 connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) );
160 connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); 160 connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) );
@@ -214,36 +214,35 @@ void LightSettings::accept()
214 config.writeEntry( "Interval", interval_suspend->value() ); 214 config.writeEntry( "Interval", interval_suspend->value() );
215 config.writeEntry( "Brightness", 215 config.writeEntry( "Brightness",
216 ( brightness->value() ) * 255 / brightness->maxValue() ); 216 ( brightness->value() ) * 255 / brightness->maxValue() );
217 217
218 // ac 218 // ac
219 config.writeEntry( "DimAC", interval_dim_ac_3->specialValueText() == tr("never") ); 219 config.writeEntry( "DimAC", interval_dim_ac_3->specialValueText() == tr("never") );
220 config.writeEntry( "LightOffAC", interval_lightoff_ac_3->specialValueText() == tr("never") ); 220 config.writeEntry( "LightOffAC", interval_lightoff_ac_3->specialValueText() == tr("never") );
221 config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() ); 221 config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() );
222 config.writeEntry( "NoAPmAC", interval_suspend_ac_3->specialValueText() == tr("never") ); 222 config.writeEntry( "NoAPmAC", interval_suspend_ac_3->specialValueText() == tr("never") );
223 config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() ); 223 config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() );
224 config.writeEntry( "Interval_LightOffAC", interval_lightoff_ac_3->value() ); 224 config.writeEntry( "Interval_LightOffAC", interval_lightoff_ac_3->value() );
225 config.writeEntry( "IntervalAC", interval_suspend_ac_3->value() ); 225 config.writeEntry( "IntervalAC", interval_suspend_ac_3->value() );
226 config.writeEntry( "BrightnessAC", 226 config.writeEntry( "BrightnessAC",
227 ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); 227 ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() );
228 228
229 229
230 // only make ipaq light sensor entries in config file if on an ipaq 230 // only make light sensor stuff appear if the unit has a sensor
231 if ( ODevice::inst()->hasLightSensor() ) { 231 if ( ODevice::inst()->hasLightSensor() ) {
232 // ipaq sensor 232 config.setGroup( "lightsensor" );
233 config.setGroup( "Ipaqlightsensor" );
234 config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); 233 config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() );
235 config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() ); 234 config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() );
236 //config.writeEntry( "Steps", LightStepSpin->value() ); 235 //config.writeEntry( "Steps", LightStepSpin->value() );
237 //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); 236 //onfig.writeEntry( "MinValue", LightMinValueSlider->value() );
238 //config.writeEntry( "Shift", LightShiftSpin->value() ); 237 //config.writeEntry( "Shift", LightShiftSpin->value() );
239 } 238 }
240 239
241 config.write(); 240 config.write();
242 241
243 // advanced 242 // advanced
244 Config conf("apm"); 243 Config conf("apm");
245 conf.setGroup( "Warnings" ); 244 conf.setGroup( "Warnings" );
246 conf.writeEntry( "check_interval", warnintervalBox->value()*1000 ); 245 conf.writeEntry( "check_interval", warnintervalBox->value()*1000 );
247 conf.writeEntry( "power_verylow", lowSpinBox->value() ); 246 conf.writeEntry( "power_verylow", lowSpinBox->value() );
248 conf.writeEntry( "power_critical", criticalSpinBox->value() ); 247 conf.writeEntry( "power_critical", criticalSpinBox->value() );
249 QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()"); 248 QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()");
@@ -256,23 +255,21 @@ void LightSettings::applyBrightness()
256{ 255{
257 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { 256 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) {
258 int bright = ( brightness->value() ) * 255 / brightness->maxValue(); 257 int bright = ( brightness->value() ) * 255 / brightness->maxValue();
259 set_fl(bright); 258 set_fl(bright);
260 } 259 }
261} 260}
262 261
263void LightSettings::applyBrightnessAC() 262void LightSettings::applyBrightnessAC()
264{ 263{
265 // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting 264 // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting
266 if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { 265 if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) {
267 int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); 266 int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue();
268 set_fl(bright); 267 set_fl(bright);
269 } 268 }
270} 269}
271 270
272
273
274void LightSettings::done(int r) 271void LightSettings::done(int r)
275{ 272{
276 QDialog::done(r); 273 QDialog::done(r);
277 close (); 274 close ();
278} 275}