summaryrefslogtreecommitdiff
authorskyhusker <skyhusker>2005-06-17 15:17:10 (UTC)
committer skyhusker <skyhusker>2005-06-17 15:17:10 (UTC)
commit59c9cc89634e83fee9a6ee7162500b3c4d294233 (patch) (unidiff)
treebb0bc772d505cb3da34f576772510fdfa601785f
parentc36e39b5b1e450e64d4c38cb59e56048a2bec258 (diff)
downloadopie-59c9cc89634e83fee9a6ee7162500b3c4d294233.zip
opie-59c9cc89634e83fee9a6ee7162500b3c4d294233.tar.gz
opie-59c9cc89634e83fee9a6ee7162500b3c4d294233.tar.bz2
Fix bug #1557
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 1c61787..d0ac878 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -79,195 +79,195 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
79 } 79 }
80 80
81 // check whether to show the cpu frequency stuff 81 // check whether to show the cpu frequency stuff
82 82
83 QStrList freq = ODevice::inst()->allowedCpuFrequencies(); 83 QStrList freq = ODevice::inst()->allowedCpuFrequencies();
84 if ( freq.count() ) { 84 if ( freq.count() ) {
85 frequency->insertStrList( freq ); 85 frequency->insertStrList( freq );
86 frequency_ac->insertStrList( freq ); 86 frequency_ac->insertStrList( freq );
87 } else { 87 } else {
88 frequencyLabel->hide(); 88 frequencyLabel->hide();
89 frequency->hide(); 89 frequency->hide();
90 frequencyLabel_ac->hide(); 90 frequencyLabel_ac->hide();
91 frequency_ac->hide(); 91 frequency_ac->hide();
92 } 92 }
93 93
94 // check whether to show the hinge action stuff 94 // check whether to show the hinge action stuff
95 95
96 if ( !ODevice::inst()->hasHingeSensor() ) { 96 if ( !ODevice::inst()->hasHingeSensor() ) {
97 closeHingeLabel->hide(); 97 closeHingeLabel->hide();
98 closeHingeAction->hide(); 98 closeHingeAction->hide();
99 closeHingeLabel_ac->hide(); 99 closeHingeLabel_ac->hide();
100 closeHingeAction_ac->hide(); 100 closeHingeAction_ac->hide();
101 } 101 }
102 102
103 Config config ( "apm" ); 103 Config config ( "apm" );
104 config. setGroup ( "Battery" ); 104 config. setGroup ( "Battery" );
105 105
106 // battery spinboxes 106 // battery spinboxes
107 interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); 107 interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 ));
108 interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); 108 interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 ));
109 interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); 109 interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 ));
110 110
111 // battery check and slider 111 // battery check and slider
112 LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 112 LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
113 113
114 // CPU frequency 114 // CPU frequency
115 frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); 115 frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
116 116
117 // hinge action 117 // hinge action
118 closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 118 closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
119 119
120 int bright = config. readNumEntry ( "Brightness", 127 ); 120 int bright = config. readNumEntry ( "Brightness", 127 );
121 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); 121 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
122 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); 122 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
123 brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); 123 brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
124 brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); 124 brightness-> setPageStep ( QMAX( 1, 256 / m_bres ));
125 brightness-> setValue ( bright ); 125 brightness-> setValue ( bright );
126 126
127// 127//
128 if (m_cres) { 128 if (m_cres) {
129 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); 129 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres ));
130 contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); 130 contrast-> setLineStep ( QMAX( 1, 256 / m_cres ));
131 contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); 131 contrast-> setPageStep ( QMAX( 1, 256 / m_cres ));
132 contrast-> setValue ( contr ); 132 contrast-> setValue ( contr );
133 } 133 }
134 134
135 // light sensor 135 // light sensor
136 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 136 auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
137 m_sensordata = config. readListEntry ( "LightSensorData", ';' ); 137 m_sensordata = config. readListEntry ( "LightSensorData", ';' );
138 138
139 config. setGroup ( "AC" ); 139 config. setGroup ( "AC" );
140 140
141 // ac spinboxes 141 // ac spinboxes
142 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); 142 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 ));
143 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); 143 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 ));
144 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); 144 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 ));
145 145
146 // ac check and slider 146 // ac check and slider
147 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 147 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
148 148
149 // CPU frequency 149 // CPU frequency
150 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); 150 frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) );
151 151
152 // hinge action 152 // hinge action
153 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); 153 closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
154 154
155 bright = config. readNumEntry ( "Brightness", 255 ); 155 bright = config. readNumEntry ( "Brightness", 255 );
156 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); 156 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
157 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); 157 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
158 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); 158 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
159 brightness_ac-> setValue ( bright ); 159 brightness_ac-> setValue ( bright );
160 160
161 if (m_cres) { 161 if (m_cres) {
162 contr = config. readNumEntry ( "Contrast", 127); 162 contr = config. readNumEntry ( "Contrast", 127);
163 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); 163 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
164 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); 164 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
165 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); 165 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
166 contrast_ac-> setValue ( contr ); 166 contrast_ac-> setValue ( contr );
167 } 167 }
168 168
169 // light sensor 169 // light sensor
170 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 170 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
171 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 171 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
172 172
173 // warnings 173 // warnings
174 config. setGroup ( "Warnings" ); 174 config. setGroup ( "Warnings" );
175 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); 175 warnintervalBox-> setValue ( config. readNumEntry ( "check_interval", 10000 ) / 1000 );
176 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); 176 lowSpinBox-> setValue ( config. readNumEntry ( "power_verylow", 10 ) );
177 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); 177 criticalSpinBox-> setValue ( config. readNumEntry ( "power_critical", 5 ) );
178 178
179 m_resettimer = new QTimer ( this ); 179 m_resettimer = new QTimer ( this );
180 connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); 180 connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight()));
181 181
182 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { 182 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
183 tabs-> setCurrentPage ( 0 ); 183 tabs-> setCurrentPage ( 0 );
184 brightness->setFocus(); 184 brightness->setFocus();
185 } 185 }
186 else { 186 else {
187 tabs-> setCurrentPage ( 1 ); 187 tabs-> setCurrentPage ( 1 );
188 brightness_ac->setFocus(); 188 brightness_ac->setFocus();
189 } 189 }
190 190
191 connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); 191 connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
192 connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); 192 connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int)));
193 if (m_cres) { 193 if (m_cres) {
194 connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); 194 connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
195 connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); 195 connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int)));
196 } 196 }
197 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 197 connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
198 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); 198 connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) );
199 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 199 connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
200 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); 200 connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) );
201} 201}
202 202
203LightSettings::~LightSettings ( ) 203LightSettings::~LightSettings ( )
204{ 204{
205} 205}
206 206
207void LightSettings::calibrateSensor ( ) 207void LightSettings::calibrateSensor ( )
208{ 208{
209 Sensor *s = new Sensor ( m_sensordata, this ); 209 Sensor *s = new Sensor ( m_sensordata, this );
210 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); 210 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
211 QPEApplication::execDialog( s ); 211 QPEApplication::execDialog( s );
212 delete s; 212 delete s;
213} 213}
214 214
215void LightSettings::calibrateSensorAC ( ) 215void LightSettings::calibrateSensorAC ( )
216{ 216{
217 Sensor *s = new Sensor ( m_sensordata_ac, this ); 217 Sensor *s = new Sensor ( m_sensordata_ac, this );
218 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); 218 connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int)));
219 QPEApplication::execDialog ( s ); 219 QPEApplication::execDialog ( s );
220 delete s; 220 delete s;
221} 221}
222 222
223void LightSettings::setBacklight ( int bright ) 223void LightSettings::setBacklight ( int bright )
224{ 224{
225 QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); 225 QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
226 e << bright; 226 e << bright;
227 227
228 if ( bright != -1 ) { 228 if ( bright != -1 ) {
229 m_resettimer-> stop ( ); 229 m_resettimer-> stop ( );
230 m_resettimer-> start ( 4000, true ); 230 m_resettimer-> start ( 4000, true );
231 } 231 }
232} 232}
233 233
234void LightSettings::setContrast ( int contr ) 234void LightSettings::setContrast ( int contr )
235{ 235{
236 if (contr == -1) contr = m_oldcontrast; 236 if (contr == -1) contr = m_oldcontrast;
237 ODevice::inst ( )-> setDisplayContrast(contr); 237 ODevice::inst ( )-> setDisplayContrast(contr);
238} 238}
239 239
240void LightSettings::setFrequency ( int index ) 240void LightSettings::setFrequency ( int index )
241{ 241{
242 owarn << "LightSettings::setFrequency(" << index << ")" << oendl; 242 owarn << "LightSettings::setFrequency(" << index << ")" << oendl;
243 ODevice::inst ( )-> setCurrentCpuFrequency(index); 243 ODevice::inst ( )-> setCurrentCpuFrequency(index);
244} 244}
245 245
246void LightSettings::resetBacklight ( ) 246void LightSettings::resetBacklight ( )
247{ 247{
248 setBacklight ( -1 ); 248 setBacklight ( -1 );
249 setContrast ( -1 ); 249 setContrast ( -1 );
250} 250}
251 251
252void LightSettings::setCloseHingeAction ( int index ) 252void LightSettings::setCloseHingeAction ( int index )
253{ 253{
254 owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl; 254 owarn << "LightSettings::setCloseHingeStatus(" << index << ")" << oendl;
255} 255}
256 256
257void LightSettings::accept ( ) 257void LightSettings::accept ( )
258{ 258{
259 Config config ( "apm" ); 259 Config config ( "apm" );
260 260
261 // bat 261 // bat
262 config. setGroup ( "Battery" ); 262 config. setGroup ( "Battery" );
263 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); 263 config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( ));
264 config. writeEntry ( "Dim", interval_dim-> value ( )); 264 config. writeEntry ( "Dim", interval_dim-> value ( ));
265 config. writeEntry ( "LightOff", interval_lightoff-> value ( )); 265 config. writeEntry ( "LightOff", interval_lightoff-> value ( ));
266 config. writeEntry ( "Suspend", interval_suspend-> value ( )); 266 config. writeEntry ( "Suspend", interval_suspend-> value ( ));
267 config. writeEntry ( "Brightness", brightness-> value () ); 267 config. writeEntry ( "Brightness", brightness-> value () );
268 if (m_cres) 268 if (m_cres)
269 config. writeEntry ( "Contrast", contrast-> value () ); 269 config. writeEntry ( "Contrast", contrast-> value () );
270 config. writeEntry ( "Freq", frequency->currentItem() ); 270 config. writeEntry ( "Freq", frequency->currentItem() );
271 config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); 271 config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() );
272 272
273 // ac 273 // ac