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 | |
parent | 7b0bdb05e4ae29b2643d73e3b8f20a86a86dcccc (diff) | |
download | opie-77af6f58d59011e123309c82b684695508a46787.zip opie-77af6f58d59011e123309c82b684695508a46787.tar.gz opie-77af6f58d59011e123309c82b684695508a46787.tar.bz2 |
remove boiler plate code in favour of a template
21 files changed, 67 insertions, 354 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 | |||
@@ -11,12 +11,13 @@ | |||
11 | *************************************************************************/ | 11 | *************************************************************************/ |
12 | 12 | ||
13 | #include "autorotate.h" | 13 | #include "autorotate.h" |
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> |
20 | 21 | ||
21 | /* QT */ | 22 | /* QT */ |
22 | #include <qpainter.h> | 23 | #include <qpainter.h> |
@@ -40,12 +41,17 @@ AutoRotate::~AutoRotate() | |||
40 | { | 41 | { |
41 | if (popupMenu) { | 42 | if (popupMenu) { |
42 | delete popupMenu; | 43 | delete popupMenu; |
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); |
49 | menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); | 55 | menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); |
50 | 56 | ||
51 | QPoint p = mapToGlobal(QPoint(0, 0)); | 57 | QPoint p = mapToGlobal(QPoint(0, 0)); |
@@ -85,6 +91,11 @@ bool AutoRotate::isRotateEnabled() | |||
85 | qDebug("Enabled"); | 91 | qDebug("Enabled"); |
86 | else | 92 | else |
87 | qDebug("Disabled"); | 93 | qDebug("Disabled"); |
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 | |||
@@ -19,14 +19,13 @@ | |||
19 | 19 | ||
20 | class AutoRotate : public QWidget { | 20 | class AutoRotate : public QWidget { |
21 | Q_OBJECT | 21 | Q_OBJECT |
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* ); |
30 | void mousePressEvent( QMouseEvent * ); | 29 | void mousePressEvent( QMouseEvent * ); |
31 | private: | 30 | private: |
32 | bool isRotateEnabled(); | 31 | bool isRotateEnabled(); |
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 | }; | ||
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 | |||
@@ -1,24 +1,22 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = ../../settings/sysinfo/graph.h \ | 3 | HEADERS = ../../settings/sysinfo/graph.h \ |
4 | ../../settings/sysinfo/load.h \ | 4 | ../../settings/sysinfo/load.h \ |
5 | ../../settings/sysinfo/memory.h \ | 5 | ../../settings/sysinfo/memory.h \ |
6 | memoryappletimpl.h \ | ||
7 | memorymeter.h \ | 6 | memorymeter.h \ |
8 | memorystatus.h \ | 7 | memorystatus.h \ |
9 | swapfile.h | 8 | swapfile.h |
10 | SOURCES = ../../settings/sysinfo/graph.cpp \ | 9 | SOURCES = ../../settings/sysinfo/graph.cpp \ |
11 | ../../settings/sysinfo/load.cpp \ | 10 | ../../settings/sysinfo/load.cpp \ |
12 | ../../settings/sysinfo/memory.cpp \ | 11 | ../../settings/sysinfo/memory.cpp \ |
13 | memoryappletimpl.cpp \ | ||
14 | memorymeter.cpp \ | 12 | memorymeter.cpp \ |
15 | memorystatus.cpp \ | 13 | memorystatus.cpp \ |
16 | swapfile.cpp | 14 | swapfile.cpp |
17 | TARGET = memoryapplet | 15 | TARGET = memoryapplet |
18 | DESTDIR = $(OPIEDIR)/plugins/applets | 16 | DESTDIR = $(OPIEDIR)/plugins/applets |
19 | INCLUDEPATH += $(OPIEDIR)/include | 17 | INCLUDEPATH += $(OPIEDIR)/include |
20 | DEPENDPATH += ../$(OPIEDIR)/include | 18 | DEPENDPATH += ../$(OPIEDIR)/include |
21 | VERSION = 1.0.0 | 19 | VERSION = 1.0.0 |
22 | LIBS += -lqpe -lopieui2 | 20 | LIBS += -lqpe -lopiecore2 -lopieui2 |
23 | 21 | ||
24 | include ( $(OPIEDIR)/include.pro ) | 22 | 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 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #include "memorymeter.h" | ||
21 | #include "memoryappletimpl.h" | ||
22 | |||
23 | MemoryAppletImpl::MemoryAppletImpl() | ||
24 | : memory(0) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | MemoryAppletImpl::~MemoryAppletImpl() | ||
29 | { | ||
30 | delete memory; | ||
31 | } | ||
32 | |||
33 | QWidget *MemoryAppletImpl::applet( QWidget *parent ) | ||
34 | { | ||
35 | if ( !memory ) | ||
36 | memory = new MemoryMeter( parent ); | ||
37 | |||
38 | return memory; | ||
39 | } | ||
40 | |||
41 | int MemoryAppletImpl::position() const | ||
42 | { | ||
43 | return 8; | ||
44 | } | ||
45 | |||
46 | QRESULT MemoryAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
47 | { | ||
48 | *iface = 0; | ||
49 | if ( uuid == IID_QUnknown ) | ||
50 | *iface = this; | ||
51 | else if ( uuid == IID_TaskbarApplet ) | ||
52 | *iface = this; | ||
53 | else | ||
54 | return QS_FALSE; | ||
55 | |||
56 | (*iface)->addRef(); | ||
57 | |||
58 | return QS_OK; | ||
59 | } | ||
60 | |||
61 | Q_EXPORT_INTERFACE() | ||
62 | { | ||
63 | Q_CREATE_INSTANCE( MemoryAppletImpl ) | ||
64 | } | ||
65 | |||
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 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef MEMORYAPPLETIMPL_H | ||
21 | #define MEMORYAPPLETIMPL_H | ||
22 | |||
23 | #include <qtopia/taskbarappletinterface.h> | ||
24 | |||
25 | class MemoryMeter; | ||
26 | |||
27 | class /*QTOPIA_PLUGIN_EXPORT*/ MemoryAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | MemoryAppletImpl(); | ||
31 | virtual ~MemoryAppletImpl(); | ||
32 | |||
33 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
34 | Q_REFCOUNT | ||
35 | |||
36 | virtual QWidget *applet( QWidget *parent ); | ||
37 | virtual int position() const; | ||
38 | |||
39 | private: | ||
40 | MemoryMeter *memory; | ||
41 | }; | ||
42 | |||
43 | #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 | |||
@@ -17,18 +17,16 @@ | |||
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> |
@@ -63,12 +61,17 @@ MemoryMeter::MemoryMeter( QWidget *parent ) | |||
63 | 61 | ||
64 | MemoryMeter::~MemoryMeter() | 62 | MemoryMeter::~MemoryMeter() |
65 | { | 63 | { |
66 | delete (QWidget *) memoryView; | 64 | delete (QWidget *) memoryView; |
67 | } | 65 | } |
68 | 66 | ||
67 | int MemoryMeter::position() | ||
68 | { | ||
69 | return 7; | ||
70 | } | ||
71 | |||
69 | QSize MemoryMeter::sizeHint() const | 72 | QSize MemoryMeter::sizeHint() const |
70 | { | 73 | { |
71 | return QSize(10, AppLnk::smallIconSize()); | 74 | return QSize(10, AppLnk::smallIconSize()); |
72 | } | 75 | } |
73 | 76 | ||
74 | bool MemoryMeter::updateMemoryViewGeometry() | 77 | bool MemoryMeter::updateMemoryViewGeometry() |
@@ -234,6 +237,11 @@ void MemoryMeter::paintEvent( QPaintEvent* ) | |||
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 | ||
243 | Q_EXPORT_INTERFACE() | ||
244 | { | ||
245 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> ); | ||
246 | } | ||
247 | |||
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 | |||
@@ -28,12 +28,13 @@ class QTimer; | |||
28 | class MemoryMeter : public QWidget | 28 | class MemoryMeter : public QWidget |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | MemoryMeter( QWidget *parent = 0 ); | 32 | MemoryMeter( QWidget *parent = 0 ); |
33 | ~MemoryMeter(); | 33 | ~MemoryMeter(); |
34 | static int position(); | ||
34 | 35 | ||
35 | QSize sizeHint() const; | 36 | QSize sizeHint() const; |
36 | MemoryStatus* memoryView; | 37 | MemoryStatus* memoryView; |
37 | 38 | ||
38 | protected: | 39 | protected: |
39 | void timerEvent( QTimerEvent * ); | 40 | void timerEvent( QTimerEvent * ); |
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 7b8bdd9..1142028 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -16,12 +16,13 @@ | |||
16 | #include "notes.h" | 16 | #include "notes.h" |
17 | 17 | ||
18 | #include <qapplication.h> | 18 | #include <qapplication.h> |
19 | #include <stdlib.h> | 19 | #include <stdlib.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | 21 | ||
22 | #include <opie2/otaskbarapplet.h> | ||
22 | #include <qpe/filemanager.h> | 23 | #include <qpe/filemanager.h> |
23 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/timestring.h> | 25 | #include <qpe/timestring.h> |
25 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
26 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
27 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
@@ -463,12 +464,17 @@ NotesApplet::NotesApplet( QWidget *parent, const char *name ) | |||
463 | } | 464 | } |
464 | 465 | ||
465 | NotesApplet::~NotesApplet() { | 466 | NotesApplet::~NotesApplet() { |
466 | delete vc; | 467 | delete vc; |
467 | } | 468 | } |
468 | 469 | ||
470 | int NotesApplet::position() | ||
471 | { | ||
472 | return 6; | ||
473 | } | ||
474 | |||
469 | void NotesApplet::mousePressEvent( QMouseEvent *) { | 475 | void NotesApplet::mousePressEvent( QMouseEvent *) { |
470 | if( !vc->isHidden()) { | 476 | if( !vc->isHidden()) { |
471 | vc->doPopulate=false; | 477 | vc->doPopulate=false; |
472 | vc->save(); | 478 | vc->save(); |
473 | vc->close(); | 479 | vc->close(); |
474 | } else { | 480 | } else { |
@@ -499,6 +505,10 @@ void NotesApplet::mousePressEvent( QMouseEvent *) { | |||
499 | 505 | ||
500 | void NotesApplet::paintEvent( QPaintEvent* ) { | 506 | void NotesApplet::paintEvent( QPaintEvent* ) { |
501 | QPainter p(this); | 507 | QPainter p(this); |
502 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); | 508 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); |
503 | } | 509 | } |
504 | 510 | ||
511 | Q_EXPORT_INTERFACE() | ||
512 | { | ||
513 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<NotesApplet> ); | ||
514 | } | ||
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h index 08253cb..ed1f98c 100644 --- a/noncore/applets/notesapplet/notes.h +++ b/noncore/applets/notesapplet/notes.h | |||
@@ -73,12 +73,13 @@ private slots: | |||
73 | 73 | ||
74 | class NotesApplet : public QWidget { | 74 | class NotesApplet : public QWidget { |
75 | Q_OBJECT | 75 | Q_OBJECT |
76 | public: | 76 | public: |
77 | NotesApplet( QWidget *parent = 0, const char *name=0 ); | 77 | NotesApplet( QWidget *parent = 0, const char *name=0 ); |
78 | ~NotesApplet(); | 78 | ~NotesApplet(); |
79 | static int position(); | ||
79 | NotesControl *vc; | 80 | NotesControl *vc; |
80 | public slots: | 81 | public slots: |
81 | private: | 82 | private: |
82 | void mousePressEvent( QMouseEvent * ); | 83 | void mousePressEvent( QMouseEvent * ); |
83 | void paintEvent( QPaintEvent* ); | 84 | void paintEvent( QPaintEvent* ); |
84 | 85 | ||
diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro index 3075948..38ba184 100644 --- a/noncore/applets/notesapplet/notesapplet.pro +++ b/noncore/applets/notesapplet/notesapplet.pro | |||
@@ -1,16 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = notes.h notesappletimpl.h | 3 | HEADERS = notes.h |
4 | SOURCES = notes.cpp notesappletimpl.cpp | 4 | SOURCES = notes.cpp |
5 | TARGET = notesapplet | 5 | TARGET = notesapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | MOC_DIR=opieobj | ||
12 | OBJECTS_DIR=opieobj | ||
13 | |||
14 | |||
15 | 11 | ||
16 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/applets/notesapplet/notesappletimpl.cpp b/noncore/applets/notesapplet/notesappletimpl.cpp deleted file mode 100644 index 8a9da7f..0000000 --- a/noncore/applets/notesapplet/notesappletimpl.cpp +++ b/dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | ||
3 | ** | ||
4 | ** | ||
5 | ** This file may be distributed and/or modified under the terms of the | ||
6 | ** GNU General Public License version 2 as published by the Free Software | ||
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
8 | ** packaging of this file. | ||
9 | ** | ||
10 | ** | ||
11 | **********************************************************************/ | ||
12 | #include "notes.h" | ||
13 | #include "notesappletimpl.h" | ||
14 | |||
15 | |||
16 | NotesAppletImpl::NotesAppletImpl() | ||
17 | : notes(0){ | ||
18 | } | ||
19 | |||
20 | NotesAppletImpl::~NotesAppletImpl() { | ||
21 | // not needed though cause we should have a valid parent | ||
22 | delete notes; | ||
23 | } | ||
24 | |||
25 | QWidget *NotesAppletImpl::applet( QWidget *parent ) { | ||
26 | if ( !notes ) | ||
27 | notes = new NotesApplet( parent ); | ||
28 | return notes; | ||
29 | } | ||
30 | |||
31 | int NotesAppletImpl::position() const { | ||
32 | return 6; | ||
33 | } | ||
34 | |||
35 | QRESULT NotesAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | ||
36 | *iface = 0; | ||
37 | if ( uuid == IID_QUnknown ) | ||
38 | *iface = this; | ||
39 | else if ( uuid == IID_TaskbarApplet ) | ||
40 | *iface = this; | ||
41 | else | ||
42 | return QS_FALSE; | ||
43 | |||
44 | if ( *iface ) | ||
45 | (*iface)->addRef(); | ||
46 | return QS_OK; | ||
47 | } | ||
48 | |||
49 | Q_EXPORT_INTERFACE() { | ||
50 | Q_CREATE_INSTANCE( NotesAppletImpl ) | ||
51 | } | ||
52 | |||
53 | |||
diff --git a/noncore/applets/notesapplet/notesappletimpl.h b/noncore/applets/notesapplet/notesappletimpl.h deleted file mode 100644 index a87118c..0000000 --- a/noncore/applets/notesapplet/notesappletimpl.h +++ b/dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | ||
3 | ** | ||
4 | ** | ||
5 | ** This file may be distributed and/or modified under the terms of the | ||
6 | ** GNU General Public License version 2 as published by the Free Software | ||
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
8 | ** packaging of this file. | ||
9 | ** | ||
10 | ** | ||
11 | **********************************************************************/ | ||
12 | #ifndef NOTESAPPLETIMPL_H | ||
13 | #define NOTESAPPLETIMPL_H | ||
14 | |||
15 | #include <qpe/taskbarappletinterface.h> | ||
16 | |||
17 | class NotesApplet; | ||
18 | |||
19 | class NotesAppletImpl : public TaskbarAppletInterface | ||
20 | { | ||
21 | public: | ||
22 | NotesAppletImpl(); | ||
23 | virtual ~NotesAppletImpl(); | ||
24 | |||
25 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
26 | Q_REFCOUNT | ||
27 | |||
28 | virtual QWidget *applet( QWidget *parent ); | ||
29 | virtual int position() const; | ||
30 | |||
31 | private: | ||
32 | NotesApplet *notes; | ||
33 | }; | ||
34 | |||
35 | #endif | ||
diff --git a/noncore/applets/zkbapplet/.cvsignore b/noncore/applets/zkbapplet/.cvsignore new file mode 100644 index 0000000..0f79c04 --- a/dev/null +++ b/noncore/applets/zkbapplet/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | advancedconfigbase.cpp | ||
3 | advancedconfigbase.h | ||
4 | moc_* | ||
5 | .moc | ||
6 | .obj | ||
diff --git a/noncore/applets/zkbapplet/zkbapplet.cpp b/noncore/applets/zkbapplet/zkbapplet.cpp deleted file mode 100644 index 6c71568..0000000 --- a/noncore/applets/zkbapplet/zkbapplet.cpp +++ b/dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <qlabel.h> | ||
3 | #include <qbutton.h> | ||
4 | #include <qwindowsystem_qws.h> | ||
5 | #include "zkbapplet.h" | ||
6 | #include "zkbwidget.h" | ||
7 | |||
8 | |||
9 | ZkbApplet::ZkbApplet() : app(0){ | ||
10 | } | ||
11 | |||
12 | ZkbApplet::~ZkbApplet() | ||
13 | { | ||
14 | if (app) delete app; | ||
15 | } | ||
16 | |||
17 | QWidget* ZkbApplet::applet(QWidget* parent) { | ||
18 | if (app == 0) { | ||
19 | app = new ZkbWidget(parent); | ||
20 | } | ||
21 | |||
22 | return app; | ||
23 | } | ||
24 | |||
25 | int ZkbApplet::position() const { | ||
26 | return 8; | ||
27 | } | ||
28 | |||
29 | QRESULT ZkbApplet::queryInterface(const QUuid& uuid, QUnknownInterface** iface) { | ||
30 | |||
31 | *iface = 0; | ||
32 | if (uuid == IID_QUnknown) { | ||
33 | *iface = this; | ||
34 | } else if (uuid == IID_TaskbarApplet) { | ||
35 | *iface = this; | ||
36 | } else { | ||
37 | return QS_FALSE; | ||
38 | } | ||
39 | |||
40 | if (*iface) { | ||
41 | (*iface)->addRef(); | ||
42 | } | ||
43 | |||
44 | return QS_OK; | ||
45 | } | ||
46 | |||
47 | Q_EXPORT_INTERFACE() { | ||
48 | Q_CREATE_INSTANCE(ZkbApplet) | ||
49 | } | ||
diff --git a/noncore/applets/zkbapplet/zkbapplet.h b/noncore/applets/zkbapplet/zkbapplet.h deleted file mode 100644 index fcf03b5..0000000 --- a/noncore/applets/zkbapplet/zkbapplet.h +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include "qpe/taskbarappletinterface.h" | ||
2 | |||
3 | #ifndef ZKBAPPLET_H | ||
4 | #define ZKBAPPLET_H | ||
5 | |||
6 | class ZkbWidget; | ||
7 | |||
8 | class ZkbApplet : public TaskbarAppletInterface { | ||
9 | public: | ||
10 | ZkbApplet(); | ||
11 | virtual ~ZkbApplet(); | ||
12 | |||
13 | QRESULT queryInterface(const QUuid&, QUnknownInterface**); | ||
14 | Q_REFCOUNT | ||
15 | |||
16 | virtual QWidget* applet(QWidget*); | ||
17 | virtual int position() const; | ||
18 | |||
19 | protected: | ||
20 | ZkbWidget* app; | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/noncore/applets/zkbapplet/zkbapplet.pro b/noncore/applets/zkbapplet/zkbapplet.pro index 22615d0..8cc1b58 100644 --- a/noncore/applets/zkbapplet/zkbapplet.pro +++ b/noncore/applets/zkbapplet/zkbapplet.pro | |||
@@ -1,16 +1,14 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = zkbapplet.h\ | 3 | HEADERS = zkbwidget.h \ |
4 | zkbwidget.h \ | ||
5 | ../../apps/keyz-cfg/zkbcfg.h \ | 4 | ../../apps/keyz-cfg/zkbcfg.h \ |
6 | ../../apps/keyz-cfg/zkbnames.h \ | 5 | ../../apps/keyz-cfg/zkbnames.h \ |
7 | ../../apps/keyz-cfg/zkbxml.h \ | 6 | ../../apps/keyz-cfg/zkbxml.h \ |
8 | ../../apps/keyz-cfg/zkb.h | 7 | ../../apps/keyz-cfg/zkb.h |
9 | SOURCES = zkbapplet.cpp \ | 8 | SOURCES = zkbwidget.cpp \ |
10 | zkbwidget.cpp \ | ||
11 | ../../apps/keyz-cfg/zkbcfg.cpp \ | 9 | ../../apps/keyz-cfg/zkbcfg.cpp \ |
12 | ../../apps/keyz-cfg/zkbnames.cpp \ | 10 | ../../apps/keyz-cfg/zkbnames.cpp \ |
13 | ../../apps/keyz-cfg/zkbxml.cpp \ | 11 | ../../apps/keyz-cfg/zkbxml.cpp \ |
14 | ../../apps/keyz-cfg/zkb.cpp | 12 | ../../apps/keyz-cfg/zkb.cpp |
15 | TARGET = zkbapplet | 13 | TARGET = zkbapplet |
16 | DESTDIR = $(OPIEDIR)/plugins/applets | 14 | DESTDIR = $(OPIEDIR)/plugins/applets |
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp index 05a76e7..0b5ab78 100644 --- a/noncore/applets/zkbapplet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/zkbwidget.cpp | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <opie2/otaskbarapplet.h> | ||
1 | #include <qpe/qcopenvelope_qws.h> | 2 | #include <qpe/qcopenvelope_qws.h> |
2 | #include <qpe/applnk.h> | 3 | #include <qpe/applnk.h> |
3 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
4 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
5 | #include <stdio.h> | 6 | #include <stdio.h> |
6 | #include <unistd.h> | 7 | #include <unistd.h> |
@@ -23,12 +24,17 @@ ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), | |||
23 | setFixedHeight ( AppLnk::smallIconSize() ); | 24 | setFixedHeight ( AppLnk::smallIconSize() ); |
24 | } | 25 | } |
25 | 26 | ||
26 | ZkbWidget::~ZkbWidget() { | 27 | ZkbWidget::~ZkbWidget() { |
27 | } | 28 | } |
28 | 29 | ||
30 | int ZkbWidget::position() | ||
31 | { | ||
32 | return 8; | ||
33 | } | ||
34 | |||
29 | bool ZkbWidget::loadKeymap() { | 35 | bool ZkbWidget::loadKeymap() { |
30 | ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); | 36 | ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); |
31 | QFontMetrics fm(font()); | 37 | QFontMetrics fm(font()); |
32 | 38 | ||
33 | if (keymap != 0) { | 39 | if (keymap != 0) { |
34 | delete keymap; | 40 | delete keymap; |
@@ -145,6 +151,12 @@ void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) { | |||
145 | } | 151 | } |
146 | 152 | ||
147 | void ZkbWidget::reload() { | 153 | void ZkbWidget::reload() { |
148 | loadKeymap(); | 154 | loadKeymap(); |
149 | QCopEnvelope("QPE/System", "notBusy()"); | 155 | QCopEnvelope("QPE/System", "notBusy()"); |
150 | } | 156 | } |
157 | |||
158 | Q_EXPORT_INTERFACE() | ||
159 | { | ||
160 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ZkbWidget> ); | ||
161 | } | ||
162 | |||
diff --git a/noncore/applets/zkbapplet/zkbwidget.h b/noncore/applets/zkbapplet/zkbwidget.h index a943563..7c67794 100644 --- a/noncore/applets/zkbapplet/zkbwidget.h +++ b/noncore/applets/zkbapplet/zkbwidget.h | |||
@@ -12,12 +12,13 @@ | |||
12 | class ZkbWidget : public QLabel { | 12 | class ZkbWidget : public QLabel { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | ZkbWidget(QWidget* parent); | 16 | ZkbWidget(QWidget* parent); |
17 | ~ZkbWidget(); | 17 | ~ZkbWidget(); |
18 | static int position(); | ||
18 | 19 | ||
19 | QSize sizeHint() const; | 20 | QSize sizeHint() const; |
20 | 21 | ||
21 | protected: | 22 | protected: |
22 | QLabel* label; | 23 | QLabel* label; |
23 | Keymap* keymap; | 24 | Keymap* keymap; |