-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 078ce8d..480d261 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp @@ -109,34 +109,44 @@ void BatteryMeter::chargeTimeout() if ( percent > 100 ) percent = 0; repaint(FALSE); if ( batteryView ) batteryView->updatePercent( percent ); } void BatteryMeter::paintEvent( QPaintEvent* ) { if ( style == 1 ) { QPainter p(this); QFont f( "Fixed", AppLnk::smallIconSize()/2 ); QFontMetrics fm( f ); p.setFont( f ); - p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); - p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); + if ( percent > 98 ) { + p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "F" ) ); + } + else if ( percent < 5 ) + { + p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "E" ) ); + } + else + { + p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); + p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); + } 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; |