summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-05-10 17:33:15 (UTC)
committer mickeyl <mickeyl>2003-05-10 17:33:15 (UTC)
commit797a10cb009d58366d8eb3e792e350f87be4d100 (patch) (unidiff)
treea4225497e49f7c27bf6c80103db33375c1d27edf
parentd563040b1ccf4678f056626525d605e8bcba07ef (diff)
downloadopie-797a10cb009d58366d8eb3e792e350f87be4d100.zip
opie-797a10cb009d58366d8eb3e792e350f87be4d100.tar.gz
opie-797a10cb009d58366d8eb3e792e350f87be4d100.tar.bz2
fix battery status display which has been broken for weeks...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
index fdd963c..a32a3a6 100644
--- a/core/applets/batteryapplet/batterystatus.cpp
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -186,65 +186,65 @@ void BatteryStatus::paintEvent( QPaintEvent * ) {
186 else if ( ps->acStatus() == PowerStatus::Online ) 186 else if ( ps->acStatus() == PowerStatus::Online )
187 p.drawText( 10, 110, tr("Power on-line") ); 187 p.drawText( 10, 110, tr("Power on-line") );
188 else if ( ps->acStatus() == PowerStatus::Offline ) 188 else if ( ps->acStatus() == PowerStatus::Offline )
189 p.drawText( 10, 110, tr("External power disconnected") ); 189 p.drawText( 10, 110, tr("External power disconnected") );
190 190
191 if ( ps->batteryTimeRemaining() >= 0 ) { 191 if ( ps->batteryTimeRemaining() >= 0 ) {
192 text.sprintf( tr("Battery time remaining") + ": %im %02is", 192 text.sprintf( tr("Battery time remaining") + ": %im %02is",
193 ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 ); 193 ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 );
194 p.drawText( 10, 130, text ); 194 p.drawText( 10, 130, text );
195 } 195 }
196 196
197 QColor c; 197 QColor c;
198 QColor darkc; 198 QColor darkc;
199 QColor lightc; 199 QColor lightc;
200 if ( ps->acStatus() == PowerStatus::Offline ) { 200 if ( ps->acStatus() == PowerStatus::Offline ) {
201 c = blue.light(120); 201 c = blue.light(120);
202 darkc = c.dark(280); 202 darkc = c.dark(280);
203 lightc = c.light(145); 203 lightc = c.light(145);
204 } else if ( ps->acStatus() == PowerStatus::Online ) { 204 } else if ( ps->acStatus() == PowerStatus::Online ) {
205 c = green.dark(130); 205 c = green.dark(130);
206 darkc = c.dark(200); 206 darkc = c.dark(200);
207 lightc = c.light(220); 207 lightc = c.light(220);
208 } else { 208 } else {
209 c = red; 209 c = red;
210 darkc = c.dark(280); 210 darkc = c.dark(280);
211 lightc = c.light(140); 211 lightc = c.light(140);
212 } 212 }
213 if ( percent < 0 ) 213 if ( percent < 0 )
214 return; 214 return;
215 215
216 int rightEnd1 = screenWidth - 47; 216 int rightEnd1 = screenWidth - 47;
217 int rightEnd2 = screenWidth - 35; 217 int rightEnd2 = screenWidth - 35;
218 int percent2 = ( percent / 100 ) * rightEnd1 ; 218 int percent2 = ( percent / 100.0 ) * rightEnd1 ;
219 p.setPen( black ); 219 p.setPen( black );
220 qDrawShadePanel( &p, 9, 30, rightEnd1 , 39, colorGroup(), TRUE, 1, NULL); 220 qDrawShadePanel( &p, 9, 30, rightEnd1 , 39, colorGroup(), TRUE, 1, NULL);
221 qDrawShadePanel( &p, rightEnd2, 37, 12, 24, colorGroup(), TRUE, 1, NULL); 221 qDrawShadePanel( &p, rightEnd2, 37, 12, 24, colorGroup(), TRUE, 1, NULL);
222 drawSegment( &p, QRect( 10, 30, percent2, 40 ), lightc, darkc, lightc.light(115), 6 ); 222 drawSegment( &p, QRect( 10, 30, percent2, 40 ), lightc, darkc, lightc.light(115), 6 );
223 drawSegment( &p, QRect( 11 + percent2, 30, rightEnd1 - percent2, 40 ), white.light(80), black, white.light(90), 6 ); 223 drawSegment( &p, QRect( 11 + percent2, 30, rightEnd1 - percent2, 40 ), white.light(80), black, white.light(90), 6 );
224 drawSegment( &p, QRect( rightEnd2, 37, 10, 25 ), white.light(80), black, white.light(90), 2 ); 224 drawSegment( &p, QRect( rightEnd2, 37, 10, 25 ), white.light(80), black, white.light(90), 2 );
225 p.setPen( black); 225 p.setPen( black);
226 226
227 227
228 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) { 228 if ( ODevice::inst ( )-> series ( ) == Model_iPAQ ) {
229 229
230 p.drawText(15, 50, tr ("Ipaq " + ipaqChem)); 230 p.drawText(15, 50, tr ("Ipaq " + ipaqChem));
231 231
232 QString jacketMsg; 232 QString jacketMsg;
233 if (bat2) { 233 if (bat2) {
234 p.setPen(black); 234 p.setPen(black);
235 p.drawText(10,220, tr("Percentage battery remaining: ") + perc2 + " " + jackStatus); 235 p.drawText(10,220, tr("Percentage battery remaining: ") + perc2 + " " + jackStatus);
236 p.drawText(10,240, tr("Battery time remaining: ") + sec2); 236 p.drawText(10,240, tr("Battery time remaining: ") + sec2);
237 jacketMsg = tr("Jacket " + jackChem); 237 jacketMsg = tr("Jacket " + jackChem);
238 } else { 238 } else {
239 jackPercent = 0; 239 jackPercent = 0;
240 jacketMsg = tr("No jacket with battery inserted"); 240 jacketMsg = tr("No jacket with battery inserted");
241 } 241 }
242 242
243 int jackPerc = ( jackPercent / 100 ) * screenWidth - 47; 243 int jackPerc = ( jackPercent / 100 ) * screenWidth - 47;
244 244
245 qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL); 245 qDrawShadePanel( &p, 9, 160, rightEnd1, 39, colorGroup(), TRUE, 1, NULL);
246 qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL); 246 qDrawShadePanel( &p, rightEnd2, 167, 12, 24, colorGroup(), TRUE, 1, NULL);
247 drawSegment( &p, QRect( 10, 160, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 ); 247 drawSegment( &p, QRect( 10, 160, jackPerc, 40 ), lightc, darkc, lightc.light(115), 6 );
248 drawSegment( &p, QRect( 11 + jackPerc, 160, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 ); 248 drawSegment( &p, QRect( 11 + jackPerc, 160, rightEnd1 - jackPerc, 40 ), white.light(80), black, white.light(90), 6 );
249 drawSegment( &p, QRect( rightEnd2, 167, 10, 25 ), white.light(80), black, white.light(90), 2 ); 249 drawSegment( &p, QRect( rightEnd2, 167, 10, 25 ), white.light(80), black, white.light(90), 2 );
250 p.setPen( black ); 250 p.setPen( black );