author | llornkcor <llornkcor> | 2004-04-23 07:17:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-23 07:17:35 (UTC) |
commit | 448732c964768b5be8677a95aa1f9b07bad9e8a2 (patch) (unidiff) | |
tree | 9a42956b0f6153e1e4b188ee4f53827c5f663026 | |
parent | ba10e43945b15753e0438cd0176cfa61d61c7391 (diff) | |
download | opie-448732c964768b5be8677a95aa1f9b07bad9e8a2.zip opie-448732c964768b5be8677a95aa1f9b07bad9e8a2.tar.gz opie-448732c964768b5be8677a95aa1f9b07bad9e8a2.tar.bz2 |
doesnt make sense to turn light off before it dims for default
-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 ebcc25c..d64a063 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -1,297 +1,297 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "light.h" | 29 | #include "light.h" |
30 | #include "sensor.h" | 30 | #include "sensor.h" |
31 | 31 | ||
32 | #include <opie2/odevice.h> | 32 | #include <opie2/odevice.h> |
33 | 33 | ||
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/power.h> | 35 | #include <qpe/power.h> |
36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qslider.h> | 43 | #include <qslider.h> |
44 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
45 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
46 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | using namespace Opie::Core; | 51 | using namespace Opie::Core; |
52 | 52 | ||
53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) | 54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
55 | { | 55 | { |
56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
58 | 58 | ||
59 | // check whether to show the light sensor stuff | 59 | // check whether to show the light sensor stuff |
60 | 60 | ||
61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
62 | auto_brightness-> hide ( ); | 62 | auto_brightness-> hide ( ); |
63 | CalibrateLightSensor-> hide ( ); | 63 | CalibrateLightSensor-> hide ( ); |
64 | auto_brightness_ac-> hide ( ); | 64 | auto_brightness_ac-> hide ( ); |
65 | CalibrateLightSensor_ac-> hide ( ); | 65 | CalibrateLightSensor_ac-> hide ( ); |
66 | } | 66 | } |
67 | 67 | ||
68 | // check whether to show the contrast stuff | 68 | // check whether to show the contrast stuff |
69 | 69 | ||
70 | if (m_cres) { | 70 | if (m_cres) { |
71 | GroupLight->setTitle(tr("Backlight && Contrast")); | 71 | GroupLight->setTitle(tr("Backlight && Contrast")); |
72 | GroupLight_ac->setTitle(GroupLight->title()); | 72 | GroupLight_ac->setTitle(GroupLight->title()); |
73 | } else { | 73 | } else { |
74 | contrast->hide(); | 74 | contrast->hide(); |
75 | contrast_ac->hide(); | 75 | contrast_ac->hide(); |
76 | } | 76 | } |
77 | 77 | ||
78 | // check whether to show the cpu frequency stuff | 78 | // check whether to show the cpu frequency stuff |
79 | 79 | ||
80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
81 | if ( freq.count() ) { | 81 | if ( freq.count() ) { |
82 | frequency->insertStrList( freq ); | 82 | frequency->insertStrList( freq ); |
83 | frequency_ac->insertStrList( freq ); | 83 | frequency_ac->insertStrList( freq ); |
84 | } else { | 84 | } else { |
85 | frequencyLabel->hide(); | 85 | frequencyLabel->hide(); |
86 | frequency->hide(); | 86 | frequency->hide(); |
87 | frequencyLabel_ac->hide(); | 87 | frequencyLabel_ac->hide(); |
88 | frequency_ac->hide(); | 88 | frequency_ac->hide(); |
89 | } | 89 | } |
90 | 90 | ||
91 | // check whether to show the hinge action stuff | 91 | // check whether to show the hinge action stuff |
92 | 92 | ||
93 | if ( !ODevice::inst()->hasHingeSensor() ) { | 93 | if ( !ODevice::inst()->hasHingeSensor() ) { |
94 | closeHingeLabel->hide(); | 94 | closeHingeLabel->hide(); |
95 | closeHingeAction->hide(); | 95 | closeHingeAction->hide(); |
96 | closeHingeLabel_ac->hide(); | 96 | closeHingeLabel_ac->hide(); |
97 | closeHingeAction_ac->hide(); | 97 | closeHingeAction_ac->hide(); |
98 | } | 98 | } |
99 | 99 | ||
100 | Config config ( "apm" ); | 100 | Config config ( "apm" ); |
101 | config. setGroup ( "Battery" ); | 101 | config. setGroup ( "Battery" ); |
102 | 102 | ||
103 | // battery spinboxes | 103 | // battery spinboxes |
104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); | 104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); |
105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); | 105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); |
106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
107 | 107 | ||
108 | // battery check and slider | 108 | // battery check and slider |
109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
110 | 110 | ||
111 | // CPU frequency | 111 | // CPU frequency |
112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
113 | 113 | ||
114 | // hinge action | 114 | // hinge action |
115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
116 | 116 | ||
117 | int bright = config. readNumEntry ( "Brightness", 127 ); | 117 | int bright = config. readNumEntry ( "Brightness", 127 ); |
118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); | 120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); |
121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); | 121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); |
122 | brightness-> setValue ( bright ); | 122 | brightness-> setValue ( bright ); |
123 | 123 | ||
124 | if (m_cres) { | 124 | if (m_cres) { |
125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); | 126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); |
127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); | 127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); |
128 | contrast-> setValue ( contr ); | 128 | contrast-> setValue ( contr ); |
129 | } | 129 | } |
130 | 130 | ||
131 | // light sensor | 131 | // light sensor |
132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
133 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); | 133 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); |
134 | 134 | ||
135 | config. setGroup ( "AC" ); | 135 | config. setGroup ( "AC" ); |
136 | 136 | ||
137 | // ac spinboxes | 137 | // ac spinboxes |
138 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); | 138 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); |
139 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); | 139 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
140 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); | 140 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
141 | 141 | ||
142 | // ac check and slider | 142 | // ac check and slider |
143 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 143 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
144 | 144 | ||
145 | // CPU frequency | 145 | // CPU frequency |
146 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | 146 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); |
147 | 147 | ||
148 | // hinge action | 148 | // hinge action |
149 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 149 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
150 | 150 | ||
151 | bright = config. readNumEntry ( "Brightness", 255 ); | 151 | bright = config. readNumEntry ( "Brightness", 255 ); |
152 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 152 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
153 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 153 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
154 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); | 154 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); |
155 | brightness_ac-> setValue ( bright ); | 155 | brightness_ac-> setValue ( bright ); |
156 | 156 | ||
157 | if (m_cres) { | 157 | if (m_cres) { |
158 | contr = config. readNumEntry ( "Contrast", 127); | 158 | contr = config. readNumEntry ( "Contrast", 127); |
159 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 159 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
160 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); | 160 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); |
161 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); | 161 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); |
162 | contrast_ac-> setValue ( contr ); | 162 | contrast_ac-> setValue ( contr ); |
163 | } | 163 | } |
164 | 164 | ||
165 | // light sensor | 165 | // light sensor |
166 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 166 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
167 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | 167 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); |
168 | 168 | ||
169 | // warnings | 169 | // warnings |
170 | config. setGroup ( "Warnings" ); | 170 | config. setGroup ( "Warnings" ); |
171 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); | 171 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); |
172 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); | 172 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); |
173 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); | 173 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); |
174 | 174 | ||
175 | m_resettimer = new QTimer ( this ); | 175 | m_resettimer = new QTimer ( this ); |
176 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); | 176 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); |
177 | 177 | ||
178 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 178 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
179 | tabs-> setCurrentPage ( 0 ); | 179 | tabs-> setCurrentPage ( 0 ); |
180 | } | 180 | } |
181 | else { | 181 | else { |
182 | tabs-> setCurrentPage ( 1 ); | 182 | tabs-> setCurrentPage ( 1 ); |
183 | } | 183 | } |
184 | 184 | ||
185 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 185 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
186 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 186 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
187 | if (m_cres) { | 187 | if (m_cres) { |
188 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 188 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
189 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 189 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
190 | } | 190 | } |
191 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 191 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
192 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 192 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
193 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 193 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
194 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 194 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
195 | } | 195 | } |
196 | 196 | ||
197 | LightSettings::~LightSettings ( ) | 197 | LightSettings::~LightSettings ( ) |
198 | { | 198 | { |
199 | } | 199 | } |
200 | 200 | ||
201 | void LightSettings::calibrateSensor ( ) | 201 | void LightSettings::calibrateSensor ( ) |
202 | { | 202 | { |
203 | Sensor *s = new Sensor ( m_sensordata, this ); | 203 | Sensor *s = new Sensor ( m_sensordata, this ); |
204 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 204 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
205 | QPEApplication::execDialog( s ); | 205 | QPEApplication::execDialog( s ); |
206 | delete s; | 206 | delete s; |
207 | } | 207 | } |
208 | 208 | ||
209 | void LightSettings::calibrateSensorAC ( ) | 209 | void LightSettings::calibrateSensorAC ( ) |
210 | { | 210 | { |
211 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | 211 | Sensor *s = new Sensor ( m_sensordata_ac, this ); |
212 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 212 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
213 | QPEApplication::execDialog ( s ); | 213 | QPEApplication::execDialog ( s ); |
214 | delete s; | 214 | delete s; |
215 | } | 215 | } |
216 | 216 | ||
217 | void LightSettings::setBacklight ( int bright ) | 217 | void LightSettings::setBacklight ( int bright ) |
218 | { | 218 | { |
219 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | 219 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); |
220 | e << bright; | 220 | e << bright; |
221 | 221 | ||
222 | if ( bright != -1 ) { | 222 | if ( bright != -1 ) { |
223 | m_resettimer-> stop ( ); | 223 | m_resettimer-> stop ( ); |
224 | m_resettimer-> start ( 4000, true ); | 224 | m_resettimer-> start ( 4000, true ); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | void LightSettings::setContrast ( int contr ) | 228 | void LightSettings::setContrast ( int contr ) |
229 | { | 229 | { |
230 | if (contr == -1) contr = m_oldcontrast; | 230 | if (contr == -1) contr = m_oldcontrast; |
231 | ODevice::inst ( )-> setDisplayContrast(contr); | 231 | ODevice::inst ( )-> setDisplayContrast(contr); |
232 | } | 232 | } |
233 | 233 | ||
234 | void LightSettings::setFrequency ( int index ) | 234 | void LightSettings::setFrequency ( int index ) |
235 | { | 235 | { |
236 | qWarning("LightSettings::setFrequency(%d)", index); | 236 | qWarning("LightSettings::setFrequency(%d)", index); |
237 | ODevice::inst ( )-> setCurrentCpuFrequency(index); | 237 | ODevice::inst ( )-> setCurrentCpuFrequency(index); |
238 | } | 238 | } |
239 | 239 | ||
240 | void LightSettings::resetBacklight ( ) | 240 | void LightSettings::resetBacklight ( ) |
241 | { | 241 | { |
242 | setBacklight ( -1 ); | 242 | setBacklight ( -1 ); |
243 | setContrast ( -1 ); | 243 | setContrast ( -1 ); |
244 | } | 244 | } |
245 | 245 | ||
246 | void LightSettings::setCloseHingeAction ( int index ) | 246 | void LightSettings::setCloseHingeAction ( int index ) |
247 | { | 247 | { |
248 | qWarning("LightSettings::setCloseHingeStatus(%d)", index); | 248 | qWarning("LightSettings::setCloseHingeStatus(%d)", index); |
249 | } | 249 | } |
250 | 250 | ||
251 | void LightSettings::accept ( ) | 251 | void LightSettings::accept ( ) |
252 | { | 252 | { |
253 | Config config ( "apm" ); | 253 | Config config ( "apm" ); |
254 | 254 | ||
255 | // bat | 255 | // bat |
256 | config. setGroup ( "Battery" ); | 256 | config. setGroup ( "Battery" ); |
257 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); | 257 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); |
258 | config. writeEntry ( "Dim", interval_dim-> value ( )); | 258 | config. writeEntry ( "Dim", interval_dim-> value ( )); |
259 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); | 259 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); |
260 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); | 260 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); |
261 | config. writeEntry ( "Brightness", brightness-> value () ); | 261 | config. writeEntry ( "Brightness", brightness-> value () ); |
262 | if (m_cres) | 262 | if (m_cres) |
263 | config. writeEntry ( "Contrast", contrast-> value () ); | 263 | config. writeEntry ( "Contrast", contrast-> value () ); |
264 | config. writeEntry ( "Freq", frequency->currentItem() ); | 264 | config. writeEntry ( "Freq", frequency->currentItem() ); |
265 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); | 265 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); |
266 | 266 | ||
267 | // ac | 267 | // ac |
268 | config. setGroup ( "AC" ); | 268 | config. setGroup ( "AC" ); |
269 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); | 269 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); |
270 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); | 270 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); |
271 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); | 271 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); |
272 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); | 272 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); |
273 | config. writeEntry ( "Brightness", brightness_ac-> value () ); | 273 | config. writeEntry ( "Brightness", brightness_ac-> value () ); |
274 | if (m_cres) | 274 | if (m_cres) |
275 | config. writeEntry ( "Contrast", contrast_ac-> value () ); | 275 | config. writeEntry ( "Contrast", contrast_ac-> value () ); |
276 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); | 276 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); |
277 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); | 277 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); |
278 | 278 | ||
279 | // only make light sensor stuff appear if the unit has a sensor | 279 | // only make light sensor stuff appear if the unit has a sensor |
280 | if ( ODevice::inst ( )-> hasLightSensor ( )) { | 280 | if ( ODevice::inst ( )-> hasLightSensor ( )) { |
281 | config. setGroup ( "Battery" ); | 281 | config. setGroup ( "Battery" ); |
282 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); | 282 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); |
283 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); | 283 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); |
284 | config. setGroup ( "AC" ); | 284 | config. setGroup ( "AC" ); |
285 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); | 285 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); |
286 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); | 286 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); |
287 | } | 287 | } |
288 | 288 | ||
289 | // advanced | 289 | // advanced |
290 | config. setGroup ( "Warnings" ); | 290 | config. setGroup ( "Warnings" ); |
291 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); | 291 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); |
292 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); | 292 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); |
293 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); | 293 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); |
294 | config. write ( ); | 294 | config. write ( ); |
295 | 295 | ||
296 | // notify the launcher | 296 | // notify the launcher |
297 | { | 297 | { |