author | harlekin <harlekin> | 2002-10-23 15:46:15 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-23 15:46:15 (UTC) |
commit | 748f658f5102a50502cd060d50b35fded71356c3 (patch) (unidiff) | |
tree | 07ba617972f63727cbe7eb64d6b9f62c7ba99fd9 | |
parent | d3c2817cea75b9b84ea02a102e7048abf109f848 (diff) | |
download | opie-748f658f5102a50502cd060d50b35fded71356c3.zip opie-748f658f5102a50502cd060d50b35fded71356c3.tar.gz opie-748f658f5102a50502cd060d50b35fded71356c3.tar.bz2 |
save values right
-rw-r--r-- | core/settings/light-and-power/light.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index da36826..0193a7b 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -11,260 +11,260 @@ | |||
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 <qlistbox.h> | 47 | #include <qlistbox.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #if QT_VERSION >= 300 | 49 | #if QT_VERSION >= 300 |
50 | #include <qstylefactory.h> | 50 | #include <qstylefactory.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <opie/odevice.h> | 53 | #include <opie/odevice.h> |
54 | 54 | ||
55 | using namespace Opie; | 55 | using namespace Opie; |
56 | 56 | ||
57 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | 57 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) |
58 | : LightSettingsBase( parent, name, TRUE, fl ) | 58 | : LightSettingsBase( parent, name, TRUE, fl ) |
59 | { | 59 | { |
60 | 60 | ||
61 | if ( ODevice::inst()->model() == Model_iPAQ_H31xx || | 61 | if ( ODevice::inst()->model() == Model_iPAQ_H31xx || |
62 | ODevice::inst()->model() == Model_iPAQ_H36xx || | 62 | ODevice::inst()->model() == Model_iPAQ_H36xx || |
63 | ODevice::inst()->model() == Model_iPAQ_H37xx || | 63 | ODevice::inst()->model() == Model_iPAQ_H37xx || |
64 | ODevice::inst()->model() == Model_iPAQ_H38xx ) { | 64 | ODevice::inst()->model() == Model_iPAQ_H38xx ) { |
65 | // Not supported yet - hide until implemented | 65 | // Not supported yet - hide until implemented |
66 | IpaqGroupBox->setEnabled( false ); | 66 | IpaqGroupBox->setEnabled( false ); |
67 | IpaqGroupBoxAC->setEnabled( false ); | 67 | IpaqGroupBoxAC->setEnabled( false ); |
68 | LightSensorGroupBox->setEnabled( false ); | 68 | LightSensorGroupBox->setEnabled( false ); |
69 | } else { | 69 | } else { |
70 | // if ipaq no need to show the sensor box | 70 | // if ipaq no need to show the sensor box |
71 | IpaqGroupBox->hide(); | 71 | IpaqGroupBox->hide(); |
72 | IpaqGroupBoxAC->hide(); | 72 | IpaqGroupBoxAC->hide(); |
73 | LightSensorGroupBox->hide(); | 73 | LightSensorGroupBox->hide(); |
74 | } | 74 | } |
75 | 75 | ||
76 | Config config( "qpe" ); | 76 | Config config( "qpe" ); |
77 | config.setGroup( "Screensaver" ); | 77 | config.setGroup( "Screensaver" ); |
78 | 78 | ||
79 | int interval; | 79 | int interval; |
80 | 80 | ||
81 | // battery spinboxes | 81 | // battery spinboxes |
82 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 82 | interval = config.readNumEntry( "Interval_Dim", 20 ); |
83 | interval_dim->setValue( interval ); | 83 | interval_dim->setValue( interval ); |
84 | interval = config.readNumEntry( "Interval_LightOff", 30 ); | 84 | interval = config.readNumEntry( "Interval_LightOff", 30 ); |
85 | interval_lightoff->setValue( interval ); | 85 | interval_lightoff->setValue( interval ); |
86 | interval = config.readNumEntry( "Interval", 60 ); | 86 | interval = config.readNumEntry( "Interval", 60 ); |
87 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) | 87 | if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) |
88 | interval_suspend->setValue( interval ); | 88 | interval_suspend->setValue( interval ); |
89 | 89 | ||
90 | // ac spinboxes | 90 | // ac spinboxes |
91 | interval = config.readNumEntry( "Interval_DimAC", 20 ); | 91 | interval = config.readNumEntry( "Interval_DimAC", 20 ); |
92 | interval_dim_ac_3->setValue( interval ); | 92 | interval_dim_ac_3->setValue( interval ); |
93 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); | 93 | interval = config.readNumEntry( "Interval_LightOffAC", 30 ); |
94 | interval_lightoff_ac_3->setValue( interval ); | 94 | interval_lightoff_ac_3->setValue( interval ); |
95 | interval = config.readNumEntry( "IntervalAC", 60 ); | 95 | interval = config.readNumEntry( "IntervalAC", 60 ); |
96 | if ( interval > 3600 ) { | 96 | if ( interval > 3600 ) { |
97 | interval /= 1000; // compatibility (was millisecs) | 97 | interval /= 1000; // compatibility (was millisecs) |
98 | } | 98 | } |
99 | interval_suspend_ac_3->setValue( interval ); | 99 | interval_suspend_ac_3->setValue( interval ); |
100 | 100 | ||
101 | 101 | ||
102 | // battery check and slider | 102 | // battery check and slider |
103 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); | 103 | screensaver_dim->setChecked( config.readNumEntry("Dim",1) != 0 ); |
104 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); | 104 | screensaver_lightoff->setChecked( config.readNumEntry("LightOff",1) != 0 ); |
105 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 105 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); |
106 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); | 106 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); |
107 | initbright = config.readNumEntry("Brightness",255); | 107 | initbright = config.readNumEntry("Brightness",255); |
108 | brightness->setMaxValue( maxbright ); | 108 | brightness->setMaxValue( maxbright ); |
109 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | 109 | brightness->setTickInterval( QMAX(1,maxbright/16) ); |
110 | brightness->setLineStep( QMAX(1,maxbright/16) ); | 110 | brightness->setLineStep( QMAX(1,maxbright/16) ); |
111 | brightness->setPageStep( QMAX(1,maxbright/16) ); | 111 | brightness->setPageStep( QMAX(1,maxbright/16) ); |
112 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); | 112 | brightness->setValue( (maxbright*255 - initbright*maxbright)/255 ); |
113 | 113 | ||
114 | // ac check and slider | 114 | // ac check and slider |
115 | screensaver_dim_ac_3->setChecked( config.readNumEntry("DimAC",1) != 0 ); | 115 | screensaver_dim_ac_3->setChecked( config.readNumEntry("DimAC",1) != 0 ); |
116 | screensaver_lightoff_ac_3->setChecked( config.readNumEntry("LightOffAC",1) != 0 ); | 116 | screensaver_lightoff_ac_3->setChecked( config.readNumEntry("LightOffAC",1) != 0 ); |
117 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 ); | 117 | LcdOffOnly_2_3->setChecked( config.readNumEntry("LcdOffOnlyAC",0) != 0 ); |
118 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); | 118 | int maxbright_ac = ODevice::inst ( )-> displayBrightnessResolution ( ); |
119 | initbright_ac = config.readNumEntry("BrightnessAC",255); | 119 | initbright_ac = config.readNumEntry("BrightnessAC",255); |
120 | brightness_ac_3->setMaxValue( maxbright_ac ); | 120 | brightness_ac_3->setMaxValue( maxbright_ac ); |
121 | brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) ); | 121 | brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) ); |
122 | brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) ); | 122 | brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) ); |
123 | brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); | 123 | brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); |
124 | brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); | 124 | brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); |
125 | 125 | ||
126 | 126 | ||
127 | // ipaq sensor | 127 | // ipaq sensor |
128 | config.setGroup( "Ipaq_light_sensor" ); | 128 | config.setGroup( "Ipaq_light_sensor" ); |
129 | auto_brightness->setChecked( config.readNumEntry("LightSensor",1) != 0 ); | 129 | auto_brightness->setChecked( config.readNumEntry("LightSensor",1) != 0 ); |
130 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 ); | 130 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 ); |
131 | LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); | 131 | LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); |
132 | LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); | 132 | LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); |
133 | connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; | 133 | connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; |
134 | LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); | 134 | LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); |
135 | 135 | ||
136 | // advanced settings | 136 | // advanced settings |
137 | Config conf("apm"); | 137 | Config conf("apm"); |
138 | conf.setGroup( "warnings" ); | 138 | conf.setGroup( "warnings" ); |
139 | warnintervalBox->setValue( conf.readNumEntry("checkinterval", 10000)/1000 ); | 139 | warnintervalBox->setValue( conf.readNumEntry("checkinterval", 10000)/1000 ); |
140 | lowSpinBox->setValue( conf.readNumEntry("powerverylow", 10 ) ); | 140 | lowSpinBox->setValue( conf.readNumEntry("powerverylow", 10 ) ); |
141 | criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) ); | 141 | criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) ); |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); | 145 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); |
146 | connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); | 146 | connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); |
147 | } | 147 | } |
148 | 148 | ||
149 | LightSettings::~LightSettings() | 149 | LightSettings::~LightSettings() |
150 | { | 150 | { |
151 | } | 151 | } |
152 | 152 | ||
153 | void LightSettings::slotSliderTicks( int steps ) { | 153 | void LightSettings::slotSliderTicks( int steps ) { |
154 | LightMinValueSlider->setTickInterval( steps ); | 154 | LightMinValueSlider->setTickInterval( steps ); |
155 | } | 155 | } |
156 | 156 | ||
157 | static void set_fl(int bright) | 157 | static void set_fl(int bright) |
158 | { | 158 | { |
159 | qDebug ( QString( "Brightness" ).arg( bright ) ); | 159 | qDebug ( QString( "Brightness" ).arg( bright ) ); |
160 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 160 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
161 | e << bright; | 161 | e << bright; |
162 | } | 162 | } |
163 | 163 | ||
164 | void LightSettings::reject() | 164 | void LightSettings::reject() |
165 | { | 165 | { |
166 | set_fl(initbright); | 166 | set_fl(initbright); |
167 | 167 | ||
168 | QDialog::reject(); | 168 | QDialog::reject(); |
169 | } | 169 | } |
170 | 170 | ||
171 | void LightSettings::accept() | 171 | void LightSettings::accept() |
172 | { | 172 | { |
173 | if ( qApp->focusWidget() ) | 173 | if ( qApp->focusWidget() ) |
174 | qApp->focusWidget()->clearFocus(); | 174 | qApp->focusWidget()->clearFocus(); |
175 | 175 | ||
176 | applyBrightness(); | 176 | applyBrightness(); |
177 | 177 | ||
178 | // bat | 178 | // bat |
179 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); | 179 | int i_dim = (screensaver_dim->isChecked() ? interval_dim->value() : 0); |
180 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); | 180 | int i_lightoff = (screensaver_lightoff->isChecked() ? interval_lightoff->value() : 0); |
181 | int i_suspend = interval_suspend->value(); | 181 | int i_suspend = interval_suspend->value(); |
182 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 182 | QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
183 | e << i_dim << i_lightoff << i_suspend; | 183 | e << i_dim << i_lightoff << i_suspend; |
184 | 184 | ||
185 | // ac | 185 | // ac |
186 | int i_dim_ac = (screensaver_dim_ac_3->isChecked() ? interval_dim_ac_3->value() : 0); | 186 | int i_dim_ac = (screensaver_dim_ac_3->isChecked() ? interval_dim_ac_3->value() : 0); |
187 | int i_lightoff_ac = (screensaver_lightoff_ac_3->isChecked() ? interval_lightoff_ac_3->value() : 0); | 187 | int i_lightoff_ac = (screensaver_lightoff_ac_3->isChecked() ? interval_lightoff_ac_3->value() : 0); |
188 | int i_suspend_ac = interval_suspend_ac_3->value(); | 188 | int i_suspend_ac = interval_suspend_ac_3->value(); |
189 | QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" ); | 189 | QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" ); |
190 | e << i_dim_ac << i_lightoff_ac << i_suspend_ac; | 190 | e << i_dim_ac << i_lightoff_ac << i_suspend_ac; |
191 | 191 | ||
192 | Config config( "qpe" ); | 192 | Config config( "qpe" ); |
193 | config.setGroup( "Screensaver" ); | 193 | config.setGroup( "Screensaver" ); |
194 | 194 | ||
195 | // bat | 195 | // bat |
196 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); | 196 | config.writeEntry( "Dim", (int)screensaver_dim->isChecked() ); |
197 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); | 197 | config.writeEntry( "LightOff", (int)screensaver_lightoff->isChecked() ); |
198 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); | 198 | config.writeEntry( "LcdOffOnly", (int)LcdOffOnly->isChecked() ); |
199 | config.writeEntry( "Interval_Dim", interval_dim->value() ); | 199 | config.writeEntry( "Interval_Dim", interval_dim->value() ); |
200 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); | 200 | config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); |
201 | config.writeEntry( "Interval", interval_suspend->value() ); | 201 | config.writeEntry( "Interval", interval_suspend->value() ); |
202 | config.writeEntry( "Brightness", | 202 | config.writeEntry( "Brightness", |
203 | (brightness->maxValue()-brightness->value())*255/brightness->maxValue() ); | 203 | ( brightness->value() ) * 255 / brightness->maxValue() ); |
204 | 204 | ||
205 | // ac | 205 | // ac |
206 | config.writeEntry( "DimAC", (int)screensaver_dim_ac_3->isChecked() ); | 206 | config.writeEntry( "DimAC", (int)screensaver_dim_ac_3->isChecked() ); |
207 | config.writeEntry( "LightOffAC", (int)screensaver_lightoff_ac_3->isChecked() ); | 207 | config.writeEntry( "LightOffAC", (int)screensaver_lightoff_ac_3->isChecked() ); |
208 | config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() ); | 208 | config.writeEntry( "LcdOffOnlyAC", (int)LcdOffOnly_2_3->isChecked() ); |
209 | config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() ); | 209 | config.writeEntry( "Interval_DimAC", interval_dim_ac_3->value() ); |
210 | config.writeEntry( "Interval_LightOffAC", interval_lightoff_ac_3->value() ); | 210 | config.writeEntry( "Interval_LightOffAC", interval_lightoff_ac_3->value() ); |
211 | config.writeEntry( "IntervalAC", interval_suspend_ac_3->value() ); | 211 | config.writeEntry( "IntervalAC", interval_suspend_ac_3->value() ); |
212 | config.writeEntry( "BrightnessAC", | 212 | config.writeEntry( "BrightnessAC", |
213 | (brightness_ac_3->maxValue() - brightness_ac_3->value())*255/brightness_ac_3->maxValue() ); | 213 | ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); |
214 | 214 | ||
215 | 215 | ||
216 | // only make ipaq light sensor entries in config file if on an ipaq | 216 | // only make ipaq light sensor entries in config file if on an ipaq |
217 | if ( ODevice::inst()->model() == Model_iPAQ_H31xx || | 217 | if ( ODevice::inst()->model() == Model_iPAQ_H31xx || |
218 | ODevice::inst()->model() == Model_iPAQ_H36xx || | 218 | ODevice::inst()->model() == Model_iPAQ_H36xx || |
219 | ODevice::inst()->model() == Model_iPAQ_H37xx || | 219 | ODevice::inst()->model() == Model_iPAQ_H37xx || |
220 | ODevice::inst()->model() == Model_iPAQ_H38xx ) { | 220 | ODevice::inst()->model() == Model_iPAQ_H38xx ) { |
221 | 221 | ||
222 | // ipaq sensor | 222 | // ipaq sensor |
223 | config.setGroup( "Ipaq_light_sensor" ); | 223 | config.setGroup( "Ipaq_light_sensor" ); |
224 | 224 | ||
225 | config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); | 225 | config.writeEntry( "LightSensor", (int)auto_brightness->isChecked() ); |
226 | config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() ); | 226 | config.writeEntry( "LightSensorAC", (int)auto_brightness_ac_3->isChecked() ); |
227 | config.writeEntry( "Steps", LightStepSpin->value() ); | 227 | config.writeEntry( "Steps", LightStepSpin->value() ); |
228 | config.writeEntry( "MinValue", LightMinValueSlider->value() ); | 228 | config.writeEntry( "MinValue", LightMinValueSlider->value() ); |
229 | config.writeEntry( "Shift", LightShiftSpin->value() ); | 229 | config.writeEntry( "Shift", LightShiftSpin->value() ); |
230 | } | 230 | } |
231 | 231 | ||
232 | config.write(); | 232 | config.write(); |
233 | 233 | ||
234 | // advanced | 234 | // advanced |
235 | Config conf("apm"); | 235 | Config conf("apm"); |
236 | conf.setGroup( "Warnings" ); | 236 | conf.setGroup( "Warnings" ); |
237 | conf.writeEntry( "check_interval", warnintervalBox->value()*1000 ); | 237 | conf.writeEntry( "check_interval", warnintervalBox->value()*1000 ); |
238 | conf.writeEntry( "power_verylow", lowSpinBox->value() ); | 238 | conf.writeEntry( "power_verylow", lowSpinBox->value() ); |
239 | conf.writeEntry( "power_critical", criticalSpinBox->value() ); | 239 | conf.writeEntry( "power_critical", criticalSpinBox->value() ); |
240 | QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()"); | 240 | QCopEnvelope e_warn("QPE/System", "reloadPowerWarnSettings()"); |
241 | conf.write(); | 241 | conf.write(); |
242 | 242 | ||
243 | 243 | ||
244 | QDialog::accept(); | 244 | QDialog::accept(); |
245 | } | 245 | } |
246 | 246 | ||
247 | void LightSettings::applyBrightness() | 247 | void LightSettings::applyBrightness() |
248 | { | 248 | { |
249 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | 249 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { |
250 | int bright = ( brightness->value() ) * 255 / brightness->maxValue(); | 250 | int bright = ( brightness->value() ) * 255 / brightness->maxValue(); |
251 | set_fl(bright); | 251 | set_fl(bright); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | void LightSettings::applyBrightnessAC() | 255 | void LightSettings::applyBrightnessAC() |
256 | { | 256 | { |
257 | // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting | 257 | // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting |
258 | if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { | 258 | if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { |
259 | int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); | 259 | int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); |
260 | set_fl(bright); | 260 | set_fl(bright); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | void LightSettings::done(int r) | 266 | void LightSettings::done(int r) |
267 | { | 267 | { |
268 | QDialog::done(r); | 268 | QDialog::done(r); |
269 | close ( ); | 269 | close ( ); |
270 | } | 270 | } |