summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-27 17:50:28 (UTC)
committer harlekin <harlekin>2002-10-27 17:50:28 (UTC)
commit17888d7ee97ec67c3f8c0f69fa30930b5a634ace (patch) (unidiff)
treef5873f98647c1ac2fbb7b3fbab051d698f849c01
parent3bdf11c7117e28cda91a1447b8510d7deba94b99 (diff)
downloadopie-17888d7ee97ec67c3f8c0f69fa30930b5a634ace.zip
opie-17888d7ee97ec67c3f8c0f69fa30930b5a634ace.tar.gz
opie-17888d7ee97ec67c3f8c0f69fa30930b5a634ace.tar.bz2
updated to new config entries
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp115
1 files changed, 64 insertions, 51 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
@@ -1,275 +1,288 @@
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
56using namespace Opie; 56using namespace Opie;
57 57
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 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( "apm" );
75 config.setGroup( "Screensaver" ); 75 config.setGroup( "Battery" );
76
76 int interval; 77 int interval;
77 // battery spinboxes 78 // battery spinboxes
78 interval = config.readNumEntry( "Interval_Dim", 20 ); 79 interval = config.readNumEntry( "Interval_Dim", 20 );
79 if ( config.readNumEntry("Dim",1) == 0 ) { 80 if ( config.readNumEntry("Dim",1) == 0 ) {
80 interval_dim->setSpecialValueText( tr("never") ); 81 interval_dim->setSpecialValueText( tr("never") );
81 } else { 82 } else {
82 interval_dim->setValue( interval ); 83 interval_dim->setValue( interval );
83 } 84 }
84 85
85 interval = config.readNumEntry( "Interval_LightOff", 30 ); 86 interval = config.readNumEntry( "Interval_LightOff", 30 );
86 if ( config.readNumEntry("LightOff",1) == 0 ) { 87 if ( config.readNumEntry("LightOff",1) == 0 ) {
87 interval_lightoff->setSpecialValueText( tr("never") ); 88 interval_lightoff->setSpecialValueText( tr("never") );
88 } else { 89 } else {
89 interval_lightoff->setValue( interval ); 90 interval_lightoff->setValue( interval );
90 } 91 }
91 92
92 interval = config.readNumEntry( "Interval", 60 ); 93 interval = config.readNumEntry( "Interval", 60 );
93 if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs) 94 if ( interval > 3600 ) interval /= 1000; // compatibility (was millisecs)
94 interval_suspend->setValue( interval );
95 95
96 if ( config.readNumEntry("NoApm", 0) == 0 ) {
97 interval_suspend->setSpecialValueText( tr("never") );
98 } else {
99 interval_suspend->setValue( interval );
100 }
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") );
100 } else { 122 } else {
101 interval_dim_ac_3->setValue( interval ); 123 interval_dim_ac_3->setValue( interval );
102 } 124 }
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") );
107 } else { 129 } else {
108 interval_lightoff_ac_3->setValue( interval ); 130 interval_lightoff_ac_3->setValue( interval );
109 } 131 }
110 132
111 interval = config.readNumEntry( "IntervalAC", 60 ); 133 interval = config.readNumEntry( "Interval", 60 );
112 if ( interval > 3600 ) { 134 if ( interval > 3600 ) {
113 interval /= 1000; // compatibility (was millisecs) 135 interval /= 1000; // compatibility (was millisecs)
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") );
117 } else { 139 } else {
118 interval_suspend_ac_3->setValue( interval ); 140 interval_suspend_ac_3->setValue( interval );
119 } 141 }
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 );
137 brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) ); 148 brightness_ac_3->setTickInterval( QMAX(1,maxbright_ac/16) );
138 brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) ); 149 brightness_ac_3->setLineStep( QMAX(1,maxbright_ac/16) );
139 brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); 150 brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) );
140 brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); 151 brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 );
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 ) );
148 //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); 158 //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) );
149 //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; 159 //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ;
150 //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); 160 //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) );
151 161
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
159 connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); 168 connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) );
160 connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); 169 connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) );
161} 170}
162 171
163LightSettings::~LightSettings() { 172LightSettings::~LightSettings() {
164} 173}
165 174
166void LightSettings::slotSliderTicks( int steps ) { 175void LightSettings::slotSliderTicks( int steps ) {
167// LightMinValueSlider->setTickInterval( steps ); 176// LightMinValueSlider->setTickInterval( steps );
168} 177}
169 178
170static void set_fl(int bright) 179static void set_fl(int bright)
171{ 180{
172 qDebug ( QString( "Brightness" ).arg( bright ) ); 181 qDebug ( QString( "Brightness" ).arg( bright ) );
173 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 182 QCopEnvelope e("QPE/System", "setBacklight(int)" );
174 e << bright; 183 e << bright;
175} 184}
176 185
177void LightSettings::reject() 186void LightSettings::reject()
178{ 187{
179 set_fl(initbright); 188 set_fl(initbright);
180 QDialog::reject(); 189 QDialog::reject();
181} 190}
182 191
183void LightSettings::accept() 192void LightSettings::accept()
184{ 193{
185 if ( qApp->focusWidget() ) { 194 if ( qApp->focusWidget() ) {
186 qApp->focusWidget()->clearFocus(); 195 qApp->focusWidget()->clearFocus();
187 } 196 }
188 197
189 applyBrightness(); 198 applyBrightness();
190 199
191 // bat 200 // bat
192 int i_dim = ( !( interval_dim->specialValueText() == tr("never") ) ? interval_dim->value() : 0); 201 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); 202 int i_lightoff = ( !( interval_lightoff->specialValueText() == tr("never") ) ? interval_lightoff->value() : 0);
194 int i_suspend = interval_suspend->value(); 203 int i_suspend = interval_suspend->value();
195 QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" ); 204 QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" );
196 e << i_dim << i_lightoff << i_suspend; 205 e << i_dim << i_lightoff << i_suspend;
197 206
198 // ac 207 // ac
199 int i_dim_ac = ( !( interval_dim_ac_3->specialValueText() == tr("never") ) ? interval_dim_ac_3->value() : 0); 208 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); 209 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(); 210 int i_suspend_ac = interval_suspend_ac_3->value();
202 QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" ); 211 QCopEnvelope e_ac("QPE/System", "setScreenSaverIntervalsAC(int,int,int)" );
203 e << i_dim_ac << i_lightoff_ac << i_suspend_ac; 212 e << i_dim_ac << i_lightoff_ac << i_suspend_ac;
204 213
205 Config config( "qpe" ); 214 Config config( "apm" );
206 config.setGroup( "Screensaver" ); 215
216 config.setGroup( "Battery" );
207 217
208 // bat 218 // bat
209 config.writeEntry( "Dim", interval_dim->specialValueText() == tr("never") ); 219 config.writeEntry( "Dim", interval_dim->specialValueText() == tr("never") );
210 config.writeEntry( "LightOff", interval_lightoff->specialValueText() == tr("never") ); 220 config.writeEntry( "LightOff", interval_lightoff->specialValueText() == tr("never") );
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() );
213 config.writeEntry( "Interval_LightOff", interval_lightoff->value() ); 224 config.writeEntry( "Interval_LightOff", interval_lightoff->value() );
214 config.writeEntry( "Interval", interval_suspend->value() ); 225 config.writeEntry( "Interval", interval_suspend->value() );
215 config.writeEntry( "Brightness", 226 config.writeEntry( "Brightness",
216 ( brightness->value() ) * 255 / brightness->maxValue() ); 227 ( brightness->value() ) * 255 / brightness->maxValue() );
217 228
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() );
228 240
229 241
230 // only make light sensor stuff appear if the unit has a sensor 242 // only make light sensor stuff appear if the unit has a sensor
231 if ( ODevice::inst()->hasLightSensor() ) { 243 if ( ODevice::inst()->hasLightSensor() ) {
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() );
236 //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); 250 //onfig.writeEntry( "MinValue", LightMinValueSlider->value() );
237 //config.writeEntry( "Shift", LightShiftSpin->value() ); 251 //config.writeEntry( "Shift", LightShiftSpin->value() );
238 } 252 }
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
251 QDialog::accept(); 264 QDialog::accept();
252} 265}
253 266
254void LightSettings::applyBrightness() 267void LightSettings::applyBrightness()
255{ 268{
256 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { 269 if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) {
257 int bright = ( brightness->value() ) * 255 / brightness->maxValue(); 270 int bright = ( brightness->value() ) * 255 / brightness->maxValue();
258 set_fl(bright); 271 set_fl(bright);
259 } 272 }
260} 273}
261 274
262void LightSettings::applyBrightnessAC() 275void LightSettings::applyBrightnessAC()
263{ 276{
264 // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting 277 // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting
265 if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { 278 if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) {
266 int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); 279 int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue();
267 set_fl(bright); 280 set_fl(bright);
268 } 281 }
269} 282}
270 283
271void LightSettings::done(int r) 284void LightSettings::done(int r)
272{ 285{
273 QDialog::done(r); 286 QDialog::done(r);
274 close (); 287 close();
275} 288}