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/batteryapplet/battery.cpp | |
parent | a7e015198a8c5ad3b6e144a9032b059086253e00 (diff) | |
download | opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.zip opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.gz opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'core/applets/batteryapplet/battery.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 14 |
1 files changed, 2 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 | |||
@@ -113,36 +113,26 @@ void BatteryMeter::chargeTimeout() | |||
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 ) { | 125 | p.drawText( 0, AppLnk::smallIconSize()/2, QString::number( percent ) ); |
126 | p.drawText( 0, 0, width(), height(), Qt::AlignCenter, tr( "F" ) ); | 126 | p.drawText( AppLnk::smallIconSize()/4, AppLnk::smallIconSize(), "%" ); |
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 ) ); | ||
135 | 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 | } |