summaryrefslogtreecommitdiff
path: root/noncore/applets/memoryapplet
authormickeyl <mickeyl>2004-03-01 21:10:13 (UTC)
committer mickeyl <mickeyl>2004-03-01 21:10:13 (UTC)
commit77af6f58d59011e123309c82b684695508a46787 (patch) (side-by-side diff)
tree1eeb3b323bc14581af7da9fe5b58c4c611b00575 /noncore/applets/memoryapplet
parent7b0bdb05e4ae29b2643d73e3b8f20a86a86dcccc (diff)
downloadopie-77af6f58d59011e123309c82b684695508a46787.zip
opie-77af6f58d59011e123309c82b684695508a46787.tar.gz
opie-77af6f58d59011e123309c82b684695508a46787.tar.bz2
remove boiler plate code in favour of a template
Diffstat (limited to 'noncore/applets/memoryapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/memoryapplet/memoryapplet.pro4
-rw-r--r--noncore/applets/memoryapplet/memoryappletimpl.cpp65
-rw-r--r--noncore/applets/memoryapplet/memoryappletimpl.h43
-rw-r--r--noncore/applets/memoryapplet/memorymeter.cpp14
-rw-r--r--noncore/applets/memoryapplet/memorymeter.h1
5 files changed, 13 insertions, 114 deletions
diff --git a/noncore/applets/memoryapplet/memoryapplet.pro b/noncore/applets/memoryapplet/memoryapplet.pro
index 6031386..3cd7839 100644
--- a/noncore/applets/memoryapplet/memoryapplet.pro
+++ b/noncore/applets/memoryapplet/memoryapplet.pro
@@ -3,14 +3,12 @@ CONFIG += qt plugin warn_on release
HEADERS = ../../settings/sysinfo/graph.h \
../../settings/sysinfo/load.h \
../../settings/sysinfo/memory.h \
- memoryappletimpl.h \
memorymeter.h \
memorystatus.h \
swapfile.h
SOURCES = ../../settings/sysinfo/graph.cpp \
../../settings/sysinfo/load.cpp \
../../settings/sysinfo/memory.cpp \
- memoryappletimpl.cpp \
memorymeter.cpp \
memorystatus.cpp \
swapfile.cpp
@@ -19,6 +17,6 @@ DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += ../$(OPIEDIR)/include
VERSION = 1.0.0
-LIBS += -lqpe -lopieui2
+LIBS += -lqpe -lopiecore2 -lopieui2
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/memoryapplet/memoryappletimpl.cpp b/noncore/applets/memoryapplet/memoryappletimpl.cpp
deleted file mode 100644
index a117e7f..0000000
--- a/noncore/applets/memoryapplet/memoryappletimpl.cpp
+++ b/dev/null
@@ -1,65 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-#include "memorymeter.h"
-#include "memoryappletimpl.h"
-
-MemoryAppletImpl::MemoryAppletImpl()
- : memory(0)
-{
-}
-
-MemoryAppletImpl::~MemoryAppletImpl()
-{
- delete memory;
-}
-
-QWidget *MemoryAppletImpl::applet( QWidget *parent )
-{
- if ( !memory )
- memory = new MemoryMeter( parent );
-
- return memory;
-}
-
-int MemoryAppletImpl::position() const
-{
- return 8;
-}
-
-QRESULT MemoryAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
-{
- *iface = 0;
- if ( uuid == IID_QUnknown )
- *iface = this;
- else if ( uuid == IID_TaskbarApplet )
- *iface = this;
- else
- return QS_FALSE;
-
- (*iface)->addRef();
-
- return QS_OK;
-}
-
-Q_EXPORT_INTERFACE()
-{
- Q_CREATE_INSTANCE( MemoryAppletImpl )
-}
-
diff --git a/noncore/applets/memoryapplet/memoryappletimpl.h b/noncore/applets/memoryapplet/memoryappletimpl.h
deleted file mode 100644
index 2db7dbe..0000000
--- a/noncore/applets/memoryapplet/memoryappletimpl.h
+++ b/dev/null
@@ -1,43 +0,0 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
-#ifndef MEMORYAPPLETIMPL_H
-#define MEMORYAPPLETIMPL_H
-
-#include <qtopia/taskbarappletinterface.h>
-
-class MemoryMeter;
-
-class /*QTOPIA_PLUGIN_EXPORT*/ MemoryAppletImpl : public TaskbarAppletInterface
-{
-public:
- MemoryAppletImpl();
- virtual ~MemoryAppletImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
- Q_REFCOUNT
-
- virtual QWidget *applet( QWidget *parent );
- virtual int position() const;
-
-private:
- MemoryMeter *memory;
-};
-
-#endif
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
@@ -20,12 +20,10 @@
#include "memorymeter.h"
#include "memorystatus.h"
+#include <opie2/otaskbarapplet.h>
#include <qtopia/power.h>
#include <qtopia/config.h>
-
-#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qtopia/qcopenvelope_qws.h>
-#endif
#include <qpainter.h>
#include <qtimer.h>
@@ -66,6 +64,11 @@ MemoryMeter::~MemoryMeter()
delete (QWidget *) memoryView;
}
+int MemoryMeter::position()
+{
+ return 7;
+}
+
QSize MemoryMeter::sizeHint() const
{
return QSize(10, AppLnk::smallIconSize());
@@ -237,3 +240,8 @@ void MemoryMeter::paintEvent( QPaintEvent* )
}
}
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> );
+}
+
diff --git a/noncore/applets/memoryapplet/memorymeter.h b/noncore/applets/memoryapplet/memorymeter.h
index 0f3cb0b..ed541f0 100644
--- a/noncore/applets/memoryapplet/memorymeter.h
+++ b/noncore/applets/memoryapplet/memorymeter.h
@@ -31,6 +31,7 @@ class MemoryMeter : public QWidget
public:
MemoryMeter( QWidget *parent = 0 );
~MemoryMeter();
+ static int position();
QSize sizeHint() const;
MemoryStatus* memoryView;