author | mickeyl <mickeyl> | 2004-03-01 21:10:13 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-01 21:10:13 (UTC) |
commit | 77af6f58d59011e123309c82b684695508a46787 (patch) (unidiff) | |
tree | 1eeb3b323bc14581af7da9fe5b58c4c611b00575 /noncore/applets/autorotateapplet | |
parent | 7b0bdb05e4ae29b2643d73e3b8f20a86a86dcccc (diff) | |
download | opie-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.cpp | 11 | ||||
-rw-r--r-- | noncore/applets/autorotateapplet/autorotate.h | 3 | ||||
-rw-r--r-- | noncore/applets/autorotateapplet/autorotateapplet.pro | 16 | ||||
-rw-r--r-- | noncore/applets/autorotateapplet/autorotateimpl.cpp | 42 | ||||
-rw-r--r-- | noncore/applets/autorotateapplet/autorotateimpl.h | 18 |
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 @@ | |||
14 | 14 | ||
15 | /* OPIE */ | 15 | /* OPIE */ |
16 | #include <opie2/odevice.h> | 16 | #include <opie2/odevice.h> |
17 | #include <opie2/otaskbarapplet.h> | ||
17 | #include <qpe/applnk.h> | 18 | #include <qpe/applnk.h> |
18 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
19 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
@@ -43,6 +44,11 @@ AutoRotate::~AutoRotate() | |||
43 | } | 44 | } |
44 | } | 45 | } |
45 | 46 | ||
47 | int AutoRotate::position() | ||
48 | { | ||
49 | return 7; | ||
50 | } | ||
51 | |||
46 | void AutoRotate::mousePressEvent(QMouseEvent *) | 52 | void AutoRotate::mousePressEvent(QMouseEvent *) |
47 | { | 53 | { |
48 | QPopupMenu *menu = new QPopupMenu(this); | 54 | QPopupMenu *menu = new QPopupMenu(this); |
@@ -88,3 +94,8 @@ bool AutoRotate::isRotateEnabled() | |||
88 | return res; | 94 | return res; |
89 | } | 95 | } |
90 | 96 | ||
97 | Q_EXPORT_INTERFACE() | ||
98 | { | ||
99 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> ); | ||
100 | } | ||
101 | |||
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 { | |||
22 | public: | 22 | public: |
23 | AutoRotate( QWidget *parent = 0 ); | 23 | AutoRotate( QWidget *parent = 0 ); |
24 | ~AutoRotate(); | 24 | ~AutoRotate(); |
25 | 25 | static int position(); | |
26 | private slots: | ||
27 | 26 | ||
28 | protected: | 27 | protected: |
29 | void paintEvent( QPaintEvent* ); | 28 | 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 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = autorotate.h autorotateimpl.h | 3 | HEADERS = autorotate.h |
4 | SOURCES = autorotate.cpp autorotateimpl.cpp | 4 | SOURCES = autorotate.cpp |
5 | TARGET = autorotateapplet | 5 | TARGET = autorotateapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include ../launcher | 8 | DEPENDPATH += $(OPIEDIR)/include ../launcher |
9 | LIBS += -lqpe -lopiecore2 | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | 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 @@ | |||
1 | #include "autorotate.h" | ||
2 | #include "autorotateimpl.h" | ||
3 | |||
4 | |||
5 | AutoRotateImpl::AutoRotateImpl() | ||
6 | : autoRotate(0){ | ||
7 | qDebug ("here"); | ||
8 | } | ||
9 | |||
10 | AutoRotateImpl::~AutoRotateImpl() { | ||
11 | delete autoRotate; | ||
12 | } | ||
13 | |||
14 | QWidget *AutoRotateImpl::applet( QWidget *parent ) { | ||
15 | if ( !autoRotate ) { | ||
16 | autoRotate = new AutoRotate( parent ); | ||
17 | } | ||
18 | return autoRotate; | ||
19 | } | ||
20 | |||
21 | int AutoRotateImpl::position() const { | ||
22 | return 7; | ||
23 | } | ||
24 | |||
25 | QRESULT AutoRotateImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | ||
26 | *iface = 0; | ||
27 | if ( uuid == IID_QUnknown ) { | ||
28 | *iface = this; | ||
29 | } else if ( uuid == IID_TaskbarApplet ) { | ||
30 | *iface = this; | ||
31 | } else | ||
32 | return QS_FALSE; | ||
33 | |||
34 | if ( *iface ) { | ||
35 | (*iface)->addRef(); | ||
36 | } | ||
37 | return QS_OK; | ||
38 | } | ||
39 | |||
40 | Q_EXPORT_INTERFACE() { | ||
41 | Q_CREATE_INSTANCE( AutoRotateImpl ) | ||
42 | } | ||
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 @@ | |||
1 | #include <qpe/taskbarappletinterface.h> | ||
2 | |||
3 | class AutoRotate; | ||
4 | |||
5 | class AutoRotateImpl : public TaskbarAppletInterface { | ||
6 | public: | ||
7 | AutoRotateImpl(); | ||
8 | virtual ~AutoRotateImpl(); | ||
9 | |||
10 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
11 | Q_REFCOUNT | ||
12 | |||
13 | virtual QWidget *applet( QWidget *parent ); | ||
14 | virtual int position() const; | ||
15 | |||
16 | private: | ||
17 | AutoRotate *autoRotate; | ||
18 | }; | ||