summaryrefslogtreecommitdiff
path: root/core/applets
authorkergoth <kergoth>2003-08-09 17:29:36 (UTC)
committer kergoth <kergoth>2003-08-09 17:29:36 (UTC)
commita0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93 (patch) (unidiff)
tree5ce78e1a5dedd31b7851d53bf9f072bd44edd1b0 /core/applets
parenta7e015198a8c5ad3b6e144a9032b059086253e00 (diff)
downloadopie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.zip
opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.gz
opie-a0bab0e281fbaf6f6ebbb1a48e5c06426bfbbb93.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'core/applets') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp14
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp2
-rw-r--r--core/applets/cardmon/cardmon.cpp4
-rw-r--r--core/applets/homeapplet/home.h4
-rw-r--r--core/applets/restartapplet2/.cvsignore1
-rw-r--r--core/applets/suspendapplet/suspend.h4
6 files changed, 11 insertions, 18 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
106void BatteryMeter::chargeTimeout() 106void 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
117void BatteryMeter::paintEvent( QPaintEvent* ) 117void 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 }
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
290bool CardMonitor::getStatusSd(int showPopUp) 292bool 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
337void CardMonitor::paintEvent(QPaintEvent *) 341void 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
@@ -11,39 +11,39 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef __OPIE_HOME_APPLET_H__ 20#ifndef __OPIE_HOME_APPLET_H__
21#define __OPIE_HOME_APPLET_H__ 21#define __OPIE_HOME_APPLET_H__
22 22
23#include <qpe/menuappletinterface.h> 23#include <qpe/menuappletinterface.h>
24 24
25class HomeApplet : public QObject, public MenuAppletInterface 25class HomeApplet : public QObject, public MenuAppletInterface
26{ 26{
27public: 27public:
28 HomeApplet ( ); 28 HomeApplet ( );
29 virtual ~HomeApplet ( ); 29 virtual ~HomeApplet ( );
30 30
31 QRESULT queryInterface( const QUuid&, QUnknownInterface** ); 31 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
32 Q_REFCOUNT 32 Q_REFCOUNT
33 33
34 virtual int position() const; 34 virtual int position() const;
35 35
36 virtual QString name ( ) const; 36 virtual QString name ( ) const;
37 virtual QIconSet icon ( ) const; 37 virtual QIconSet icon ( ) const;
38 virtual QString text ( ) const; 38 virtual QString text ( ) const;
39 virtual QString tr( const char* ) const; 39 virtual QString tr( const char* ) const;
40 virtual QString tr( const char*, const char* ) const; 40 virtual QString tr( const char*, const char* ) const;
41 virtual QPopupMenu *popup ( QWidget *parent ) const; 41 virtual QPopupMenu *popup ( QWidget *parent ) const;
42 42
43 virtual void activated ( ); 43 virtual void activated ( );
44 44
45private: 45private:
46 ulong ref; 46 ulong ref;
47}; 47};
48 48
49#endif 49#endif
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*.~
3Makefile* 3Makefile*
4config.in 4config.in
5moc_* 5moc_*
6opieobjconfig.in 6opieobjconfig.in
7opieobj
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
@@ -11,39 +11,39 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef __OPIE_SUSPEND_APPLET_H__ 20#ifndef __OPIE_SUSPEND_APPLET_H__
21#define __OPIE_SUSPEND_APPLET_H__ 21#define __OPIE_SUSPEND_APPLET_H__
22 22
23#include <qpe/menuappletinterface.h> 23#include <qpe/menuappletinterface.h>
24 24
25class SuspendApplet : public QObject, public MenuAppletInterface 25class SuspendApplet : public QObject, public MenuAppletInterface
26{ 26{
27public: 27public:
28 SuspendApplet ( ); 28 SuspendApplet ( );
29 virtual ~SuspendApplet ( ); 29 virtual ~SuspendApplet ( );
30 30
31 QRESULT queryInterface( const QUuid&, QUnknownInterface** ); 31 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
32 Q_REFCOUNT 32 Q_REFCOUNT
33 33
34 virtual int position() const; 34 virtual int position() const;
35 35
36 virtual QString name ( ) const; 36 virtual QString name ( ) const;
37 virtual QIconSet icon ( ) const; 37 virtual QIconSet icon ( ) const;
38 virtual QString text ( ) const; 38 virtual QString text ( ) const;
39 virtual QString tr( const char* ) const; 39 virtual QString tr( const char* ) const;
40 virtual QString tr( const char*, const char* ) const; 40 virtual QString tr( const char*, const char* ) const;
41 virtual QPopupMenu *popup ( QWidget *parent ) const; 41 virtual QPopupMenu *popup ( QWidget *parent ) const;
42 42
43 virtual void activated ( ); 43 virtual void activated ( );
44 44
45private: 45private:
46 ulong ref; 46 ulong ref;
47}; 47};
48 48
49#endif 49#endif