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) (unidiff)
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 @@
15#include "screenshot.h" 15#include "screenshot.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17 17
18#include <stdlib.h> 18/* OPIE */
19#include <sys/socket.h> 19#include <opie2/otaskbarapplet.h>
20#include <netinet/in.h>
21#include <netdb.h>
22#include <unistd.h>
23
24#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
25#include <qpe/applnk.h> 21#include <qpe/applnk.h>
26 22
23/* QT */
27#include <qlineedit.h> 24#include <qlineedit.h>
28#include <qdir.h> 25#include <qdir.h>
29#include <qlabel.h> 26#include <qlabel.h>
@@ -34,6 +31,12 @@
34#include <qcheckbox.h> 31#include <qcheckbox.h>
35#include <qmessagebox.h> 32#include <qmessagebox.h>
36 33
34/* STD */
35#include <stdlib.h>
36#include <sys/socket.h>
37#include <netinet/in.h>
38#include <netdb.h>
39#include <unistd.h>
37 40
38/* XPM */ 41/* XPM */
39static char * snapshot_xpm[] = { 42static char * snapshot_xpm[] = {
@@ -497,6 +500,11 @@ ScreenshotApplet::~ScreenshotApplet()
497{ 500{
498} 501}
499 502
503int ScreenshotApplet::position()
504{
505 return 6;
506}
507
500void ScreenshotApplet::mousePressEvent( QMouseEvent *) 508void ScreenshotApplet::mousePressEvent( QMouseEvent *)
501{ 509{
502 ScreenshotControl *sc = new ScreenshotControl ( ); 510 ScreenshotControl *sc = new ScreenshotControl ( );
@@ -528,3 +536,8 @@ void ScreenshotApplet::paintEvent( QPaintEvent* )
528 p.drawPixmap( 0,0, m_icon ); 536 p.drawPixmap( 0,0, m_icon );
529} 537}
530 538
539Q_EXPORT_INTERFACE()
540{
541 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ScreenshotApplet> );
542}
543
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 {
56public: 56public:
57 ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); 57 ScreenshotApplet( QWidget *parent = 0, const char *name=0 );
58 ~ScreenshotApplet(); 58 ~ScreenshotApplet();
59 static int position();
59 60
60protected: 61protected:
61 void mousePressEvent( QMouseEvent * ); 62 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 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt plugin warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h 3HEADERS = screenshot.h inputDialog.h
4SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp 4SOURCES = screenshot.cpp inputDialog.cpp
5TARGET = screenshotapplet 5TARGET = screenshotapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11MOC_DIR=opieobj
12OBJECTS_DIR=opieobj
13 11
14include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
15target.path = $$prefix/plugins/applets 13target.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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include "screenshot.h"
21#include "screenshotappletimpl.h"
22
23
24ScreenshotAppletImpl::ScreenshotAppletImpl()
25 : screenshot(0)
26{
27}
28
29ScreenshotAppletImpl::~ScreenshotAppletImpl()
30{
31 delete screenshot;
32}
33
34QWidget *ScreenshotAppletImpl::applet( QWidget *parent )
35{
36 if ( !screenshot )
37 screenshot = new ScreenshotApplet( parent );
38 return screenshot;
39}
40
41int ScreenshotAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT ScreenshotAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
47{
48 *iface = 0;
49 if ( uuid == IID_QUnknown )
50 *iface = this;
51 else if ( uuid == IID_TaskbarApplet )
52 *iface = this;
53 else
54 return QS_FALSE;
55
56 if ( *iface )
57 (*iface)->addRef();
58 return QS_OK;
59}
60
61Q_EXPORT_INTERFACE()
62{
63 Q_CREATE_INSTANCE( ScreenshotAppletImpl )
64}
65
66
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 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef SCREENSHOTAPPLETIMPL_H
21#define SCREENSHOTAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class ScreenshotApplet;
26
27class ScreenshotAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ScreenshotAppletImpl();
31 virtual ~ScreenshotAppletImpl();
32
33 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
34 Q_REFCOUNT
35
36 virtual QWidget *applet( QWidget *parent );
37 virtual int position() const;
38
39private:
40 ScreenshotApplet *screenshot;
41};
42
43#endif