author | harlekin <harlekin> | 2002-10-27 17:50:28 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-27 17:50:28 (UTC) |
commit | 17888d7ee97ec67c3f8c0f69fa30930b5a634ace (patch) (unidiff) | |
tree | f5873f98647c1ac2fbb7b3fbab051d698f849c01 | |
parent | 3bdf11c7117e28cda91a1447b8510d7deba94b99 (diff) | |
download | opie-17888d7ee97ec67c3f8c0f69fa30930b5a634ace.zip opie-17888d7ee97ec67c3f8c0f69fa30930b5a634ace.tar.gz opie-17888d7ee97ec67c3f8c0f69fa30930b5a634ace.tar.bz2 |
updated to new config entries
-rw-r--r-- | core/settings/light-and-power/light.cpp | 109 |
1 files changed, 61 insertions, 48 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index fb40adc..d2618d9 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -73,4 +73,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
73 | 73 | ||
74 | Config config( "qpe" ); | 74 | Config config( "apm" ); |
75 | config.setGroup( "Screensaver" ); | 75 | config.setGroup( "Battery" ); |
76 | |||
76 | int interval; | 77 | int interval; |
@@ -93,7 +94,28 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
93 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) | 94 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) |
95 | |||
96 | if ( config.readNumEntry("NoApm", 0) == 0 ) { | ||
97 | interval_suspend->setSpecialValueText( tr("never") ); | ||
98 | } else { | ||
94 | interval_suspend->setValue( interval ); | 99 | interval_suspend->setValue( interval ); |
100 | } | ||
95 | 101 | ||
102 | // battery check and slider | ||
103 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | ||
104 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); | ||
105 | initbright = config.readNumEntry("Brightness",255); | ||
106 | brightness->setMaxValue( maxbright ); | ||
107 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | ||
108 | brightness->setLineStep( QMAX(1,maxbright/16) ); | ||
109 | brightness->setPageStep( QMAX(1,maxbright/16) ); | ||
110 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); | ||
111 | |||
112 | // light sensor | ||
113 | auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); | ||
114 | |||
115 | |||
116 | |||
117 | config.setGroup( "AC" ); | ||
96 | // ac spinboxes | 118 | // ac spinboxes |
97 | interval = config.readNumEntry( "Interval_DimAC", 20 ); | 119 | interval = config.readNumEntry( "Interval_Dim", 20 ); |
98 | if ( config.readNumEntry("DimAC",1) == 0 ) { | 120 | if ( config.readNumEntry("Dim",1) == 0 ) { |
99 | interval_dim_ac_3->setSpecialValueText( tr("never") ); | 121 | interval_dim_ac_3->setSpecialValueText( tr("never") ); |
@@ -103,4 +125,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
103 | 125 | ||
104 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); | 126 | interval = config.readNumEntry( "Interval_LightOff", 30 ); |
105 | if ( config.readNumEntry("LightOffAC",1) == 0 ) { | 127 | if ( config.readNumEntry("LightOff",1) == 0 ) { |
106 | interval_lightoff_ac_3->setSpecialValueText( tr("never") ); | 128 | interval_lightoff_ac_3->setSpecialValueText( tr("never") ); |
@@ -110,3 +132,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
110 | 132 | ||
111 | interval = config.readNumEntry( "IntervalAC", 60 ); | 133 | interval = config.readNumEntry( "Interval", 60 ); |
112 | if ( interval > 3600 ) { | 134 | if ( interval > 3600 ) { |
@@ -114,3 +136,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
114 | } | 136 | } |
115 | if ( config.readNumEntry("NoApmAC", 0) == 0 ) { | 137 | if ( config.readNumEntry("NoApm", 0) == 0 ) { |
116 | interval_suspend_ac_3->setSpecialValueText( tr("never") ); | 138 | interval_suspend_ac_3->setSpecialValueText( tr("never") ); |
@@ -120,17 +142,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
120 | 142 | ||
121 | |||
122 | // battery check and slider | ||
123 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | ||
124 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); | ||
125 | initbright = config.readNumEntry("Brightness",255); | ||
126 | brightness->setMaxValue( maxbright ); | ||
127 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | ||
128 | brightness->setLineStep( QMAX(1,maxbright/16) ); | ||
129 | brightness->setPageStep( QMAX(1,maxbright/16) ); | ||
130 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); | ||
131 | |||
132 | // ac check and slider | 143 | // ac check and slider |
133 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 ); | 144 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); |
134 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); | 145 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); |
135 | initbright_ac = config.readNumEntry("BrightnessAC",255); | 146 | initbright_ac = config.readNumEntry("Brightness",255); |
136 | brightness_ac_3->setMaxValue( maxbright_ac ); | 147 | brightness_ac_3->setMaxValue( maxbright_ac ); |
@@ -141,7 +152,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
141 | 152 | ||
153 | // light sensor | ||
154 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensor",0) != 0 ); | ||
155 | |||
142 | 156 | ||
143 | // ipaq sensor | ||
144 | config.setGroup( "lightsensor" ); | ||
145 | auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); | ||
146 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",0) != 0 ); | ||
147 | //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); | 157 | //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); |
@@ -152,7 +162,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
152 | // advanced settings | 162 | // advanced settings |
153 | Config conf("apm"); | 163 | config.setGroup( "Warnings" ); |
154 | conf.setGroup( "warnings" ); | 164 | warnintervalBox->setValue( config.readNumEntry("checkinterval", 10000)/1000 ); |
155 | warnintervalBox->setValue( conf.readNumEntry("checkinterval", 10000)/1000 ); | 165 | lowSpinBox->setValue( config.readNumEntry("powerverylow", 10 ) ); |
156 | lowSpinBox->setValue( conf.readNumEntry("powerverylow", 10 ) ); | 166 | criticalSpinBox->setValue( config.readNumEntry("powercritical", 5 ) ); |
157 | criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) ); | ||
158 | 167 | ||
@@ -204,4 +213,5 @@ void LightSettings::accept() | |||
204 | 213 | ||
205 | Config config( "qpe" ); | 214 | Config config( "apm" ); |
206 | config.setGroup( "Screensaver" ); | 215 | |
216 | config.setGroup( "Battery" ); | ||
207 | 217 | ||
@@ -211,2 +221,3 @@ void LightSettings::accept() | |||
211 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | 221 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); |
222 | config.writeEntry( "NoAPm", interval_suspend->specialValueText() == tr("never") ); | ||
212 | config.writeEntry( "Interval_Dim", interval_dim->value() ); | 223 | config.writeEntry( "Interval_Dim", interval_dim->value() ); |
@@ -218,10 +229,11 @@ void LightSettings::accept() | |||
218 | // ac | 229 | // ac |
219 | config.writeEntry( "DimAC", interval_dim_ac_3->specialValueText() == tr("never") ); | 230 | config.setGroup( "AC" ); |
220 | config.writeEntry( "LightOffAC", interval_lightoff_ac_3->specialValueText() == tr("never") ); | 231 | config.writeEntry( "Dim", interval_dim_ac_3->specialValueText() == tr("never") ); |
221 | config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() ); | 232 | config.writeEntry( "LightOff", interval_lightoff_ac_3->specialValueText() == tr("never") ); |
222 | config.writeEntry( "NoAPmAC", interval_suspend_ac_3->specialValueText() == tr("never") ); | 233 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly_2_3->isChecked() ); |
223 | config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() ); | 234 | config.writeEntry( "NoAPm", interval_suspend_ac_3->specialValueText() == tr("never") ); |
224 | config.writeEntry( "Interval_LightOffAC", interval_lightoff_ac_3->value() ); | 235 | config.writeEntry( "Interval_Dim", interval_dim_ac_3->value() ); |
225 | config.writeEntry( "IntervalAC", interval_suspend_ac_3->value() ); | 236 | config.writeEntry( "Interval_LightOff", interval_lightoff_ac_3->value() ); |
226 | config.writeEntry( "BrightnessAC", | 237 | config.writeEntry( "Interval", interval_suspend_ac_3->value() ); |
238 | config.writeEntry( "Brightness", | ||
227 | ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); | 239 | ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); |
@@ -232,4 +244,6 @@ void LightSettings::accept() | |||
232 | config.setGroup( "lightsensor" ); | 244 | config.setGroup( "lightsensor" ); |
245 | config.setGroup( "Battery" ); | ||
233 | config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); | 246 | config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); |
234 | config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() ); | 247 | config.setGroup( "AC" ); |
248 | config.writeEntry( "LightSensor", (int)auto_brightness_ac_3->isChecked() ); | ||
235 | //config.writeEntry( "Steps", LightStepSpin->value() ); | 249 | //config.writeEntry( "Steps", LightStepSpin->value() ); |
@@ -239,12 +253,11 @@ void LightSettings::accept() | |||
239 | 253 | ||
240 | config.write(); | ||
241 | 254 | ||
242 | // advanced | 255 | // advanced |
243 | Config conf("apm"); | 256 | config.setGroup( "Warnings" ); |
244 | conf.setGroup( "Warnings" ); | 257 | config.writeEntry( "check_interval", warnintervalBox->value()*1000 ); |
245 | conf.writeEntry( "check_interval", warnintervalBox->value()*1000 ); | 258 | config.writeEntry( "power_verylow", lowSpinBox->value() ); |
246 | conf.writeEntry( "power_verylow", lowSpinBox->value() ); | 259 | config.writeEntry( "power_critical", criticalSpinBox->value() ); |
247 | conf.writeEntry( "power_critical", criticalSpinBox->value() ); | ||
248 | QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()"); | 260 | QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()"); |
249 | conf.write(); | 261 | |
262 | config.write(); | ||
250 | 263 | ||