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 | |
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 @@ -16,2 +16,3 @@ #include <opie2/odevice.h> +#include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> @@ -45,2 +46,7 @@ AutoRotate::~AutoRotate() +int AutoRotate::position() +{ + return 7; +} + void AutoRotate::mousePressEvent(QMouseEvent *) @@ -90 +96,6 @@ bool AutoRotate::isRotateEnabled() +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 @@ -24,4 +24,3 @@ public: ~AutoRotate(); - -private slots: + static int position(); 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,11 +1,11 @@ -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 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 @@ -5,3 +5,2 @@ HEADERS = ../../settings/sysinfo/graph.h \ ../../settings/sysinfo/memory.h \ - memoryappletimpl.h \ memorymeter.h \ @@ -12,3 +11,2 @@ SOURCES = ../../settings/sysinfo/graph.cpp \ ../../settings/sysinfo/memory.cpp \ - memoryappletimpl.cpp \ memorymeter.cpp \ @@ -21,3 +19,3 @@ DEPENDPATH += ../$(OPIEDIR)/include VERSION = 1.0.0 -LIBS += -lqpe -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 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 @@ -22,8 +22,6 @@ +#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 @@ -68,2 +66,7 @@ MemoryMeter::~MemoryMeter() +int MemoryMeter::position() +{ + return 7; +} + QSize MemoryMeter::sizeHint() const @@ -239 +242,6 @@ 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 @@ -33,2 +33,3 @@ public: ~MemoryMeter(); + static int position(); 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 @@ -21,2 +21,3 @@ +#include <opie2/otaskbarapplet.h> #include <qpe/filemanager.h> @@ -468,2 +469,7 @@ NotesApplet::~NotesApplet() { +int NotesApplet::position() +{ + return 6; +} + void NotesApplet::mousePressEvent( QMouseEvent *) { @@ -504 +510,5 @@ void NotesApplet::paintEvent( QPaintEvent* ) { +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 @@ -78,2 +78,3 @@ public: ~NotesApplet(); + static int position(); NotesControl *vc; 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 @@ -2,4 +2,4 @@ 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 @@ -10,6 +10,2 @@ LIBS += -lqpe VERSION = 1.0.0 -MOC_DIR=opieobj -OBJECTS_DIR=opieobj - - 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 @@ -2,4 +2,3 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release -HEADERS = zkbapplet.h\ - zkbwidget.h \ +HEADERS = zkbwidget.h \ ../../apps/keyz-cfg/zkbcfg.h \ @@ -8,4 +7,3 @@ HEADERS = zkbapplet.h\ ../../apps/keyz-cfg/zkb.h -SOURCES = zkbapplet.cpp \ - zkbwidget.cpp \ +SOURCES = zkbwidget.cpp \ ../../apps/keyz-cfg/zkbcfg.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 +1,2 @@ +#include <opie2/otaskbarapplet.h> #include <qpe/qcopenvelope_qws.h> @@ -28,2 +29,7 @@ ZkbWidget::~ZkbWidget() { +int ZkbWidget::position() +{ + return 8; +} + bool ZkbWidget::loadKeymap() { @@ -150 +156,7 @@ void ZkbWidget::reload() { } + +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 @@ -17,2 +17,3 @@ public: ~ZkbWidget(); + static int position(); |