From ddc3d749af5f7afebf69488b79641771fe246b5b Mon Sep 17 00:00:00 2001 From: mickeyl Date: Mon, 01 Mar 2004 19:19:37 +0000 Subject: remove duplicated boiler plate code in favour of the OTaskbarApplet template --- (limited to 'core/applets/screenshotapplet') 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 @@ -15,15 +15,12 @@ #include "screenshot.h" #include "inputDialog.h" -#include -#include -#include -#include -#include - +/* OPIE */ +#include #include #include +/* QT */ #include #include #include @@ -34,6 +31,12 @@ #include #include +/* STD */ +#include +#include +#include +#include +#include /* XPM */ static char * snapshot_xpm[] = { @@ -497,6 +500,11 @@ ScreenshotApplet::~ScreenshotApplet() { } +int ScreenshotApplet::position() +{ + return 6; +} + void ScreenshotApplet::mousePressEvent( QMouseEvent *) { ScreenshotControl *sc = new ScreenshotControl ( ); @@ -528,3 +536,8 @@ void ScreenshotApplet::paintEvent( QPaintEvent* ) p.drawPixmap( 0,0, m_icon ); } +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( OTaskbarAppletWrapper ); +} + 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 @@ -56,6 +56,7 @@ class ScreenshotApplet : public QWidget { public: ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); ~ScreenshotApplet(); + static int position(); protected: void mousePressEvent( QMouseEvent * ); 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 @@ -1,15 +1,13 @@ 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 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 ) target.path = $$prefix/plugins/applets 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 - -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 -- cgit v0.9.0.2