summaryrefslogtreecommitdiff
path: root/noncore/applets/memoryapplet
Side-by-side diff
Diffstat (limited to 'noncore/applets/memoryapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/memoryapplet/memorymeter.cpp26
-rw-r--r--noncore/applets/memoryapplet/memorystatus.cpp1
-rw-r--r--noncore/applets/memoryapplet/memorystatus.h4
3 files changed, 15 insertions, 16 deletions
diff --git a/noncore/applets/memoryapplet/memorymeter.cpp b/noncore/applets/memoryapplet/memorymeter.cpp
index 9299f49..9cdeaf4 100644
--- a/noncore/applets/memoryapplet/memorymeter.cpp
+++ b/noncore/applets/memoryapplet/memorymeter.cpp
@@ -28,22 +28,23 @@
#include <qpainter.h>
#include <qtimer.h>
#include <qapplication.h>
#include <qtopia/applnk.h>
+using namespace Opie::Ui;
MemoryMeter::MemoryMeter( QWidget *parent )
: QWidget( parent ), memoryView(0)
{
bvsz = QSize();
- if ( qApp->desktop()->height() >= 300 )
+ if ( qApp->desktop()->height() >= 300 )
{
memoryView = new MemoryStatus( 0, WStyle_StaysOnTop | WType_Popup );
memoryView->setFrameStyle( QFrame::Panel | QFrame::Raised );
- }
- else
+ }
+ else
{
memoryView = new MemoryStatus( 0 );
memoryView->showMaximized();
}
Config config("MemoryPlugin");
@@ -76,17 +77,17 @@ QSize MemoryMeter::sizeHint() const
bool MemoryMeter::updateMemoryViewGeometry()
{
if (memoryView != 0)
{
QSize sz = memoryView->sizeHint();
- if ( sz != bvsz )
+ if ( sz != bvsz )
{
bvsz = sz;
QRect r(memoryView->pos(), memoryView->sizeHint());
- if ( qApp->desktop()->height() >= 300 )
+ if ( qApp->desktop()->height() >= 300 )
{
QPoint curPos = mapToGlobal( rect().topLeft() );
int lp = qApp->desktop()->width() - memoryView->sizeHint().width();
r.moveTopLeft( QPoint(lp, curPos.y() - memoryView->sizeHint().height()-1) );
}
memoryView->setGeometry(r);
@@ -97,17 +98,17 @@ bool MemoryMeter::updateMemoryViewGeometry()
return FALSE;
}
void MemoryMeter::mousePressEvent( QMouseEvent *)
{
- if ( memoryView->isVisible() )
+ if ( memoryView->isVisible() )
{
memoryView->hide();
- }
- else
+ }
+ else
{
bvsz = QSize();
updateMemoryViewGeometry();
memoryView->raise();
memoryView->show();
}
@@ -203,13 +204,13 @@ void MemoryMeter::paintEvent( QPaintEvent* )
if (used_height < 0)
used_height = 0;
//
// Drained section.
//
- if (used_height != 0)
+ if (used_height != 0)
{
p.setPen(NoPen);
p.setBrush(gray);
p.drawRect(batt_xoffset, batt_yoffset, band_width, used_height);
p.drawRect(batt_xoffset + 2 * band_width, batt_yoffset, band_width, used_height);
@@ -220,13 +221,13 @@ void MemoryMeter::paintEvent( QPaintEvent* )
p.drawRect(batt_xoffset + 3 * band_width, batt_yoffset, band_width, used_height);
}
//
// Unused section.
//
- if ( batt_height - used_height > 0 )
+ if ( batt_height - used_height > 0 )
{
int unused_offset = used_height + batt_yoffset;
int unused_height = batt_height - used_height;
p.setPen(NoPen);
p.setBrush(c);
p.drawRect(batt_xoffset, unused_offset, band_width, unused_height);
@@ -237,11 +238,8 @@ void MemoryMeter::paintEvent( QPaintEvent* )
p.setBrush(darkc);
p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height);
}
}
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> );
-}
+EXPORT_OPIE_APPLET_v1( MemoryMeter )
diff --git a/noncore/applets/memoryapplet/memorystatus.cpp b/noncore/applets/memoryapplet/memorystatus.cpp
index c01ba28..95ae06b 100644
--- a/noncore/applets/memoryapplet/memorystatus.cpp
+++ b/noncore/applets/memoryapplet/memorystatus.cpp
@@ -25,12 +25,13 @@
#include <qpushbutton.h>
#include <qdrawutil.h>
#include <qlabel.h>
#include <qlayout.h>
+using namespace Opie::Ui;
MemoryStatus::MemoryStatus(QWidget *parent, WFlags f )
: QFrame(parent, 0, f), mi(0), sf(0)
{
setCaption( tr("Memory Status") );
//resize( 220, 180 );
diff --git a/noncore/applets/memoryapplet/memorystatus.h b/noncore/applets/memoryapplet/memorystatus.h
index c3926db..d16787b 100644
--- a/noncore/applets/memoryapplet/memorystatus.h
+++ b/noncore/applets/memoryapplet/memorystatus.h
@@ -23,13 +23,13 @@
#include <qframe.h>
#include <opie2/otabwidget.h>
class MemoryInfo;
class Swapfile;
-using Opie::OTabWidget;
+
class MemoryStatus : public QFrame
{
Q_OBJECT
public:
MemoryStatus(QWidget *parent = 0, WFlags f = 0);
@@ -39,11 +39,11 @@ public:
MemoryInfo* mi;
Swapfile* sf;
int percent();
private:
- OTabWidget *tab;
+ Opie::Ui::OTabWidget *tab;
};
#endif