author | mickeyl <mickeyl> | 2004-03-01 21:10:13 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-01 21:10:13 (UTC) |
commit | 77af6f58d59011e123309c82b684695508a46787 (patch) (side-by-side diff) | |
tree | 1eeb3b323bc14581af7da9fe5b58c4c611b00575 /noncore/applets | |
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 @@ -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; -}; 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; 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 @@ -19,6 +19,7 @@ #include <stdlib.h> #include <qstringlist.h> +#include <opie2/otaskbarapplet.h> #include <qpe/filemanager.h> #include <qpe/qpeapplication.h> #include <qpe/timestring.h> @@ -466,6 +467,11 @@ NotesApplet::~NotesApplet() { delete vc; } +int NotesApplet::position() +{ + return 6; +} + void NotesApplet::mousePressEvent( QMouseEvent *) { if( !vc->isHidden()) { vc->doPopulate=false; @@ -502,3 +508,7 @@ void NotesApplet::paintEvent( QPaintEvent* ) { p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); } +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( OTaskbarAppletWrapper<NotesApplet> ); +} 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 @@ -76,6 +76,7 @@ class NotesApplet : public QWidget { public: NotesApplet( QWidget *parent = 0, const char *name=0 ); ~NotesApplet(); + static int position(); NotesControl *vc; public slots: private: 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 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release -HEADERS = notes.h notesappletimpl.h -SOURCES = notes.cpp notesappletimpl.cpp +HEADERS = notes.h +SOURCES = notes.cpp TARGET = notesapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe VERSION = 1.0.0 -MOC_DIR=opieobj -OBJECTS_DIR=opieobj - - 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 @@ -/********************************************************************** -** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> -** -** -** 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. -** -** -**********************************************************************/ -#include "notes.h" -#include "notesappletimpl.h" - - -NotesAppletImpl::NotesAppletImpl() - : notes(0){ -} - -NotesAppletImpl::~NotesAppletImpl() { - // not needed though cause we should have a valid parent - delete notes; -} - -QWidget *NotesAppletImpl::applet( QWidget *parent ) { - if ( !notes ) - notes = new NotesApplet( parent ); - return notes; -} - -int NotesAppletImpl::position() const { - return 6; -} - -QRESULT NotesAppletImpl::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( NotesAppletImpl ) -} - - 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 @@ -/********************************************************************** -** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> -** -** -** 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. -** -** -**********************************************************************/ -#ifndef NOTESAPPLETIMPL_H -#define NOTESAPPLETIMPL_H - -#include <qpe/taskbarappletinterface.h> - -class NotesApplet; - -class NotesAppletImpl : public TaskbarAppletInterface -{ -public: - NotesAppletImpl(); - virtual ~NotesAppletImpl(); - - QRESULT queryInterface( const QUuid&, QUnknownInterface** ); - Q_REFCOUNT - - virtual QWidget *applet( QWidget *parent ); - virtual int position() const; - -private: - NotesApplet *notes; -}; - -#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 @@ +Makefile* +advancedconfigbase.cpp +advancedconfigbase.h +moc_* +.moc +.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 @@ -#include <stdio.h> -#include <qlabel.h> -#include <qbutton.h> -#include <qwindowsystem_qws.h> -#include "zkbapplet.h" -#include "zkbwidget.h" - - -ZkbApplet::ZkbApplet() : app(0){ -} - -ZkbApplet::~ZkbApplet() -{ - if (app) delete app; -} - -QWidget* ZkbApplet::applet(QWidget* parent) { - if (app == 0) { - app = new ZkbWidget(parent); - } - - return app; -} - -int ZkbApplet::position() const { - return 8; -} - -QRESULT ZkbApplet::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(ZkbApplet) -} 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 @@ -#include "qpe/taskbarappletinterface.h" - -#ifndef ZKBAPPLET_H -#define ZKBAPPLET_H - -class ZkbWidget; - -class ZkbApplet : public TaskbarAppletInterface { -public: - ZkbApplet(); - virtual ~ZkbApplet(); - - QRESULT queryInterface(const QUuid&, QUnknownInterface**); - Q_REFCOUNT - - virtual QWidget* applet(QWidget*); - virtual int position() const; - -protected: - ZkbWidget* app; -}; - -#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,13 +1,11 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release -HEADERS = zkbapplet.h\ - zkbwidget.h \ +HEADERS = zkbwidget.h \ ../../apps/keyz-cfg/zkbcfg.h \ ../../apps/keyz-cfg/zkbnames.h \ ../../apps/keyz-cfg/zkbxml.h \ ../../apps/keyz-cfg/zkb.h -SOURCES = zkbapplet.cpp \ - zkbwidget.cpp \ +SOURCES = zkbwidget.cpp \ ../../apps/keyz-cfg/zkbcfg.cpp \ ../../apps/keyz-cfg/zkbnames.cpp \ ../../apps/keyz-cfg/zkbxml.cpp \ 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,3 +1,4 @@ +#include <opie2/otaskbarapplet.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/applnk.h> #include <qpe/qpeapplication.h> @@ -26,6 +27,11 @@ ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), ZkbWidget::~ZkbWidget() { } +int ZkbWidget::position() +{ + return 8; +} + bool ZkbWidget::loadKeymap() { ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); QFontMetrics fm(font()); @@ -148,3 +154,9 @@ void ZkbWidget::reload() { loadKeymap(); QCopEnvelope("QPE/System", "notBusy()"); } + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ZkbWidget> ); +} + 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 @@ -15,6 +15,7 @@ Q_OBJECT public: ZkbWidget(QWidget* parent); ~ZkbWidget(); + static int position(); QSize sizeHint() const; |