author | llornkcor <llornkcor> | 2002-07-24 17:24:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-24 17:24:49 (UTC) |
commit | 2d9c74a4995a949378b36469ae5c6ab77963bead (patch) (unidiff) | |
tree | 2c304cddd6eeaee35d887d2fc9e52241c24abcf5 | |
parent | 9e126f7ed2f73b26ef440c1cc54d0dc0e6308f68 (diff) | |
download | opie-2d9c74a4995a949378b36469ae5c6ab77963bead.zip opie-2d9c74a4995a949378b36469ae5c6ab77963bead.tar.gz opie-2d9c74a4995a949378b36469ae5c6ab77963bead.tar.bz2 |
simple developers tool for a taskbar icon to restart opie
-rw-r--r-- | core/applets/restartapplet/.cvsignore | 5 | ||||
-rw-r--r-- | core/applets/restartapplet/opie-restartapplet.control | 9 | ||||
-rw-r--r-- | core/applets/restartapplet/restart.cpp | 77 | ||||
-rw-r--r-- | core/applets/restartapplet/restart.h | 43 | ||||
-rw-r--r-- | core/applets/restartapplet/restartapplet.pro | 12 | ||||
-rw-r--r-- | core/applets/restartapplet/restartappletimpl.cpp | 65 | ||||
-rw-r--r-- | core/applets/restartapplet/restartappletimpl.h | 44 |
7 files changed, 255 insertions, 0 deletions
diff --git a/core/applets/restartapplet/.cvsignore b/core/applets/restartapplet/.cvsignore new file mode 100644 index 0000000..7c4a217 --- a/dev/null +++ b/core/applets/restartapplet/.cvsignore | |||
@@ -0,0 +1,5 @@ | |||
1 | moc_* | ||
2 | *.moc | ||
3 | Makefile* | ||
4 | *.~ | ||
5 | opieobj \ No newline at end of file | ||
diff --git a/core/applets/restartapplet/opie-restartapplet.control b/core/applets/restartapplet/opie-restartapplet.control new file mode 100644 index 0000000..49eb743 --- a/dev/null +++ b/core/applets/restartapplet/opie-restartapplet.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Files: plugins/applets/librestartapplet.so* | ||
2 | Priority: optional | ||
3 | Section: opie/system | ||
4 | Maintainer: L. J. Potter <ljp@llornkcor.com> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION.1 | ||
7 | Depends: opie-base ($QPE_VERSION) | ||
8 | Description: Restart Applet | ||
9 | A simple taskbar applet to restart the Opie environment | ||
diff --git a/core/applets/restartapplet/restart.cpp b/core/applets/restartapplet/restart.cpp new file mode 100644 index 0000000..9ecba04 --- a/dev/null +++ b/core/applets/restartapplet/restart.cpp | |||
@@ -0,0 +1,77 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | ||
3 | ** All rights reserved. | ||
4 | ** | ||
5 | ** This file may be distributed and/or modified under the terms of the | ||
6 | ** GNU General Public License version 2 as published by the Free Software | ||
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
8 | ** packaging of this file. | ||
9 | ** | ||
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | ** | ||
13 | **********************************************************************/ | ||
14 | |||
15 | #include "restart.h" | ||
16 | |||
17 | #include <qpe/resource.h> | ||
18 | #include <qpe/qpeapplication.h> | ||
19 | |||
20 | #include <qpe/qcopenvelope_qws.h> | ||
21 | #include <qpe/resource.h> | ||
22 | #include <qpainter.h> | ||
23 | #include <qpixmap.h> | ||
24 | #include <qdatastream.h> | ||
25 | |||
26 | |||
27 | /* XPM */ | ||
28 | static char *restart_xpm[] = { | ||
29 | "16 16 11 1", | ||
30 | " c None", | ||
31 | ". c #000000", | ||
32 | "+ c #DCDCDC", | ||
33 | "@ c #A0A0A0", | ||
34 | "# c #C3C3C3", | ||
35 | "$ c #808080", | ||
36 | "% c #FFA858", | ||
37 | "& c #FFDCA8", | ||
38 | "* c #FFFFC0", | ||
39 | "= c #FFFFFF", | ||
40 | "- c #585858", | ||
41 | " .. ", | ||
42 | " .. .++. .. ", | ||
43 | " .+@.@##@.@+. ", | ||
44 | " .@+$@%%@$+@. ", | ||
45 | " .$%%&%&%$. ", | ||
46 | " ..+@%&$$%&@+.. ", | ||
47 | ".+#@%&%@@&*%@#+.", | ||
48 | ".$@+$&*&&=*$+@$.", | ||
49 | " .--+$&*=&$+--. ", | ||
50 | " .$#++$$++#$. ", | ||
51 | " .@=$-$++$-$=@. ", | ||
52 | " .+@-..@@..-@+. ", | ||
53 | " ... .+=. ... ", | ||
54 | " .-$. ", | ||
55 | " .. ", | ||
56 | " "}; | ||
57 | RestartApplet::RestartApplet( QWidget *parent, const char *name ) | ||
58 | : QWidget( parent, name ) { | ||
59 | setFixedHeight( 18 ); | ||
60 | setFixedWidth( 16 ); | ||
61 | qDebug("new restartapplet"); | ||
62 | show(); | ||
63 | } | ||
64 | |||
65 | RestartApplet::~RestartApplet() { | ||
66 | } | ||
67 | |||
68 | void RestartApplet::mousePressEvent( QMouseEvent *) { | ||
69 | QCopEnvelope e("QPE/System", "restart()"); | ||
70 | } | ||
71 | |||
72 | void RestartApplet::paintEvent( QPaintEvent* ) { | ||
73 | QPainter p(this); | ||
74 | qDebug("paint RESTART pixmap"); | ||
75 | p.drawPixmap( 0, 1, ( const char** ) restart_xpm ); | ||
76 | } | ||
77 | |||
diff --git a/core/applets/restartapplet/restart.h b/core/applets/restartapplet/restart.h new file mode 100644 index 0000000..e0c2158 --- a/dev/null +++ b/core/applets/restartapplet/restart.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | ||
3 | ** All rights reserved. | ||
4 | ** | ||
5 | ** This file may be distributed and/or modified under the terms of the | ||
6 | ** GNU General Public License version 2 as published by the Free Software | ||
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
8 | ** packaging of this file. | ||
9 | ** | ||
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | ** | ||
13 | **********************************************************************/ | ||
14 | |||
15 | #ifndef __RESTART_APPLET_H__ | ||
16 | #define __RESTART_APPLET_H__ | ||
17 | |||
18 | #include <qwidget.h> | ||
19 | #include <qframe.h> | ||
20 | #include <qpixmap.h> | ||
21 | #include <qguardedptr.h> | ||
22 | |||
23 | class RestartApplet : public QWidget | ||
24 | { | ||
25 | Q_OBJECT | ||
26 | public: | ||
27 | RestartApplet( QWidget *parent = 0, const char *name=0 ); | ||
28 | ~RestartApplet(); | ||
29 | public slots: | ||
30 | private: | ||
31 | void mousePressEvent( QMouseEvent * ); | ||
32 | void paintEvent( QPaintEvent* ); | ||
33 | |||
34 | private: | ||
35 | // QPixmap snapshotPixmap; | ||
36 | private slots: | ||
37 | |||
38 | |||
39 | }; | ||
40 | |||
41 | |||
42 | #endif // __RESTART_APPLET_H__ | ||
43 | |||
diff --git a/core/applets/restartapplet/restartapplet.pro b/core/applets/restartapplet/restartapplet.pro new file mode 100644 index 0000000..ca8799d --- a/dev/null +++ b/core/applets/restartapplet/restartapplet.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on release | ||
3 | HEADERS = restart.h restartappletimpl.h | ||
4 | SOURCES = restart.cpp restartappletimpl.cpp | ||
5 | TARGET = restartapplet | ||
6 | DESTDIR = $(OPIEDIR)/plugins/applets | ||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += ../$(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | VERSION = 1.0.0 | ||
11 | MOC_DIR=opieobj | ||
12 | OBJECTS_DIR=opieobj | ||
diff --git a/core/applets/restartapplet/restartappletimpl.cpp b/core/applets/restartapplet/restartappletimpl.cpp new file mode 100644 index 0000000..e675c0b --- a/dev/null +++ b/core/applets/restartapplet/restartappletimpl.cpp | |||
@@ -0,0 +1,65 @@ | |||
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 "restart.h" | ||
21 | #include "restartappletimpl.h" | ||
22 | |||
23 | |||
24 | RestartAppletImpl::RestartAppletImpl() | ||
25 | : restart(0), ref(0) | ||
26 | { | ||
27 | } | ||
28 | |||
29 | RestartAppletImpl::~RestartAppletImpl() | ||
30 | { | ||
31 | delete restart; | ||
32 | } | ||
33 | |||
34 | QWidget *RestartAppletImpl::applet( QWidget *parent ) | ||
35 | { | ||
36 | qDebug("restart applet"); | ||
37 | if ( !restart ) | ||
38 | restart = new RestartApplet( parent ); | ||
39 | return restart; | ||
40 | } | ||
41 | |||
42 | int RestartAppletImpl::position() const | ||
43 | { | ||
44 | return 6; | ||
45 | } | ||
46 | |||
47 | QRESULT RestartAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
48 | { | ||
49 | *iface = 0; | ||
50 | if ( uuid == IID_QUnknown ) | ||
51 | *iface = this; | ||
52 | else if ( uuid == IID_TaskbarApplet ) | ||
53 | *iface = this; | ||
54 | |||
55 | if ( *iface ) | ||
56 | (*iface)->addRef(); | ||
57 | return QS_OK; | ||
58 | } | ||
59 | |||
60 | Q_EXPORT_INTERFACE() | ||
61 | { | ||
62 | Q_CREATE_INSTANCE( RestartAppletImpl ) | ||
63 | } | ||
64 | |||
65 | |||
diff --git a/core/applets/restartapplet/restartappletimpl.h b/core/applets/restartapplet/restartappletimpl.h new file mode 100644 index 0000000..cdda49c --- a/dev/null +++ b/core/applets/restartapplet/restartappletimpl.h | |||
@@ -0,0 +1,44 @@ | |||
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 RESTARTAPPLETIMPL_H | ||
21 | #define RESTARTAPPLETIMPL_H | ||
22 | |||
23 | #include <qpe/taskbarappletinterface.h> | ||
24 | |||
25 | class RestartApplet; | ||
26 | |||
27 | class RestartAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | RestartAppletImpl(); | ||
31 | virtual ~RestartAppletImpl(); | ||
32 | |||
33 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
34 | Q_REFCOUNT | ||
35 | |||
36 | virtual QWidget *applet( QWidget *parent ); | ||
37 | virtual int position() const; | ||
38 | |||
39 | private: | ||
40 | RestartApplet *restart; | ||
41 | ulong ref; | ||
42 | }; | ||
43 | |||
44 | #endif | ||