From 2d9c74a4995a949378b36469ae5c6ab77963bead Mon Sep 17 00:00:00 2001 From: llornkcor Date: Wed, 24 Jul 2002 17:24:49 +0000 Subject: simple developers tool for a taskbar icon to restart opie --- (limited to 'core/applets') 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 +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 +#include + +#include +#include +#include +#include +#include + + +/* 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 +#include +#include +#include + +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 + +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 -- cgit v0.9.0.2