author | kergoth <kergoth> | 2003-08-09 17:29:36 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:29:36 (UTC) |
commit | a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93 (patch) (unidiff) | |
tree | 5ce78e1a5dedd31b7851d53bf9f072bd44edd1b0 /core/applets | |
parent | a7e015198a8c5ad3b6e144a9032b059086253e00 (diff) | |
download | opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.zip opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.gz opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.bz2 |
Merge from BRANCH_1_0
-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 10 | ||||
-rw-r--r-- | core/applets/batteryapplet/batterystatus.cpp | 2 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 4 | ||||
-rw-r--r-- | core/applets/homeapplet/home.h | 0 | ||||
-rw-r--r-- | core/applets/restartapplet2/.cvsignore | 1 | ||||
-rw-r--r-- | core/applets/suspendapplet/suspend.h | 0 |
6 files changed, 5 insertions, 12 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 480d261..078ce8d 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp | |||
@@ -101,60 +101,50 @@ void BatteryMeter::timerEvent( QTimerEvent * ) | |||
101 | if ( batteryView ) | 101 | if ( batteryView ) |
102 | batteryView->repaint(); | 102 | batteryView->repaint(); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | void BatteryMeter::chargeTimeout() | 106 | void BatteryMeter::chargeTimeout() |
107 | { | 107 | { |
108 | percent += 20; | 108 | percent += 20; |
109 | if ( percent > 100 ) | 109 | if ( percent > 100 ) |
110 | percent = 0; | 110 | percent = 0; |
111 | 111 | ||
112 | repaint(FALSE); | 112 | repaint(FALSE); |
113 | if ( batteryView ) | 113 | if ( batteryView ) |
114 | batteryView->updatePercent( percent ); | 114 | batteryView->updatePercent( percent ); |
115 | } | 115 | } |
116 | 116 | ||
117 | void BatteryMeter::paintEvent( QPaintEvent* ) | 117 | void BatteryMeter::paintEvent( QPaintEvent* ) |
118 | { | 118 | { |
119 | if ( style == 1 ) | 119 | if ( style == 1 ) |
120 | { | 120 | { |
121 | QPainter p(this); | 121 | QPainter p(this); |
122 | QFont f( "Fixed", AppLnk::smallIconSize()/2 ); | 122 | QFont f( "Fixed", AppLnk::smallIconSize()/2 ); |
123 | QFontMetrics fm( f ); | 123 | QFontMetrics fm( f ); |
124 | p.setFont( f ); | 124 | p.setFont( f ); |
125 | if ( percent > 98 ) { | ||
126 | p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "F" ) ); | ||
127 | } | ||
128 | else if ( percent < 5 ) | ||
129 | { | ||
130 | p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "E" ) ); | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); | 125 | p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); |
135 | p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); | 126 | p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); |
136 | } | ||
137 | return; | 127 | return; |
138 | } | 128 | } |
139 | 129 | ||
140 | QPainter p(this); | 130 | QPainter p(this); |
141 | QColor color; | 131 | QColor color; |
142 | QColor g = gray.light( 160 ); | 132 | QColor g = gray.light( 160 ); |
143 | switch ( ps->acStatus() ) | 133 | switch ( ps->acStatus() ) |
144 | { | 134 | { |
145 | case PowerStatus::Offline: color = blue.light( 150 ); break; | 135 | case PowerStatus::Offline: color = blue.light( 150 ); break; |
146 | case PowerStatus::Online: color = green.dark( 130 ).light( 180 ); break; | 136 | case PowerStatus::Online: color = green.dark( 130 ).light( 180 ); break; |
147 | default: color = red.light( 160 ); | 137 | default: color = red.light( 160 ); |
148 | } | 138 | } |
149 | 139 | ||
150 | int w = height() / 2; | 140 | int w = height() / 2; |
151 | if ( !(w%2) ) w--; // should have an odd value to get a real middle line | 141 | if ( !(w%2) ) w--; // should have an odd value to get a real middle line |
152 | int h = height() - 4; | 142 | int h = height() - 4; |
153 | int pix = (percent * h) / 100; | 143 | int pix = (percent * h) / 100; |
154 | int y2 = height() -2; | 144 | int y2 = height() -2; |
155 | int y = y2 - pix; | 145 | int y = y2 - pix; |
156 | int x1 = (width() - w ) / 2; | 146 | int x1 = (width() - w ) / 2; |
157 | 147 | ||
158 | p.setPen(QColor(80,80,80)); | 148 | p.setPen(QColor(80,80,80)); |
159 | p.drawLine(x1+w/4,0,x1+w/4+w/2+1,0); // header | 149 | p.drawLine(x1+w/4,0,x1+w/4+w/2+1,0); // header |
160 | p.drawRect(x1,1,w,height()-1); // corpus | 150 | p.drawRect(x1,1,w,height()-1); // corpus |
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp index 092a48d..5936b5d 100644 --- a/core/applets/batteryapplet/batterystatus.cpp +++ b/core/applets/batteryapplet/batterystatus.cpp | |||
@@ -219,37 +219,37 @@ void BatteryStatus::paintEvent( QPaintEvent * ) { | |||
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.0 ) * screenWidth - 47; | 243 | int jackPerc = ( jackPercent / 100.0 ) * ( 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 ); |
251 | p.drawText(15, 180, jacketMsg); | 251 | p.drawText(15, 180, jacketMsg); |
252 | } | 252 | } |
253 | 253 | ||
254 | } | 254 | } |
255 | 255 | ||
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index b8c4553..4ed09b8 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -251,49 +251,51 @@ bool CardMonitor::getStatusPcmcia(int showPopUp) | |||
251 | QString what = QString::null; | 251 | QString what = QString::null; |
252 | if (cardWas0 != cardInPcmcia0) { | 252 | if (cardWas0 != cardInPcmcia0) { |
253 | if (cardInPcmcia0) { | 253 | if (cardInPcmcia0) { |
254 | text += tr("New card: "); | 254 | text += tr("New card: "); |
255 | what = "on"; | 255 | what = "on"; |
256 | } else { | 256 | } else { |
257 | text += tr("Ejected: "); | 257 | text += tr("Ejected: "); |
258 | what = "off"; | 258 | what = "off"; |
259 | } | 259 | } |
260 | text += cardInPcmcia0Name; | 260 | text += cardInPcmcia0Name; |
261 | popUp(text, "cardmon/" + cardInPcmcia0Type); | 261 | popUp(text, "cardmon/" + cardInPcmcia0Type); |
262 | } | 262 | } |
263 | 263 | ||
264 | if (cardWas1 != cardInPcmcia1) { | 264 | if (cardWas1 != cardInPcmcia1) { |
265 | if (cardInPcmcia1) { | 265 | if (cardInPcmcia1) { |
266 | text += tr("New card: "); | 266 | text += tr("New card: "); |
267 | what = "on"; | 267 | what = "on"; |
268 | } else { | 268 | } else { |
269 | text += tr("Ejected: "); | 269 | text += tr("Ejected: "); |
270 | what = "off"; | 270 | what = "off"; |
271 | } | 271 | } |
272 | text += cardInPcmcia1Name; | 272 | text += cardInPcmcia1Name; |
273 | popUp(text, "cardmon/" + cardInPcmcia1Type); | 273 | popUp(text, "cardmon/" + cardInPcmcia1Type); |
274 | } | 274 | } |
275 | #ifndef QT_NO_SOUND | ||
275 | QSound::play(Resource::findSound("cardmon/card" + what)); | 276 | QSound::play(Resource::findSound("cardmon/card" + what)); |
277 | #endif | ||
276 | } | 278 | } |
277 | } else { | 279 | } else { |
278 | // no file found | 280 | // no file found |
279 | qDebug("no file found"); | 281 | qDebug("no file found"); |
280 | cardInPcmcia0 = FALSE; | 282 | cardInPcmcia0 = FALSE; |
281 | cardInPcmcia1 = FALSE; | 283 | cardInPcmcia1 = FALSE; |
282 | } | 284 | } |
283 | repaint( FALSE ); | 285 | repaint( FALSE ); |
284 | return ((cardWas0 == cardInPcmcia0 | 286 | return ((cardWas0 == cardInPcmcia0 |
285 | && cardWas1 == cardInPcmcia1) ? FALSE : TRUE); | 287 | && cardWas1 == cardInPcmcia1) ? FALSE : TRUE); |
286 | 288 | ||
287 | } | 289 | } |
288 | 290 | ||
289 | 291 | ||
290 | bool CardMonitor::getStatusSd(int showPopUp) | 292 | bool CardMonitor::getStatusSd(int showPopUp) |
291 | { | 293 | { |
292 | 294 | ||
293 | bool cardWas = cardInSd;// remember last state | 295 | bool cardWas = cardInSd;// remember last state |
294 | cardInSd = FALSE; | 296 | cardInSd = FALSE; |
295 | 297 | ||
296 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 298 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
297 | struct mntent *me; | 299 | struct mntent *me; |
298 | FILE *mntfp = setmntent("/etc/mtab", "r"); | 300 | FILE *mntfp = setmntent("/etc/mtab", "r"); |
299 | 301 | ||
@@ -303,47 +305,49 @@ bool CardMonitor::getStatusSd(int showPopUp) | |||
303 | //qDebug( fs ); | 305 | //qDebug( fs ); |
304 | if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" | 306 | if (fs.left(14) == "/dev/mmc/part1" || fs.left(7) == "/dev/sd" |
305 | || fs.left(9) == "/dev/mmcd") { | 307 | || fs.left(9) == "/dev/mmcd") { |
306 | cardInSd = TRUE; | 308 | cardInSd = TRUE; |
307 | show(); | 309 | show(); |
308 | } | 310 | } |
309 | // else { | 311 | // else { |
310 | // cardInSd = FALSE; | 312 | // cardInSd = FALSE; |
311 | // } | 313 | // } |
312 | } | 314 | } |
313 | endmntent(mntfp); | 315 | endmntent(mntfp); |
314 | } | 316 | } |
315 | 317 | ||
316 | if (!showPopUp && cardWas != cardInSd) { | 318 | if (!showPopUp && cardWas != cardInSd) { |
317 | QString text = QString::null; | 319 | QString text = QString::null; |
318 | QString what = QString::null; | 320 | QString what = QString::null; |
319 | if (cardInSd) { | 321 | if (cardInSd) { |
320 | text += "New card: SD/MMC"; | 322 | text += "New card: SD/MMC"; |
321 | what = "on"; | 323 | what = "on"; |
322 | } else { | 324 | } else { |
323 | text += "Ejected: SD/MMC"; | 325 | text += "Ejected: SD/MMC"; |
324 | what = "off"; | 326 | what = "off"; |
325 | } | 327 | } |
326 | //qDebug("TEXT: " + text ); | 328 | //qDebug("TEXT: " + text ); |
329 | #ifndef QT_NO_SOUND | ||
327 | QSound::play(Resource::findSound("cardmon/card" + what)); | 330 | QSound::play(Resource::findSound("cardmon/card" + what)); |
331 | #endif | ||
328 | popUp(text, "cardmon/ide");// XX add SD pic | 332 | popUp(text, "cardmon/ide");// XX add SD pic |
329 | } | 333 | } |
330 | #else | 334 | #else |
331 | #error "Not on Linux" | 335 | #error "Not on Linux" |
332 | #endif | 336 | #endif |
333 | repaint( FALSE ); | 337 | repaint( FALSE ); |
334 | return ((cardWas == cardInSd) ? FALSE : TRUE); | 338 | return ((cardWas == cardInSd) ? FALSE : TRUE); |
335 | } | 339 | } |
336 | 340 | ||
337 | void CardMonitor::paintEvent(QPaintEvent *) | 341 | void CardMonitor::paintEvent(QPaintEvent *) |
338 | { | 342 | { |
339 | 343 | ||
340 | QPainter p(this); | 344 | QPainter p(this); |
341 | 345 | ||
342 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { | 346 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { |
343 | p.drawPixmap(0, 0, pm ); | 347 | p.drawPixmap(0, 0, pm ); |
344 | show(); | 348 | show(); |
345 | } else { | 349 | } else { |
346 | //p.eraseRect(rect()); | 350 | //p.eraseRect(rect()); |
347 | hide(); | 351 | hide(); |
348 | } | 352 | } |
349 | } | 353 | } |
diff --git a/core/applets/homeapplet/home.h b/core/applets/homeapplet/home.h index 64af97d..1186caf 100644 --- a/core/applets/homeapplet/home.h +++ b/core/applets/homeapplet/home.h | |||
diff --git a/core/applets/restartapplet2/.cvsignore b/core/applets/restartapplet2/.cvsignore index a403d26..4943911 100644 --- a/core/applets/restartapplet2/.cvsignore +++ b/core/applets/restartapplet2/.cvsignore | |||
@@ -1,7 +1,6 @@ | |||
1 | *.moc | 1 | *.moc |
2 | *.~ | 2 | *.~ |
3 | Makefile* | 3 | Makefile* |
4 | config.in | 4 | config.in |
5 | moc_* | 5 | moc_* |
6 | opieobjconfig.in | 6 | opieobjconfig.in |
7 | opieobj | ||
diff --git a/core/applets/suspendapplet/suspend.h b/core/applets/suspendapplet/suspend.h index 0c92bcb..75467c1 100644 --- a/core/applets/suspendapplet/suspend.h +++ b/core/applets/suspendapplet/suspend.h | |||