author | llornkcor <llornkcor> | 2002-07-24 17:24:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-07-24 17:24:49 (UTC) |
commit | 2d9c74a4995a949378b36469ae5c6ab77963bead (patch) (side-by-side diff) | |
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 @@ +moc_* +*.moc +Makefile* +*.~ +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 @@ +Files: plugins/applets/librestartapplet.so* +Priority: optional +Section: opie/system +Maintainer: L. J. Potter <ljp@llornkcor.com> +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION.1 +Depends: opie-base ($QPE_VERSION) +Description: Restart Applet + 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 @@ +/********************************************************************** +** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com +** All rights reserved. +** +** 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. +** +**********************************************************************/ + +#include "restart.h" + +#include <qpe/resource.h> +#include <qpe/qpeapplication.h> + +#include <qpe/qcopenvelope_qws.h> +#include <qpe/resource.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qdatastream.h> + + +/* XPM */ +static char *restart_xpm[] = { +"16 16 11 1", +" c None", +". c #000000", +"+ c #DCDCDC", +"@ c #A0A0A0", +"# c #C3C3C3", +"$ c #808080", +"% c #FFA858", +"& c #FFDCA8", +"* c #FFFFC0", +"= c #FFFFFF", +"- c #585858", +" .. ", +" .. .++. .. ", +" .+@.@##@.@+. ", +" .@+$@%%@$+@. ", +" .$%%&%&%$. ", +" ..+@%&$$%&@+.. ", +".+#@%&%@@&*%@#+.", +".$@+$&*&&=*$+@$.", +" .--+$&*=&$+--. ", +" .$#++$$++#$. ", +" .@=$-$++$-$=@. ", +" .+@-..@@..-@+. ", +" ... .+=. ... ", +" .-$. ", +" .. ", +" "}; +RestartApplet::RestartApplet( QWidget *parent, const char *name ) + : QWidget( parent, name ) { + setFixedHeight( 18 ); + setFixedWidth( 16 ); + qDebug("new restartapplet"); + show(); +} + +RestartApplet::~RestartApplet() { +} + +void RestartApplet::mousePressEvent( QMouseEvent *) { + QCopEnvelope e("QPE/System", "restart()"); +} + +void RestartApplet::paintEvent( QPaintEvent* ) { + QPainter p(this); + qDebug("paint RESTART pixmap"); + p.drawPixmap( 0, 1, ( const char** ) restart_xpm ); +} + 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 @@ +/********************************************************************** +** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com +** All rights reserved. +** +** 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. +** +**********************************************************************/ + +#ifndef __RESTART_APPLET_H__ +#define __RESTART_APPLET_H__ + +#include <qwidget.h> +#include <qframe.h> +#include <qpixmap.h> +#include <qguardedptr.h> + +class RestartApplet : public QWidget +{ + Q_OBJECT +public: + RestartApplet( QWidget *parent = 0, const char *name=0 ); + ~RestartApplet(); +public slots: +private: + void mousePressEvent( QMouseEvent * ); + void paintEvent( QPaintEvent* ); + +private: +// QPixmap snapshotPixmap; +private slots: + + +}; + + +#endif // __RESTART_APPLET_H__ + 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 @@ +TEMPLATE = lib +CONFIG += qt warn_on release +HEADERS = restart.h restartappletimpl.h +SOURCES = restart.cpp restartappletimpl.cpp +TARGET = restartapplet +DESTDIR = $(OPIEDIR)/plugins/applets +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += ../$(OPIEDIR)/include +LIBS += -lqpe +VERSION = 1.0.0 +MOC_DIR=opieobj +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 @@ +/********************************************************************** +** 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 "restart.h" +#include "restartappletimpl.h" + + +RestartAppletImpl::RestartAppletImpl() + : restart(0), ref(0) +{ +} + +RestartAppletImpl::~RestartAppletImpl() +{ + delete restart; +} + +QWidget *RestartAppletImpl::applet( QWidget *parent ) +{ + qDebug("restart applet"); + if ( !restart ) + restart = new RestartApplet( parent ); + return restart; +} + +int RestartAppletImpl::position() const +{ + return 6; +} + +QRESULT RestartAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_TaskbarApplet ) + *iface = this; + + if ( *iface ) + (*iface)->addRef(); + return QS_OK; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( RestartAppletImpl ) +} + + 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 @@ +/********************************************************************** +** 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 RESTARTAPPLETIMPL_H +#define RESTARTAPPLETIMPL_H + +#include <qpe/taskbarappletinterface.h> + +class RestartApplet; + +class RestartAppletImpl : public TaskbarAppletInterface +{ +public: + RestartAppletImpl(); + virtual ~RestartAppletImpl(); + + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + Q_REFCOUNT + + virtual QWidget *applet( QWidget *parent ); + virtual int position() const; + +private: + RestartApplet *restart; + ulong ref; +}; + +#endif |