summaryrefslogtreecommitdiff
path: root/core/applets/screenshotapplet
authormickeyl <mickeyl>2004-03-01 19:19:37 (UTC)
committer mickeyl <mickeyl>2004-03-01 19:19:37 (UTC)
commitddc3d749af5f7afebf69488b79641771fe246b5b (patch) (side-by-side diff)
tree8ea8614906c568e4677493ef09040724d60dd2d4 /core/applets/screenshotapplet
parentfb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (diff)
downloadopie-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.cpp25
-rw-r--r--core/applets/screenshotapplet/screenshot.h1
-rw-r--r--core/applets/screenshotapplet/screenshotapplet.pro6
-rw-r--r--core/applets/screenshotapplet/screenshotappletimpl.cpp66
-rw-r--r--core/applets/screenshotapplet/screenshotappletimpl.h43
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
@@ -15,15 +15,12 @@
#include "screenshot.h"
#include "inputDialog.h"
-#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>
#include <qpe/applnk.h>
+/* QT */
#include <qlineedit.h>
#include <qdir.h>
#include <qlabel.h>
@@ -34,6 +31,12 @@
#include <qcheckbox.h>
#include <qmessagebox.h>
+/* STD */
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <unistd.h>
/* 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<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
@@ -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 <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