author | mickeyl <mickeyl> | 2004-03-01 19:19:37 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-03-01 19:19:37 (UTC) |
commit | ddc3d749af5f7afebf69488b79641771fe246b5b (patch) (side-by-side diff) | |
tree | 8ea8614906c568e4677493ef09040724d60dd2d4 /core/applets/screenshotapplet | |
parent | fb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (diff) | |
download | opie-ddc3d749af5f7afebf69488b79641771fe246b5b.zip opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.gz opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.bz2 |
remove duplicated boiler plate code in favour of the OTaskbarApplet template
Diffstat (limited to 'core/applets/screenshotapplet') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 25 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshot.h | 1 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshotapplet.pro | 6 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshotappletimpl.cpp | 66 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshotappletimpl.h | 43 |
5 files changed, 22 insertions, 119 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 56a031c..5d6bce4 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp @@ -17,8 +17,4 @@ -#include <stdlib.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netdb.h> -#include <unistd.h> - +/* OPIE */ +#include <opie2/otaskbarapplet.h> #include <qpe/qpeapplication.h> @@ -26,2 +22,3 @@ +/* QT */ #include <qlineedit.h> @@ -36,2 +33,8 @@ +/* STD */ +#include <stdlib.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> +#include <unistd.h> @@ -499,2 +502,7 @@ ScreenshotApplet::~ScreenshotApplet() +int ScreenshotApplet::position() +{ + return 6; +} + void ScreenshotApplet::mousePressEvent( QMouseEvent *) @@ -530 +538,6 @@ void ScreenshotApplet::paintEvent( QPaintEvent* ) +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ScreenshotApplet> ); +} + diff --git a/core/applets/screenshotapplet/screenshot.h b/core/applets/screenshotapplet/screenshot.h index 74cc5e6..b753583 100644 --- a/core/applets/screenshotapplet/screenshot.h +++ b/core/applets/screenshotapplet/screenshot.h @@ -58,2 +58,3 @@ public: ~ScreenshotApplet(); + static int position(); diff --git a/core/applets/screenshotapplet/screenshotapplet.pro b/core/applets/screenshotapplet/screenshotapplet.pro index 45a5759..c7fcc3e 100644 --- a/core/applets/screenshotapplet/screenshotapplet.pro +++ b/core/applets/screenshotapplet/screenshotapplet.pro @@ -2,4 +2,4 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release -HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h -SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp +HEADERS = screenshot.h inputDialog.h +SOURCES = screenshot.cpp inputDialog.cpp TARGET = screenshotapplet @@ -10,4 +10,2 @@ LIBS += -lqpe VERSION = 1.0.0 -MOC_DIR=opieobj -OBJECTS_DIR=opieobj diff --git a/core/applets/screenshotapplet/screenshotappletimpl.cpp b/core/applets/screenshotapplet/screenshotappletimpl.cpp deleted file mode 100644 index e99ecb0..0000000 --- a/core/applets/screenshotapplet/screenshotappletimpl.cpp +++ b/dev/null @@ -1,66 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of 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 "screenshot.h" -#include "screenshotappletimpl.h" - - -ScreenshotAppletImpl::ScreenshotAppletImpl() - : screenshot(0) -{ -} - -ScreenshotAppletImpl::~ScreenshotAppletImpl() -{ - delete screenshot; -} - -QWidget *ScreenshotAppletImpl::applet( QWidget *parent ) -{ - if ( !screenshot ) - screenshot = new ScreenshotApplet( parent ); - return screenshot; -} - -int ScreenshotAppletImpl::position() const -{ - return 6; -} - -QRESULT ScreenshotAppletImpl::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( ScreenshotAppletImpl ) -} - - diff --git a/core/applets/screenshotapplet/screenshotappletimpl.h b/core/applets/screenshotapplet/screenshotappletimpl.h deleted file mode 100644 index 988a34c..0000000 --- a/core/applets/screenshotapplet/screenshotappletimpl.h +++ b/dev/null @@ -1,43 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of 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 SCREENSHOTAPPLETIMPL_H -#define SCREENSHOTAPPLETIMPL_H - -#include <qpe/taskbarappletinterface.h> - -class ScreenshotApplet; - -class ScreenshotAppletImpl : public TaskbarAppletInterface -{ -public: - ScreenshotAppletImpl(); - virtual ~ScreenshotAppletImpl(); - - QRESULT queryInterface( const QUuid&, QUnknownInterface** ); - Q_REFCOUNT - - virtual QWidget *applet( QWidget *parent ); - virtual int position() const; - -private: - ScreenshotApplet *screenshot; -}; - -#endif |