author | harlekin <harlekin> | 2004-01-04 13:43:40 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-04 13:43:40 (UTC) |
commit | 84f039ef3799c5310a4f94057b9d76d4ee55f499 (patch) (side-by-side diff) | |
tree | d53ec9b3444dd338697f4ca0dd43605a499fc477 | |
parent | 8810bf223d97a98bfb746c0571ba1640c4351e8e (diff) | |
download | opie-84f039ef3799c5310a4f94057b9d76d4ee55f499.zip opie-84f039ef3799c5310a4f94057b9d76d4ee55f499.tar.gz opie-84f039ef3799c5310a4f94057b9d76d4ee55f499.tar.bz2 |
patch by Brad Campbell <brad@wasp.net.au>, show charging info correct again, thanks
-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 15eb762..4adcab4 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp @@ -69,78 +69,78 @@ void BatteryMeter::mousePressEvent( QMouseEvent* e ) } QWidget::mousePressEvent( e ); } void BatteryMeter::mouseReleaseEvent( QMouseEvent* e) { if ( batteryView && batteryView->isVisible() ) { delete (QWidget *) batteryView; } else { if ( !batteryView ) batteryView = new BatteryStatus( ps ); batteryView->showMaximized(); batteryView->raise(); batteryView->show(); } } void BatteryMeter::timerEvent( QTimerEvent * ) { PowerStatus prev = *ps; *ps = PowerStatusManager::readStatus(); if ( prev != *ps ) { percent = ps->batteryPercentRemaining(); - if ( !charging && ps->batteryStatus() == PowerStatus::Charging && percent < 0 ) { + if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) { percent = 0; charging = true; chargeTimer->start( 500 ); } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) { charging = false; chargeTimer->stop(); if ( batteryView ) batteryView->updatePercent( percent ); } repaint( style != 0 ); if ( batteryView ) batteryView->repaint(); } } void BatteryMeter::chargeTimeout() { percent += 20; if ( percent > 100 ) percent = 0; repaint(FALSE); if ( batteryView ) batteryView->updatePercent( percent ); } void BatteryMeter::paintEvent( QPaintEvent* ) { - qWarning("paint"); + if ( style == 1 ) { QPainter p(this); QFont f( "Fixed", AppLnk::smallIconSize()/2 ); QFontMetrics fm( f ); p.setFont( f ); p.drawText( 0, height()/2, QString::number( percent ) ); p.drawText( width()/4, height(), "%" ); return; } QPainter p(this); QColor color; QColor g = gray.light( 160 ); switch ( ps->acStatus() ) { case PowerStatus::Offline: color = blue.light( 150 ); break; case PowerStatus::Online: color = green.dark( 130 ).light( 180 ); break; default: color = red.light( 160 ); } int w = height() / 2; if ( !(w%2) ) w--; // should have an odd value to get a real middle line int h = height() - 4; |