summaryrefslogtreecommitdiff
path: root/noncore/applets/memoryapplet/memorymeter.cpp
Unidiff
Diffstat (limited to 'noncore/applets/memoryapplet/memorymeter.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/memoryapplet/memorymeter.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/noncore/applets/memoryapplet/memorymeter.cpp b/noncore/applets/memoryapplet/memorymeter.cpp
index 54b5c52..9299f49 100644
--- a/noncore/applets/memoryapplet/memorymeter.cpp
+++ b/noncore/applets/memoryapplet/memorymeter.cpp
@@ -11,30 +11,28 @@
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#include "memorymeter.h" 20#include "memorymeter.h"
21#include "memorystatus.h" 21#include "memorystatus.h"
22 22
23#include <opie2/otaskbarapplet.h>
23#include <qtopia/power.h> 24#include <qtopia/power.h>
24#include <qtopia/config.h> 25#include <qtopia/config.h>
25
26#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
27#include <qtopia/qcopenvelope_qws.h> 26#include <qtopia/qcopenvelope_qws.h>
28#endif
29 27
30#include <qpainter.h> 28#include <qpainter.h>
31#include <qtimer.h> 29#include <qtimer.h>
32#include <qapplication.h> 30#include <qapplication.h>
33 31
34#include <qtopia/applnk.h> 32#include <qtopia/applnk.h>
35 33
36MemoryMeter::MemoryMeter( QWidget *parent ) 34MemoryMeter::MemoryMeter( QWidget *parent )
37 : QWidget( parent ), memoryView(0) 35 : QWidget( parent ), memoryView(0)
38{ 36{
39 bvsz = QSize(); 37 bvsz = QSize();
40 if ( qApp->desktop()->height() >= 300 ) 38 if ( qApp->desktop()->height() >= 300 )
@@ -57,24 +55,29 @@ MemoryMeter::MemoryMeter( QWidget *parent )
57 setFixedWidth(10); 55 setFixedWidth(10);
58 setFixedHeight(AppLnk::smallIconSize()); 56 setFixedHeight(AppLnk::smallIconSize());
59 usageTimer = new QTimer( this ); 57 usageTimer = new QTimer( this );
60 connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) ); 58 connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) );
61 timerEvent(0); 59 timerEvent(0);
62} 60}
63 61
64MemoryMeter::~MemoryMeter() 62MemoryMeter::~MemoryMeter()
65{ 63{
66 delete (QWidget *) memoryView; 64 delete (QWidget *) memoryView;
67} 65}
68 66
67int MemoryMeter::position()
68{
69 return 7;
70}
71
69QSize MemoryMeter::sizeHint() const 72QSize MemoryMeter::sizeHint() const
70{ 73{
71 return QSize(10, AppLnk::smallIconSize()); 74 return QSize(10, AppLnk::smallIconSize());
72} 75}
73 76
74bool MemoryMeter::updateMemoryViewGeometry() 77bool MemoryMeter::updateMemoryViewGeometry()
75{ 78{
76 if (memoryView != 0) 79 if (memoryView != 0)
77 { 80 {
78 QSize sz = memoryView->sizeHint(); 81 QSize sz = memoryView->sizeHint();
79 if ( sz != bvsz ) 82 if ( sz != bvsz )
80 { 83 {
@@ -228,12 +231,17 @@ void MemoryMeter::paintEvent( QPaintEvent* )
228 p.setBrush(c); 231 p.setBrush(c);
229 p.drawRect(batt_xoffset, unused_offset, band_width, unused_height); 232 p.drawRect(batt_xoffset, unused_offset, band_width, unused_height);
230 p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height); 233 p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height);
231 234
232 p.setBrush(lightc); 235 p.setBrush(lightc);
233 p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height); 236 p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height);
234 237
235 p.setBrush(darkc); 238 p.setBrush(darkc);
236 p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height); 239 p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height);
237 } 240 }
238} 241}
239 242
243Q_EXPORT_INTERFACE()
244{
245 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> );
246}
247