summaryrefslogtreecommitdiff
path: root/noncore/applets/autorotateapplet
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/autorotateapplet
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/autorotateapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/autorotateapplet/autorotate.cpp11
-rw-r--r--noncore/applets/autorotateapplet/autorotate.h3
-rw-r--r--noncore/applets/autorotateapplet/autorotateapplet.pro16
-rw-r--r--noncore/applets/autorotateapplet/autorotateimpl.cpp42
-rw-r--r--noncore/applets/autorotateapplet/autorotateimpl.h18
5 files changed, 20 insertions, 70 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp
index 5152904..94be0ae 100644
--- a/noncore/applets/autorotateapplet/autorotate.cpp
+++ b/noncore/applets/autorotateapplet/autorotate.cpp
@@ -14,6 +14,7 @@
/* OPIE */
#include <opie2/odevice.h>
+#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/resource.h>
@@ -43,6 +44,11 @@ AutoRotate::~AutoRotate()
}
}
+int AutoRotate::position()
+{
+ return 7;
+}
+
void AutoRotate::mousePressEvent(QMouseEvent *)
{
QPopupMenu *menu = new QPopupMenu(this);
@@ -88,3 +94,8 @@ bool AutoRotate::isRotateEnabled()
return res;
}
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> );
+}
+
diff --git a/noncore/applets/autorotateapplet/autorotate.h b/noncore/applets/autorotateapplet/autorotate.h
index e05e7a0..ef322a6 100644
--- a/noncore/applets/autorotateapplet/autorotate.h
+++ b/noncore/applets/autorotateapplet/autorotate.h
@@ -22,8 +22,7 @@ class AutoRotate : public QWidget {
public:
AutoRotate( QWidget *parent = 0 );
~AutoRotate();
-
-private slots:
+ static int position();
protected:
void paintEvent( QPaintEvent* );
diff --git a/noncore/applets/autorotateapplet/autorotateapplet.pro b/noncore/applets/autorotateapplet/autorotateapplet.pro
index 0ccbeba..465b165 100644
--- a/noncore/applets/autorotateapplet/autorotateapplet.pro
+++ b/noncore/applets/autorotateapplet/autorotateapplet.pro
@@ -1,13 +1,13 @@
-TEMPLATE = lib
+TEMPLATE = lib
CONFIG += qt plugin warn_on release
-HEADERS = autorotate.h autorotateimpl.h
-SOURCES = autorotate.cpp autorotateimpl.cpp
+HEADERS = autorotate.h
+SOURCES = autorotate.cpp
TARGET = autorotateapplet
-DESTDIR = $(OPIEDIR)/plugins/applets
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include ../launcher
-LIBS += -lqpe -lopiecore2
-VERSION = 1.0.0
+DESTDIR = $(OPIEDIR)/plugins/applets
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include ../launcher
+LIBS += -lqpe -lopiecore2
+VERSION = 1.0.0
include ( $(OPIEDIR)/include.pro )
target.path = $$prefix/plugins/applets
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.cpp b/noncore/applets/autorotateapplet/autorotateimpl.cpp
deleted file mode 100644
index 305ac50..0000000
--- a/noncore/applets/autorotateapplet/autorotateimpl.cpp
+++ b/dev/null
@@ -1,42 +0,0 @@
-#include "autorotate.h"
-#include "autorotateimpl.h"
-
-
-AutoRotateImpl::AutoRotateImpl()
- : autoRotate(0){
- qDebug ("here");
-}
-
-AutoRotateImpl::~AutoRotateImpl() {
- delete autoRotate;
-}
-
-QWidget *AutoRotateImpl::applet( QWidget *parent ) {
- if ( !autoRotate ) {
- autoRotate = new AutoRotate( parent );
- }
- return autoRotate;
-}
-
-int AutoRotateImpl::position() const {
- return 7;
-}
-
-QRESULT AutoRotateImpl::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;
-
- if ( *iface ) {
- (*iface)->addRef();
- }
- return QS_OK;
-}
-
-Q_EXPORT_INTERFACE() {
- Q_CREATE_INSTANCE( AutoRotateImpl )
-}
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.h b/noncore/applets/autorotateapplet/autorotateimpl.h
deleted file mode 100644
index fde23a9..0000000
--- a/noncore/applets/autorotateapplet/autorotateimpl.h
+++ b/dev/null
@@ -1,18 +0,0 @@
-#include <qpe/taskbarappletinterface.h>
-
-class AutoRotate;
-
-class AutoRotateImpl : public TaskbarAppletInterface {
-public:
- AutoRotateImpl();
- virtual ~AutoRotateImpl();
-
- QRESULT queryInterface( const QUuid&, QUnknownInterface** );
- Q_REFCOUNT
-
- virtual QWidget *applet( QWidget *parent );
- virtual int position() const;
-
-private:
- AutoRotate *autoRotate;
-};