-rw-r--r-- | core/settings/light-and-power/light.cpp | 9 |
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 | |||
@@ -1,278 +1,275 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // redone by Maximilian Reiss <harlekin@handhelds.org> | 21 | // redone by Maximilian Reiss <harlekin@handhelds.org> |
22 | 22 | ||
23 | #include "settings.h" | 23 | #include "settings.h" |
24 | 24 | ||
25 | #include <qpe/global.h> | 25 | #include <qpe/global.h> |
26 | #include <qpe/fontmanager.h> | 26 | #include <qpe/fontmanager.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/applnk.h> | 28 | #include <qpe/applnk.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/power.h> | 30 | #include <qpe/power.h> |
31 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 31 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
32 | #include <qpe/qcopenvelope_qws.h> | 32 | #include <qpe/qcopenvelope_qws.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | #include <qradiobutton.h> | 37 | #include <qradiobutton.h> |
38 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
39 | #include <qslider.h> | 39 | #include <qslider.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qdatastream.h> | 42 | #include <qdatastream.h> |
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | #include <qcombobox.h> | 44 | #include <qcombobox.h> |
45 | #include <qgroupbox.h> | 45 | #include <qgroupbox.h> |
46 | #include <qspinbox.h> | 46 | #include <qspinbox.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | #include <qlistbox.h> | 48 | #include <qlistbox.h> |
49 | #include <qdir.h> | 49 | #include <qdir.h> |
50 | #if QT_VERSION >= 300 | 50 | #if QT_VERSION >= 300 |
51 | #include <qstylefactory.h> | 51 | #include <qstylefactory.h> |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #include <opie/odevice.h> | 54 | #include <opie/odevice.h> |
55 | 55 | ||
56 | using namespace Opie; | 56 | using namespace Opie; |
57 | 57 | ||
58 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 58 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
59 | : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) | 59 | : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) |
60 | { | 60 | { |
61 | 61 | ||
62 | if ( ODevice::inst()->hasLightSensor() ) { | 62 | if ( ODevice::inst()->hasLightSensor() ) { |
63 | // Not supported yet - hide until implemented | 63 | // Not supported yet - hide until implemented |
64 | CalibrateLightSensor->setEnabled( false ); | 64 | CalibrateLightSensor->setEnabled( false ); |
65 | CalibrateLightSensorAC->setEnabled( false ); | 65 | CalibrateLightSensorAC->setEnabled( false ); |
66 | } else { | 66 | } else { |
67 | // if ipaq no need to show the sensor box | 67 | // if ipaq no need to show the sensor box |
68 | auto_brightness->hide(); | 68 | auto_brightness->hide(); |
69 | CalibrateLightSensor->hide(); | 69 | CalibrateLightSensor->hide(); |
70 | auto_brightness_ac_3->hide(); | 70 | auto_brightness_ac_3->hide(); |
71 | CalibrateLightSensorAC->hide(); | 71 | CalibrateLightSensorAC->hide(); |
72 | } | 72 | } |
73 | 73 | ||
74 | Config config( "qpe" ); | 74 | Config config( "qpe" ); |
75 | config.setGroup( "Screensaver" ); | 75 | config.setGroup( "Screensaver" ); |
76 | int interval; | 76 | int interval; |
77 | // battery spinboxes | 77 | // battery spinboxes |
78 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 78 | interval = config.readNumEntry( "Interval_Dim", 20 ); |
79 | if ( config.readNumEntry("Dim",1) == 0 ) { | 79 | if ( config.readNumEntry("Dim",1) == 0 ) { |
80 | interval_dim->setSpecialValueText( tr("never") ); | 80 | interval_dim->setSpecialValueText( tr("never") ); |
81 | } else { | 81 | } else { |
82 | interval_dim->setValue( interval ); | 82 | interval_dim->setValue( interval ); |
83 | } | 83 | } |
84 | 84 | ||
85 | interval = config.readNumEntry( "Interval_LightOff", 30 ); | 85 | interval = config.readNumEntry( "Interval_LightOff", 30 ); |
86 | if ( config.readNumEntry("LightOff",1) == 0 ) { | 86 | if ( config.readNumEntry("LightOff",1) == 0 ) { |
87 | interval_lightoff->setSpecialValueText( tr("never") ); | 87 | interval_lightoff->setSpecialValueText( tr("never") ); |
88 | } else { | 88 | } else { |
89 | interval_lightoff->setValue( interval ); | 89 | interval_lightoff->setValue( interval ); |
90 | } | 90 | } |
91 | 91 | ||
92 | interval = config.readNumEntry( "Interval", 60 ); | 92 | interval = config.readNumEntry( "Interval", 60 ); |
93 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) | 93 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) |
94 | interval_suspend->setValue( interval ); | 94 | interval_suspend->setValue( interval ); |
95 | 95 | ||
96 | // ac spinboxes | 96 | // ac spinboxes |
97 | interval = config.readNumEntry( "Interval_DimAC", 20 ); | 97 | interval = config.readNumEntry( "Interval_DimAC", 20 ); |
98 | if ( config.readNumEntry("DimAC",1) == 0 ) { | 98 | if ( config.readNumEntry("DimAC",1) == 0 ) { |
99 | interval_dim_ac_3->setSpecialValueText( tr("never") ); | 99 | interval_dim_ac_3->setSpecialValueText( tr("never") ); |
100 | } else { | 100 | } else { |
101 | interval_dim_ac_3->setValue( interval ); | 101 | interval_dim_ac_3->setValue( interval ); |
102 | } | 102 | } |
103 | 103 | ||
104 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); | 104 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); |
105 | if ( config.readNumEntry("LightOffAC",1) == 0 ) { | 105 | if ( config.readNumEntry("LightOffAC",1) == 0 ) { |
106 | interval_lightoff_ac_3->setSpecialValueText( tr("never") ); | 106 | interval_lightoff_ac_3->setSpecialValueText( tr("never") ); |
107 | } else { | 107 | } else { |
108 | interval_lightoff_ac_3->setValue( interval ); | 108 | interval_lightoff_ac_3->setValue( interval ); |
109 | } | 109 | } |
110 | 110 | ||
111 | interval = config.readNumEntry( "IntervalAC", 60 ); | 111 | interval = config.readNumEntry( "IntervalAC", 60 ); |
112 | if ( interval > 3600 ) { | 112 | if ( interval > 3600 ) { |
113 | interval /= 1000; // compatibility (was millisecs) | 113 | interval /= 1000; // compatibility (was millisecs) |
114 | } | 114 | } |
115 | if ( config.readNumEntry("NoApmAC", 0) == 0 ) { | 115 | if ( config.readNumEntry("NoApmAC", 0) == 0 ) { |
116 | interval_suspend_ac_3->setSpecialValueText( tr("never") ); | 116 | interval_suspend_ac_3->setSpecialValueText( tr("never") ); |
117 | } else { | 117 | } else { |
118 | interval_suspend_ac_3->setValue( interval ); | 118 | interval_suspend_ac_3->setValue( interval ); |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | // battery check and slider | 122 | // battery check and slider |
123 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 123 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); |
124 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); | 124 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); |
125 | initbright = config.readNumEntry("Brightness",255); | 125 | initbright = config.readNumEntry("Brightness",255); |
126 | brightness->setMaxValue( maxbright ); | 126 | brightness->setMaxValue( maxbright ); |
127 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | 127 | brightness->setTickInterval( QMAX(1,maxbright/16) ); |
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() ) ); |
161 | } | 161 | } |
162 | 162 | ||
163 | LightSettings::~LightSettings() { | 163 | LightSettings::~LightSettings() { |
164 | } | 164 | } |
165 | 165 | ||
166 | void LightSettings::slotSliderTicks( int steps ) { | 166 | void LightSettings::slotSliderTicks( int steps ) { |
167 | // LightMinValueSlider->setTickInterval( steps ); | 167 | // LightMinValueSlider->setTickInterval( steps ); |
168 | } | 168 | } |
169 | 169 | ||
170 | static void set_fl(int bright) | 170 | static void set_fl(int bright) |
171 | { | 171 | { |
172 | qDebug ( QString( "Brightness" ).arg( bright ) ); | 172 | qDebug ( QString( "Brightness" ).arg( bright ) ); |
173 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 173 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
174 | e << bright; | 174 | e << bright; |
175 | } | 175 | } |
176 | 176 | ||
177 | void LightSettings::reject() | 177 | void LightSettings::reject() |
178 | { | 178 | { |
179 | set_fl(initbright); | 179 | set_fl(initbright); |
180 | QDialog::reject(); | 180 | QDialog::reject(); |
181 | } | 181 | } |
182 | 182 | ||
183 | void LightSettings::accept() | 183 | void LightSettings::accept() |
184 | { | 184 | { |
185 | if ( qApp->focusWidget() ) { | 185 | if ( qApp->focusWidget() ) { |
186 | qApp->focusWidget()->clearFocus(); | 186 | qApp->focusWidget()->clearFocus(); |
187 | } | 187 | } |
188 | 188 | ||
189 | applyBrightness(); | 189 | applyBrightness(); |
190 | 190 | ||
191 | // bat | 191 | // bat |
192 | int i_dim = ( !( interval_dim->specialValueText() == tr("never") ) ? interval_dim->value() : 0); | 192 | int i_dim = ( !( interval_dim->specialValueText() == tr("never") ) ? interval_dim->value() : 0); |
193 | int i_lightoff = ( !( interval_lightoff->specialValueText() == tr("never") ) ? interval_lightoff->value() : 0); | 193 | int i_lightoff = ( !( interval_lightoff->specialValueText() == tr("never") ) ? interval_lightoff->value() : 0); |
194 | int i_suspend = interval_suspend->value(); | 194 | int i_suspend = interval_suspend->value(); |
195 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 195 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
196 | e << i_dim << i_lightoff << i_suspend; | 196 | e << i_dim << i_lightoff << i_suspend; |
197 | 197 | ||
198 | // ac | 198 | // ac |
199 | int i_dim_ac = ( !( interval_dim_ac_3->specialValueText() == tr("never") ) ? interval_dim_ac_3->value() : 0); | 199 | int i_dim_ac = ( !( interval_dim_ac_3->specialValueText() == tr("never") ) ? interval_dim_ac_3->value() : 0); |
200 | int i_lightoff_ac = ( !( interval_lightoff_ac_3->specialValueText() == tr("never") ) ? interval_lightoff_ac_3->value() : 0); | 200 | int i_lightoff_ac = ( !( interval_lightoff_ac_3->specialValueText() == tr("never") ) ? interval_lightoff_ac_3->value() : 0); |
201 | int i_suspend_ac = interval_suspend_ac_3->value(); | 201 | int i_suspend_ac = interval_suspend_ac_3->value(); |
202 | QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" ); | 202 | QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" ); |
203 | e << i_dim_ac << i_lightoff_ac << i_suspend_ac; | 203 | e << i_dim_ac << i_lightoff_ac << i_suspend_ac; |
204 | 204 | ||
205 | Config config( "qpe" ); | 205 | Config config( "qpe" ); |
206 | config.setGroup( "Screensaver" ); | 206 | config.setGroup( "Screensaver" ); |
207 | 207 | ||
208 | // bat | 208 | // bat |
209 | config.writeEntry( "Dim", interval_dim->specialValueText() == tr("never") ); | 209 | config.writeEntry( "Dim", interval_dim->specialValueText() == tr("never") ); |
210 | config.writeEntry( "LightOff", interval_lightoff->specialValueText() == tr("never") ); | 210 | config.writeEntry( "LightOff", interval_lightoff->specialValueText() == tr("never") ); |
211 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | 211 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); |
212 | config.writeEntry( "Interval_Dim", interval_dim->value() ); | 212 | config.writeEntry( "Interval_Dim", interval_dim->value() ); |
213 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); | 213 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); |
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()"); |
250 | conf.write(); | 249 | conf.write(); |
251 | 250 | ||
252 | QDialog::accept(); | 251 | QDialog::accept(); |
253 | } | 252 | } |
254 | 253 | ||
255 | void LightSettings::applyBrightness() | 254 | 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 | ||
263 | void LightSettings::applyBrightnessAC() | 262 | void 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 | |||
274 | void LightSettings::done(int r) | 271 | void LightSettings::done(int r) |
275 | { | 272 | { |
276 | QDialog::done(r); | 273 | QDialog::done(r); |
277 | close (); | 274 | close (); |
278 | } | 275 | } |