21 files changed, 67 insertions, 354 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp index 5152904..94be0ae 100644 --- a/noncore/applets/autorotateapplet/autorotate.cpp +++ b/noncore/applets/autorotateapplet/autorotate.cpp | |||
@@ -1,90 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | * copyright : (c) 2003 by Greg Gilbert | 2 | * copyright : (c) 2003 by Greg Gilbert |
3 | * email : greg@treke.net | 3 | * email : greg@treke.net |
4 | * based on the cardmon applet by Max Reiss | 4 | * based on the cardmon applet by Max Reiss |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * | 7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * | 8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * | 9 | * (at your option) any later version. * |
10 | * * | 10 | * * |
11 | *************************************************************************/ | 11 | *************************************************************************/ |
12 | 12 | ||
13 | #include "autorotate.h" | 13 | #include "autorotate.h" |
14 | 14 | ||
15 | /* OPIE */ | 15 | /* OPIE */ |
16 | #include <opie2/odevice.h> | 16 | #include <opie2/odevice.h> |
17 | #include <opie2/otaskbarapplet.h> | ||
17 | #include <qpe/applnk.h> | 18 | #include <qpe/applnk.h> |
18 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
19 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
20 | 21 | ||
21 | /* QT */ | 22 | /* QT */ |
22 | #include <qpainter.h> | 23 | #include <qpainter.h> |
23 | 24 | ||
24 | using namespace Opie; | 25 | using namespace Opie; |
25 | 26 | ||
26 | AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) | 27 | AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) |
27 | { | 28 | { |
28 | setFixedWidth( AppLnk::smallIconSize() ); | 29 | setFixedWidth( AppLnk::smallIconSize() ); |
29 | setFixedHeight( AppLnk::smallIconSize() ); | 30 | setFixedHeight( AppLnk::smallIconSize() ); |
30 | 31 | ||
31 | enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); | 32 | enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); |
32 | disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); | 33 | disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); |
33 | 34 | ||
34 | repaint(true); | 35 | repaint(true); |
35 | popupMenu = 0; | 36 | popupMenu = 0; |
36 | show(); | 37 | show(); |
37 | } | 38 | } |
38 | 39 | ||
39 | AutoRotate::~AutoRotate() | 40 | AutoRotate::~AutoRotate() |
40 | { | 41 | { |
41 | if (popupMenu) { | 42 | if (popupMenu) { |
42 | delete popupMenu; | 43 | delete popupMenu; |
43 | } | 44 | } |
44 | } | 45 | } |
45 | 46 | ||
47 | int AutoRotate::position() | ||
48 | { | ||
49 | return 7; | ||
50 | } | ||
51 | |||
46 | void AutoRotate::mousePressEvent(QMouseEvent *) | 52 | void AutoRotate::mousePressEvent(QMouseEvent *) |
47 | { | 53 | { |
48 | QPopupMenu *menu = new QPopupMenu(this); | 54 | QPopupMenu *menu = new QPopupMenu(this); |
49 | menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); | 55 | menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); |
50 | 56 | ||
51 | QPoint p = mapToGlobal(QPoint(0, 0)); | 57 | QPoint p = mapToGlobal(QPoint(0, 0)); |
52 | QSize s = menu->sizeHint(); | 58 | QSize s = menu->sizeHint(); |
53 | int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); | 59 | int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); |
54 | 60 | ||
55 | if (opt==1) | 61 | if (opt==1) |
56 | { | 62 | { |
57 | setRotateEnabled( !isRotateEnabled() ); | 63 | setRotateEnabled( !isRotateEnabled() ); |
58 | repaint(true); | 64 | repaint(true); |
59 | } | 65 | } |
60 | 66 | ||
61 | delete menu; | 67 | delete menu; |
62 | } | 68 | } |
63 | 69 | ||
64 | void AutoRotate::paintEvent(QPaintEvent *) | 70 | void AutoRotate::paintEvent(QPaintEvent *) |
65 | { | 71 | { |
66 | QPainter p(this); | 72 | QPainter p(this); |
67 | p.drawPixmap( 0, 0, isRotateEnabled()? enabledPm : disabledPm ); | 73 | p.drawPixmap( 0, 0, isRotateEnabled()? enabledPm : disabledPm ); |
68 | } | 74 | } |
69 | 75 | ||
70 | void AutoRotate::setRotateEnabled(bool status) | 76 | void AutoRotate::setRotateEnabled(bool status) |
71 | { | 77 | { |
72 | Config cfg( "qpe" ); | 78 | Config cfg( "qpe" ); |
73 | cfg.setGroup( "Appearance" ); | 79 | cfg.setGroup( "Appearance" ); |
74 | cfg.writeEntry( "rotateEnabled", status ); | 80 | cfg.writeEntry( "rotateEnabled", status ); |
75 | 81 | ||
76 | } | 82 | } |
77 | bool AutoRotate::isRotateEnabled() | 83 | bool AutoRotate::isRotateEnabled() |
78 | { | 84 | { |
79 | Config cfg( "qpe" ); | 85 | Config cfg( "qpe" ); |
80 | cfg.setGroup( "Appearance" ); | 86 | cfg.setGroup( "Appearance" ); |
81 | 87 | ||
82 | bool res = cfg.readBoolEntry( "rotateEnabled" ); | 88 | bool res = cfg.readBoolEntry( "rotateEnabled" ); |
83 | 89 | ||
84 | if (res ) | 90 | if (res ) |
85 | qDebug("Enabled"); | 91 | qDebug("Enabled"); |
86 | else | 92 | else |
87 | qDebug("Disabled"); | 93 | qDebug("Disabled"); |
88 | return res; | 94 | return res; |
89 | } | 95 | } |
90 | 96 | ||
97 | Q_EXPORT_INTERFACE() | ||
98 | { | ||
99 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<AutoRotate> ); | ||
100 | } | ||
101 | |||
diff --git a/noncore/applets/autorotateapplet/autorotate.h b/noncore/applets/autorotateapplet/autorotate.h index e05e7a0..ef322a6 100644 --- a/noncore/applets/autorotateapplet/autorotate.h +++ b/noncore/applets/autorotateapplet/autorotate.h | |||
@@ -1,41 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | * copyright : (c) 2003 by Greg Gilbert | 2 | * copyright : (c) 2003 by Greg Gilbert |
3 | * email : greg@treke.net | 3 | * email : greg@treke.net |
4 | * based on the cardmon applet by Max Reiss | 4 | * based on the cardmon applet by Max Reiss |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * | 7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * | 8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * | 9 | * (at your option) any later version. * |
10 | * * | 10 | * * |
11 | *************************************************************************/ | 11 | *************************************************************************/ |
12 | 12 | ||
13 | #ifndef AUTOROTATE_H | 13 | #ifndef AUTOROTATE_H |
14 | #define AUTOROTATE_H | 14 | #define AUTOROTATE_H |
15 | 15 | ||
16 | #include <qwidget.h> | 16 | #include <qwidget.h> |
17 | #include <qpixmap.h> | 17 | #include <qpixmap.h> |
18 | #include <qpopupmenu.h> | 18 | #include <qpopupmenu.h> |
19 | 19 | ||
20 | class AutoRotate : public QWidget { | 20 | class AutoRotate : public QWidget { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | AutoRotate( QWidget *parent = 0 ); | 23 | AutoRotate( QWidget *parent = 0 ); |
24 | ~AutoRotate(); | 24 | ~AutoRotate(); |
25 | 25 | static int position(); | |
26 | private slots: | ||
27 | 26 | ||
28 | protected: | 27 | protected: |
29 | void paintEvent( QPaintEvent* ); | 28 | void paintEvent( QPaintEvent* ); |
30 | void mousePressEvent( QMouseEvent * ); | 29 | void mousePressEvent( QMouseEvent * ); |
31 | private: | 30 | private: |
32 | bool isRotateEnabled(); | 31 | bool isRotateEnabled(); |
33 | void setRotateEnabled(bool); | 32 | void setRotateEnabled(bool); |
34 | QPixmap enabledPm; | 33 | QPixmap enabledPm; |
35 | QPixmap disabledPm; | 34 | QPixmap disabledPm; |
36 | void iconShow(); | 35 | void iconShow(); |
37 | QPopupMenu *popupMenu; | 36 | QPopupMenu *popupMenu; |
38 | }; | 37 | }; |
39 | 38 | ||
40 | #endif | 39 | #endif |
41 | 40 | ||
diff --git a/noncore/applets/autorotateapplet/autorotateapplet.pro b/noncore/applets/autorotateapplet/autorotateapplet.pro index 0ccbeba..465b165 100644 --- a/noncore/applets/autorotateapplet/autorotateapplet.pro +++ b/noncore/applets/autorotateapplet/autorotateapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = autorotate.h autorotateimpl.h | 3 | HEADERS = autorotate.h |
4 | SOURCES = autorotate.cpp autorotateimpl.cpp | 4 | SOURCES = autorotate.cpp |
5 | TARGET = autorotateapplet | 5 | TARGET = autorotateapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include ../launcher | 8 | DEPENDPATH += $(OPIEDIR)/include ../launcher |
9 | LIBS += -lqpe -lopiecore2 | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.cpp b/noncore/applets/autorotateapplet/autorotateimpl.cpp deleted file mode 100644 index 305ac50..0000000 --- a/noncore/applets/autorotateapplet/autorotateimpl.cpp +++ b/dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #include "autorotate.h" | ||
2 | #include "autorotateimpl.h" | ||
3 | |||
4 | |||
5 | AutoRotateImpl::AutoRotateImpl() | ||
6 | : autoRotate(0){ | ||
7 | qDebug ("here"); | ||
8 | } | ||
9 | |||
10 | AutoRotateImpl::~AutoRotateImpl() { | ||
11 | delete autoRotate; | ||
12 | } | ||
13 | |||
14 | QWidget *AutoRotateImpl::applet( QWidget *parent ) { | ||
15 | if ( !autoRotate ) { | ||
16 | autoRotate = new AutoRotate( parent ); | ||
17 | } | ||
18 | return autoRotate; | ||
19 | } | ||
20 | |||
21 | int AutoRotateImpl::position() const { | ||
22 | return 7; | ||
23 | } | ||
24 | |||
25 | QRESULT AutoRotateImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | ||
26 | *iface = 0; | ||
27 | if ( uuid == IID_QUnknown ) { | ||
28 | *iface = this; | ||
29 | } else if ( uuid == IID_TaskbarApplet ) { | ||
30 | *iface = this; | ||
31 | } else | ||
32 | return QS_FALSE; | ||
33 | |||
34 | if ( *iface ) { | ||
35 | (*iface)->addRef(); | ||
36 | } | ||
37 | return QS_OK; | ||
38 | } | ||
39 | |||
40 | Q_EXPORT_INTERFACE() { | ||
41 | Q_CREATE_INSTANCE( AutoRotateImpl ) | ||
42 | } | ||
diff --git a/noncore/applets/autorotateapplet/autorotateimpl.h b/noncore/applets/autorotateapplet/autorotateimpl.h deleted file mode 100644 index fde23a9..0000000 --- a/noncore/applets/autorotateapplet/autorotateimpl.h +++ b/dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #include <qpe/taskbarappletinterface.h> | ||
2 | |||
3 | class AutoRotate; | ||
4 | |||
5 | class AutoRotateImpl : public TaskbarAppletInterface { | ||
6 | public: | ||
7 | AutoRotateImpl(); | ||
8 | virtual ~AutoRotateImpl(); | ||
9 | |||
10 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
11 | Q_REFCOUNT | ||
12 | |||
13 | virtual QWidget *applet( QWidget *parent ); | ||
14 | virtual int position() const; | ||
15 | |||
16 | private: | ||
17 | AutoRotate *autoRotate; | ||
18 | }; | ||
diff --git a/noncore/applets/memoryapplet/memoryapplet.pro b/noncore/applets/memoryapplet/memoryapplet.pro index 6031386..3cd7839 100644 --- a/noncore/applets/memoryapplet/memoryapplet.pro +++ b/noncore/applets/memoryapplet/memoryapplet.pro | |||
@@ -1,24 +1,22 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = ../../settings/sysinfo/graph.h \ | 3 | HEADERS = ../../settings/sysinfo/graph.h \ |
4 | ../../settings/sysinfo/load.h \ | 4 | ../../settings/sysinfo/load.h \ |
5 | ../../settings/sysinfo/memory.h \ | 5 | ../../settings/sysinfo/memory.h \ |
6 | memoryappletimpl.h \ | ||
7 | memorymeter.h \ | 6 | memorymeter.h \ |
8 | memorystatus.h \ | 7 | memorystatus.h \ |
9 | swapfile.h | 8 | swapfile.h |
10 | SOURCES = ../../settings/sysinfo/graph.cpp \ | 9 | SOURCES = ../../settings/sysinfo/graph.cpp \ |
11 | ../../settings/sysinfo/load.cpp \ | 10 | ../../settings/sysinfo/load.cpp \ |
12 | ../../settings/sysinfo/memory.cpp \ | 11 | ../../settings/sysinfo/memory.cpp \ |
13 | memoryappletimpl.cpp \ | ||
14 | memorymeter.cpp \ | 12 | memorymeter.cpp \ |
15 | memorystatus.cpp \ | 13 | memorystatus.cpp \ |
16 | swapfile.cpp | 14 | swapfile.cpp |
17 | TARGET = memoryapplet | 15 | TARGET = memoryapplet |
18 | DESTDIR = $(OPIEDIR)/plugins/applets | 16 | DESTDIR = $(OPIEDIR)/plugins/applets |
19 | INCLUDEPATH += $(OPIEDIR)/include | 17 | INCLUDEPATH += $(OPIEDIR)/include |
20 | DEPENDPATH += ../$(OPIEDIR)/include | 18 | DEPENDPATH += ../$(OPIEDIR)/include |
21 | VERSION = 1.0.0 | 19 | VERSION = 1.0.0 |
22 | LIBS += -lqpe -lopieui2 | 20 | LIBS += -lqpe -lopiecore2 -lopieui2 |
23 | 21 | ||
24 | include ( $(OPIEDIR)/include.pro ) | 22 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/applets/memoryapplet/memoryappletimpl.cpp b/noncore/applets/memoryapplet/memoryappletimpl.cpp deleted file mode 100644 index a117e7f..0000000 --- a/noncore/applets/memoryapplet/memoryappletimpl.cpp +++ b/dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the 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 "memorymeter.h" | ||
21 | #include "memoryappletimpl.h" | ||
22 | |||
23 | MemoryAppletImpl::MemoryAppletImpl() | ||
24 | : memory(0) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | MemoryAppletImpl::~MemoryAppletImpl() | ||
29 | { | ||
30 | delete memory; | ||
31 | } | ||
32 | |||
33 | QWidget *MemoryAppletImpl::applet( QWidget *parent ) | ||
34 | { | ||
35 | if ( !memory ) | ||
36 | memory = new MemoryMeter( parent ); | ||
37 | |||
38 | return memory; | ||
39 | } | ||
40 | |||
41 | int MemoryAppletImpl::position() const | ||
42 | { | ||
43 | return 8; | ||
44 | } | ||
45 | |||
46 | QRESULT MemoryAppletImpl::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 | (*iface)->addRef(); | ||
57 | |||
58 | return QS_OK; | ||
59 | } | ||
60 | |||
61 | Q_EXPORT_INTERFACE() | ||
62 | { | ||
63 | Q_CREATE_INSTANCE( MemoryAppletImpl ) | ||
64 | } | ||
65 | |||
diff --git a/noncore/applets/memoryapplet/memoryappletimpl.h b/noncore/applets/memoryapplet/memoryappletimpl.h deleted file mode 100644 index 2db7dbe..0000000 --- a/noncore/applets/memoryapplet/memoryappletimpl.h +++ b/dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the 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 MEMORYAPPLETIMPL_H | ||
21 | #define MEMORYAPPLETIMPL_H | ||
22 | |||
23 | #include <qtopia/taskbarappletinterface.h> | ||
24 | |||
25 | class MemoryMeter; | ||
26 | |||
27 | class /*QTOPIA_PLUGIN_EXPORT*/ MemoryAppletImpl : public TaskbarAppletInterface | ||
28 | { | ||
29 | public: | ||
30 | MemoryAppletImpl(); | ||
31 | virtual ~MemoryAppletImpl(); | ||
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 | MemoryMeter *memory; | ||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/applets/memoryapplet/memorymeter.cpp b/noncore/applets/memoryapplet/memorymeter.cpp index 54b5c52..9299f49 100644 --- a/noncore/applets/memoryapplet/memorymeter.cpp +++ b/noncore/applets/memoryapplet/memorymeter.cpp | |||
@@ -1,92 +1,95 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "memorymeter.h" | 20 | #include "memorymeter.h" |
21 | #include "memorystatus.h" | 21 | #include "memorystatus.h" |
22 | 22 | ||
23 | #include <opie2/otaskbarapplet.h> | ||
23 | #include <qtopia/power.h> | 24 | #include <qtopia/power.h> |
24 | #include <qtopia/config.h> | 25 | #include <qtopia/config.h> |
25 | |||
26 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | ||
27 | #include <qtopia/qcopenvelope_qws.h> | 26 | #include <qtopia/qcopenvelope_qws.h> |
28 | #endif | ||
29 | 27 | ||
30 | #include <qpainter.h> | 28 | #include <qpainter.h> |
31 | #include <qtimer.h> | 29 | #include <qtimer.h> |
32 | #include <qapplication.h> | 30 | #include <qapplication.h> |
33 | 31 | ||
34 | #include <qtopia/applnk.h> | 32 | #include <qtopia/applnk.h> |
35 | 33 | ||
36 | MemoryMeter::MemoryMeter( QWidget *parent ) | 34 | MemoryMeter::MemoryMeter( QWidget *parent ) |
37 | : QWidget( parent ), memoryView(0) | 35 | : QWidget( parent ), memoryView(0) |
38 | { | 36 | { |
39 | bvsz = QSize(); | 37 | bvsz = QSize(); |
40 | if ( qApp->desktop()->height() >= 300 ) | 38 | if ( qApp->desktop()->height() >= 300 ) |
41 | { | 39 | { |
42 | memoryView = new MemoryStatus( 0, WStyle_StaysOnTop | WType_Popup ); | 40 | memoryView = new MemoryStatus( 0, WStyle_StaysOnTop | WType_Popup ); |
43 | memoryView->setFrameStyle( QFrame::Panel | QFrame::Raised ); | 41 | memoryView->setFrameStyle( QFrame::Panel | QFrame::Raised ); |
44 | } | 42 | } |
45 | else | 43 | else |
46 | { | 44 | { |
47 | memoryView = new MemoryStatus( 0 ); | 45 | memoryView = new MemoryStatus( 0 ); |
48 | memoryView->showMaximized(); | 46 | memoryView->showMaximized(); |
49 | } | 47 | } |
50 | 48 | ||
51 | Config config("MemoryPlugin"); | 49 | Config config("MemoryPlugin"); |
52 | config.setGroup("Warning levels"); | 50 | config.setGroup("Warning levels"); |
53 | low = config.readNumEntry("low", 40); | 51 | low = config.readNumEntry("low", 40); |
54 | critical = config.readNumEntry("critical", 20); | 52 | critical = config.readNumEntry("critical", 20); |
55 | 53 | ||
56 | startTimer( 10000 ); | 54 | startTimer( 10000 ); |
57 | setFixedWidth(10); | 55 | setFixedWidth(10); |
58 | setFixedHeight(AppLnk::smallIconSize()); | 56 | setFixedHeight(AppLnk::smallIconSize()); |
59 | usageTimer = new QTimer( this ); | 57 | usageTimer = new QTimer( this ); |
60 | connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) ); | 58 | connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) ); |
61 | timerEvent(0); | 59 | timerEvent(0); |
62 | } | 60 | } |
63 | 61 | ||
64 | MemoryMeter::~MemoryMeter() | 62 | MemoryMeter::~MemoryMeter() |
65 | { | 63 | { |
66 | delete (QWidget *) memoryView; | 64 | delete (QWidget *) memoryView; |
67 | } | 65 | } |
68 | 66 | ||
67 | int MemoryMeter::position() | ||
68 | { | ||
69 | return 7; | ||
70 | } | ||
71 | |||
69 | QSize MemoryMeter::sizeHint() const | 72 | QSize MemoryMeter::sizeHint() const |
70 | { | 73 | { |
71 | return QSize(10, AppLnk::smallIconSize()); | 74 | return QSize(10, AppLnk::smallIconSize()); |
72 | } | 75 | } |
73 | 76 | ||
74 | bool MemoryMeter::updateMemoryViewGeometry() | 77 | bool MemoryMeter::updateMemoryViewGeometry() |
75 | { | 78 | { |
76 | if (memoryView != 0) | 79 | if (memoryView != 0) |
77 | { | 80 | { |
78 | QSize sz = memoryView->sizeHint(); | 81 | QSize sz = memoryView->sizeHint(); |
79 | if ( sz != bvsz ) | 82 | if ( sz != bvsz ) |
80 | { | 83 | { |
81 | bvsz = sz; | 84 | bvsz = sz; |
82 | QRect r(memoryView->pos(), memoryView->sizeHint()); | 85 | QRect r(memoryView->pos(), memoryView->sizeHint()); |
83 | if ( qApp->desktop()->height() >= 300 ) | 86 | if ( qApp->desktop()->height() >= 300 ) |
84 | { | 87 | { |
85 | QPoint curPos = mapToGlobal( rect().topLeft() ); | 88 | QPoint curPos = mapToGlobal( rect().topLeft() ); |
86 | int lp = qApp->desktop()->width() - memoryView->sizeHint().width(); | 89 | int lp = qApp->desktop()->width() - memoryView->sizeHint().width(); |
87 | r.moveTopLeft( QPoint(lp, curPos.y() - memoryView->sizeHint().height()-1) ); | 90 | r.moveTopLeft( QPoint(lp, curPos.y() - memoryView->sizeHint().height()-1) ); |
88 | } | 91 | } |
89 | memoryView->setGeometry(r); | 92 | memoryView->setGeometry(r); |
90 | return TRUE; | 93 | return TRUE; |
91 | } | 94 | } |
92 | return FALSE; | 95 | return FALSE; |
@@ -216,24 +219,29 @@ void MemoryMeter::paintEvent( QPaintEvent* ) | |||
216 | p.setBrush(gray/*.dark(120)*/); | 219 | p.setBrush(gray/*.dark(120)*/); |
217 | p.drawRect(batt_xoffset + 3 * band_width, batt_yoffset, band_width, used_height); | 220 | p.drawRect(batt_xoffset + 3 * band_width, batt_yoffset, band_width, used_height); |
218 | } | 221 | } |
219 | 222 | ||
220 | // | 223 | // |
221 | // Unused section. | 224 | // Unused section. |
222 | // | 225 | // |
223 | if ( batt_height - used_height > 0 ) | 226 | if ( batt_height - used_height > 0 ) |
224 | { | 227 | { |
225 | int unused_offset = used_height + batt_yoffset; | 228 | int unused_offset = used_height + batt_yoffset; |
226 | int unused_height = batt_height - used_height; | 229 | int unused_height = batt_height - used_height; |
227 | p.setPen(NoPen); | 230 | p.setPen(NoPen); |
228 | p.setBrush(c); | 231 | p.setBrush(c); |
229 | p.drawRect(batt_xoffset, unused_offset, band_width, unused_height); | 232 | p.drawRect(batt_xoffset, unused_offset, band_width, unused_height); |
230 | p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height); | 233 | p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height); |
231 | 234 | ||
232 | p.setBrush(lightc); | 235 | p.setBrush(lightc); |
233 | p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height); | 236 | p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height); |
234 | 237 | ||
235 | p.setBrush(darkc); | 238 | p.setBrush(darkc); |
236 | p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height); | 239 | p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height); |
237 | } | 240 | } |
238 | } | 241 | } |
239 | 242 | ||
243 | Q_EXPORT_INTERFACE() | ||
244 | { | ||
245 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> ); | ||
246 | } | ||
247 | |||
diff --git a/noncore/applets/memoryapplet/memorymeter.h b/noncore/applets/memoryapplet/memorymeter.h index 0f3cb0b..ed541f0 100644 --- a/noncore/applets/memoryapplet/memorymeter.h +++ b/noncore/applets/memoryapplet/memorymeter.h | |||
@@ -10,44 +10,45 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef MEMORY_H | 20 | #ifndef MEMORY_H |
21 | #define MEMORY_H | 21 | #define MEMORY_H |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | 24 | ||
25 | class MemoryStatus; | 25 | class MemoryStatus; |
26 | class QTimer; | 26 | class QTimer; |
27 | 27 | ||
28 | class MemoryMeter : public QWidget | 28 | class MemoryMeter : public QWidget |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | MemoryMeter( QWidget *parent = 0 ); | 32 | MemoryMeter( QWidget *parent = 0 ); |
33 | ~MemoryMeter(); | 33 | ~MemoryMeter(); |
34 | static int position(); | ||
34 | 35 | ||
35 | QSize sizeHint() const; | 36 | QSize sizeHint() const; |
36 | MemoryStatus* memoryView; | 37 | MemoryStatus* memoryView; |
37 | 38 | ||
38 | protected: | 39 | protected: |
39 | void timerEvent( QTimerEvent * ); | 40 | void timerEvent( QTimerEvent * ); |
40 | void paintEvent( QPaintEvent* ); | 41 | void paintEvent( QPaintEvent* ); |
41 | void mousePressEvent( QMouseEvent * ); | 42 | void mousePressEvent( QMouseEvent * ); |
42 | 43 | ||
43 | protected slots: | 44 | protected slots: |
44 | void usageTimeout(); | 45 | void usageTimeout(); |
45 | 46 | ||
46 | protected: | 47 | protected: |
47 | QTimer *usageTimer; | 48 | QTimer *usageTimer; |
48 | int percent, low, critical; | 49 | int percent, low, critical; |
49 | QSize bvsz; | 50 | QSize bvsz; |
50 | bool updateMemoryViewGeometry(); | 51 | bool updateMemoryViewGeometry(); |
51 | }; | 52 | }; |
52 | 53 | ||
53 | #endif | 54 | #endif |
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 7b8bdd9..1142028 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -1,45 +1,46 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | 2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> |
3 | 3 | ||
4 | ** All rights reserved. | 4 | ** All rights reserved. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "notes.h" | 16 | #include "notes.h" |
17 | 17 | ||
18 | #include <qapplication.h> | 18 | #include <qapplication.h> |
19 | #include <stdlib.h> | 19 | #include <stdlib.h> |
20 | #include <qstringlist.h> | 20 | #include <qstringlist.h> |
21 | 21 | ||
22 | #include <opie2/otaskbarapplet.h> | ||
22 | #include <qpe/filemanager.h> | 23 | #include <qpe/filemanager.h> |
23 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/timestring.h> | 25 | #include <qpe/timestring.h> |
25 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
26 | #include <qpe/ir.h> | 27 | #include <qpe/ir.h> |
27 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
28 | 29 | ||
29 | // #include <qsocket.h> | 30 | // #include <qsocket.h> |
30 | // #include <qclipboard.h> | 31 | // #include <qclipboard.h> |
31 | #include <qmultilineedit.h> | 32 | #include <qmultilineedit.h> |
32 | #include <qlistbox.h> | 33 | #include <qlistbox.h> |
33 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
34 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
35 | 36 | ||
36 | #include <qdir.h> | 37 | #include <qdir.h> |
37 | #include <qfile.h> | 38 | #include <qfile.h> |
38 | #include <qpoint.h> | 39 | #include <qpoint.h> |
39 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
40 | #include <qpainter.h> | 41 | #include <qpainter.h> |
41 | #include <qlayout.h> | 42 | #include <qlayout.h> |
42 | #include <qframe.h> | 43 | #include <qframe.h> |
43 | #include <qpixmap.h> | 44 | #include <qpixmap.h> |
44 | #include <qstring.h> | 45 | #include <qstring.h> |
45 | #include <qtimer.h> | 46 | #include <qtimer.h> |
@@ -445,60 +446,69 @@ void NotesControl::slotSearch() { | |||
445 | // if(e->key() == Key_V) { //paste | 446 | // if(e->key() == Key_V) { //paste |
446 | // QClipboard *cb = QApplication::clipboard(); | 447 | // QClipboard *cb = QApplication::clipboard(); |
447 | // QString text; | 448 | // QString text; |
448 | // //view | 449 | // //view |
449 | // cb->setText(); | 450 | // cb->setText(); |
450 | // } | 451 | // } |
451 | // break; | 452 | // break; |
452 | // }; | 453 | // }; |
453 | // QWidget::keyReleaseEvent(e); | 454 | // QWidget::keyReleaseEvent(e); |
454 | // } | 455 | // } |
455 | 456 | ||
456 | //=========================================================================== | 457 | //=========================================================================== |
457 | 458 | ||
458 | NotesApplet::NotesApplet( QWidget *parent, const char *name ) | 459 | NotesApplet::NotesApplet( QWidget *parent, const char *name ) |
459 | : QWidget( parent, name ) { | 460 | : QWidget( parent, name ) { |
460 | setFixedHeight( 18 ); | 461 | setFixedHeight( 18 ); |
461 | setFixedWidth( 14 ); | 462 | setFixedWidth( 14 ); |
462 | vc = new NotesControl; | 463 | vc = new NotesControl; |
463 | } | 464 | } |
464 | 465 | ||
465 | NotesApplet::~NotesApplet() { | 466 | NotesApplet::~NotesApplet() { |
466 | delete vc; | 467 | delete vc; |
467 | } | 468 | } |
468 | 469 | ||
470 | int NotesApplet::position() | ||
471 | { | ||
472 | return 6; | ||
473 | } | ||
474 | |||
469 | void NotesApplet::mousePressEvent( QMouseEvent *) { | 475 | void NotesApplet::mousePressEvent( QMouseEvent *) { |
470 | if( !vc->isHidden()) { | 476 | if( !vc->isHidden()) { |
471 | vc->doPopulate=false; | 477 | vc->doPopulate=false; |
472 | vc->save(); | 478 | vc->save(); |
473 | vc->close(); | 479 | vc->close(); |
474 | } else { | 480 | } else { |
475 | // vc = new NotesControl; | 481 | // vc = new NotesControl; |
476 | // QPoint curPos = mapToGlobal( rect().topLeft() ); | 482 | // QPoint curPos = mapToGlobal( rect().topLeft() ); |
477 | if(vc->showMax) { | 483 | if(vc->showMax) { |
478 | qDebug("show max"); | 484 | qDebug("show max"); |
479 | vc->showMaximized(); | 485 | vc->showMaximized(); |
480 | } else { | 486 | } else { |
481 | qDebug("no show max"); | 487 | qDebug("no show max"); |
482 | QWidget *wid = QPEApplication::desktop(); | 488 | QWidget *wid = QPEApplication::desktop(); |
483 | QRect rect = QApplication::desktop()->geometry(); | 489 | QRect rect = QApplication::desktop()->geometry(); |
484 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); | 490 | vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); |
485 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); | 491 | vc->move ( (rect.center()/2) - (vc->rect().center()/2)); |
486 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); | 492 | // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); |
487 | } | 493 | } |
488 | vc->show(); | 494 | vc->show(); |
489 | vc->doPopulate=true; | 495 | vc->doPopulate=true; |
490 | vc->populateBox(); | 496 | vc->populateBox(); |
491 | vc->doPopulate=false; | 497 | vc->doPopulate=false; |
492 | vc->loaded=false; | 498 | vc->loaded=false; |
493 | 499 | ||
494 | vc->load(); | 500 | vc->load(); |
495 | // this->setFocus(); | 501 | // this->setFocus(); |
496 | vc->view->setFocus(); | 502 | vc->view->setFocus(); |
497 | } | 503 | } |
498 | } | 504 | } |
499 | 505 | ||
500 | void NotesApplet::paintEvent( QPaintEvent* ) { | 506 | void NotesApplet::paintEvent( QPaintEvent* ) { |
501 | QPainter p(this); | 507 | QPainter p(this); |
502 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); | 508 | p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); |
503 | } | 509 | } |
504 | 510 | ||
511 | Q_EXPORT_INTERFACE() | ||
512 | { | ||
513 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<NotesApplet> ); | ||
514 | } | ||
diff --git a/noncore/applets/notesapplet/notes.h b/noncore/applets/notesapplet/notes.h index 08253cb..ed1f98c 100644 --- a/noncore/applets/notesapplet/notes.h +++ b/noncore/applets/notesapplet/notes.h | |||
@@ -55,39 +55,40 @@ private: | |||
55 | void load(const QString&); | 55 | void load(const QString&); |
56 | private slots: | 56 | private slots: |
57 | void slotSearch(); | 57 | void slotSearch(); |
58 | void slotShowMax(); | 58 | void slotShowMax(); |
59 | void slotBeamButton(); | 59 | void slotBeamButton(); |
60 | void slotBeamFinished( Ir*); | 60 | void slotBeamFinished( Ir*); |
61 | void slotDeleteButton(); | 61 | void slotDeleteButton(); |
62 | void slotSaveButton(); | 62 | void slotSaveButton(); |
63 | void slotDeleteButtonClicked(); | 63 | void slotDeleteButtonClicked(); |
64 | void slotNewButton(); | 64 | void slotNewButton(); |
65 | void boxPressed(int, QListBoxItem *, const QPoint&); | 65 | void boxPressed(int, QListBoxItem *, const QPoint&); |
66 | void showMenu(); | 66 | void showMenu(); |
67 | void loadDoc( const DocLnk &); | 67 | void loadDoc( const DocLnk &); |
68 | void slotViewEdited(); | 68 | void slotViewEdited(); |
69 | void slotBoxSelected(const QString &); | 69 | void slotBoxSelected(const QString &); |
70 | // void keyReleaseEvent( QKeyEvent *); | 70 | // void keyReleaseEvent( QKeyEvent *); |
71 | 71 | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | class NotesApplet : public QWidget { | 74 | class NotesApplet : public QWidget { |
75 | Q_OBJECT | 75 | Q_OBJECT |
76 | public: | 76 | public: |
77 | NotesApplet( QWidget *parent = 0, const char *name=0 ); | 77 | NotesApplet( QWidget *parent = 0, const char *name=0 ); |
78 | ~NotesApplet(); | 78 | ~NotesApplet(); |
79 | static int position(); | ||
79 | NotesControl *vc; | 80 | NotesControl *vc; |
80 | public slots: | 81 | public slots: |
81 | private: | 82 | private: |
82 | void mousePressEvent( QMouseEvent * ); | 83 | void mousePressEvent( QMouseEvent * ); |
83 | void paintEvent( QPaintEvent* ); | 84 | void paintEvent( QPaintEvent* ); |
84 | 85 | ||
85 | private: | 86 | private: |
86 | QPixmap notesPixmap; | 87 | QPixmap notesPixmap; |
87 | private slots: | 88 | private slots: |
88 | 89 | ||
89 | 90 | ||
90 | }; | 91 | }; |
91 | 92 | ||
92 | #endif // __NOTES_APPLET_H__ | 93 | #endif // __NOTES_APPLET_H__ |
93 | 94 | ||
diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro index 3075948..38ba184 100644 --- a/noncore/applets/notesapplet/notesapplet.pro +++ b/noncore/applets/notesapplet/notesapplet.pro | |||
@@ -1,16 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = notes.h notesappletimpl.h | 3 | HEADERS = notes.h |
4 | SOURCES = notes.cpp notesappletimpl.cpp | 4 | SOURCES = notes.cpp |
5 | TARGET = notesapplet | 5 | TARGET = notesapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | MOC_DIR=opieobj | ||
12 | OBJECTS_DIR=opieobj | ||
13 | |||
14 | |||
15 | 11 | ||
16 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/applets/notesapplet/notesappletimpl.cpp b/noncore/applets/notesapplet/notesappletimpl.cpp deleted file mode 100644 index 8a9da7f..0000000 --- a/noncore/applets/notesapplet/notesappletimpl.cpp +++ b/dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | ||
3 | ** | ||
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 | ** | ||
11 | **********************************************************************/ | ||
12 | #include "notes.h" | ||
13 | #include "notesappletimpl.h" | ||
14 | |||
15 | |||
16 | NotesAppletImpl::NotesAppletImpl() | ||
17 | : notes(0){ | ||
18 | } | ||
19 | |||
20 | NotesAppletImpl::~NotesAppletImpl() { | ||
21 | // not needed though cause we should have a valid parent | ||
22 | delete notes; | ||
23 | } | ||
24 | |||
25 | QWidget *NotesAppletImpl::applet( QWidget *parent ) { | ||
26 | if ( !notes ) | ||
27 | notes = new NotesApplet( parent ); | ||
28 | return notes; | ||
29 | } | ||
30 | |||
31 | int NotesAppletImpl::position() const { | ||
32 | return 6; | ||
33 | } | ||
34 | |||
35 | QRESULT NotesAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | ||
36 | *iface = 0; | ||
37 | if ( uuid == IID_QUnknown ) | ||
38 | *iface = this; | ||
39 | else if ( uuid == IID_TaskbarApplet ) | ||
40 | *iface = this; | ||
41 | else | ||
42 | return QS_FALSE; | ||
43 | |||
44 | if ( *iface ) | ||
45 | (*iface)->addRef(); | ||
46 | return QS_OK; | ||
47 | } | ||
48 | |||
49 | Q_EXPORT_INTERFACE() { | ||
50 | Q_CREATE_INSTANCE( NotesAppletImpl ) | ||
51 | } | ||
52 | |||
53 | |||
diff --git a/noncore/applets/notesapplet/notesappletimpl.h b/noncore/applets/notesapplet/notesappletimpl.h deleted file mode 100644 index a87118c..0000000 --- a/noncore/applets/notesapplet/notesappletimpl.h +++ b/dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> | ||
3 | ** | ||
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 | ** | ||
11 | **********************************************************************/ | ||
12 | #ifndef NOTESAPPLETIMPL_H | ||
13 | #define NOTESAPPLETIMPL_H | ||
14 | |||
15 | #include <qpe/taskbarappletinterface.h> | ||
16 | |||
17 | class NotesApplet; | ||
18 | |||
19 | class NotesAppletImpl : public TaskbarAppletInterface | ||
20 | { | ||
21 | public: | ||
22 | NotesAppletImpl(); | ||
23 | virtual ~NotesAppletImpl(); | ||
24 | |||
25 | QRESULT queryInterface( const QUuid&, QUnknownInterface** ); | ||
26 | Q_REFCOUNT | ||
27 | |||
28 | virtual QWidget *applet( QWidget *parent ); | ||
29 | virtual int position() const; | ||
30 | |||
31 | private: | ||
32 | NotesApplet *notes; | ||
33 | }; | ||
34 | |||
35 | #endif | ||
diff --git a/noncore/applets/zkbapplet/.cvsignore b/noncore/applets/zkbapplet/.cvsignore new file mode 100644 index 0000000..0f79c04 --- a/dev/null +++ b/noncore/applets/zkbapplet/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | advancedconfigbase.cpp | ||
3 | advancedconfigbase.h | ||
4 | moc_* | ||
5 | .moc | ||
6 | .obj | ||
diff --git a/noncore/applets/zkbapplet/zkbapplet.cpp b/noncore/applets/zkbapplet/zkbapplet.cpp deleted file mode 100644 index 6c71568..0000000 --- a/noncore/applets/zkbapplet/zkbapplet.cpp +++ b/dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <qlabel.h> | ||
3 | #include <qbutton.h> | ||
4 | #include <qwindowsystem_qws.h> | ||
5 | #include "zkbapplet.h" | ||
6 | #include "zkbwidget.h" | ||
7 | |||
8 | |||
9 | ZkbApplet::ZkbApplet() : app(0){ | ||
10 | } | ||
11 | |||
12 | ZkbApplet::~ZkbApplet() | ||
13 | { | ||
14 | if (app) delete app; | ||
15 | } | ||
16 | |||
17 | QWidget* ZkbApplet::applet(QWidget* parent) { | ||
18 | if (app == 0) { | ||
19 | app = new ZkbWidget(parent); | ||
20 | } | ||
21 | |||
22 | return app; | ||
23 | } | ||
24 | |||
25 | int ZkbApplet::position() const { | ||
26 | return 8; | ||
27 | } | ||
28 | |||
29 | QRESULT ZkbApplet::queryInterface(const QUuid& uuid, QUnknownInterface** iface) { | ||
30 | |||
31 | *iface = 0; | ||
32 | if (uuid == IID_QUnknown) { | ||
33 | *iface = this; | ||
34 | } else if (uuid == IID_TaskbarApplet) { | ||
35 | *iface = this; | ||
36 | } else { | ||
37 | return QS_FALSE; | ||
38 | } | ||
39 | |||
40 | if (*iface) { | ||
41 | (*iface)->addRef(); | ||
42 | } | ||
43 | |||
44 | return QS_OK; | ||
45 | } | ||
46 | |||
47 | Q_EXPORT_INTERFACE() { | ||
48 | Q_CREATE_INSTANCE(ZkbApplet) | ||
49 | } | ||
diff --git a/noncore/applets/zkbapplet/zkbapplet.h b/noncore/applets/zkbapplet/zkbapplet.h deleted file mode 100644 index fcf03b5..0000000 --- a/noncore/applets/zkbapplet/zkbapplet.h +++ b/dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include "qpe/taskbarappletinterface.h" | ||
2 | |||
3 | #ifndef ZKBAPPLET_H | ||
4 | #define ZKBAPPLET_H | ||
5 | |||
6 | class ZkbWidget; | ||
7 | |||
8 | class ZkbApplet : public TaskbarAppletInterface { | ||
9 | public: | ||
10 | ZkbApplet(); | ||
11 | virtual ~ZkbApplet(); | ||
12 | |||
13 | QRESULT queryInterface(const QUuid&, QUnknownInterface**); | ||
14 | Q_REFCOUNT | ||
15 | |||
16 | virtual QWidget* applet(QWidget*); | ||
17 | virtual int position() const; | ||
18 | |||
19 | protected: | ||
20 | ZkbWidget* app; | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/noncore/applets/zkbapplet/zkbapplet.pro b/noncore/applets/zkbapplet/zkbapplet.pro index 22615d0..8cc1b58 100644 --- a/noncore/applets/zkbapplet/zkbapplet.pro +++ b/noncore/applets/zkbapplet/zkbapplet.pro | |||
@@ -1,22 +1,20 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = zkbapplet.h\ | 3 | HEADERS = zkbwidget.h \ |
4 | zkbwidget.h \ | ||
5 | ../../apps/keyz-cfg/zkbcfg.h \ | 4 | ../../apps/keyz-cfg/zkbcfg.h \ |
6 | ../../apps/keyz-cfg/zkbnames.h \ | 5 | ../../apps/keyz-cfg/zkbnames.h \ |
7 | ../../apps/keyz-cfg/zkbxml.h \ | 6 | ../../apps/keyz-cfg/zkbxml.h \ |
8 | ../../apps/keyz-cfg/zkb.h | 7 | ../../apps/keyz-cfg/zkb.h |
9 | SOURCES = zkbapplet.cpp \ | 8 | SOURCES = zkbwidget.cpp \ |
10 | zkbwidget.cpp \ | ||
11 | ../../apps/keyz-cfg/zkbcfg.cpp \ | 9 | ../../apps/keyz-cfg/zkbcfg.cpp \ |
12 | ../../apps/keyz-cfg/zkbnames.cpp \ | 10 | ../../apps/keyz-cfg/zkbnames.cpp \ |
13 | ../../apps/keyz-cfg/zkbxml.cpp \ | 11 | ../../apps/keyz-cfg/zkbxml.cpp \ |
14 | ../../apps/keyz-cfg/zkb.cpp | 12 | ../../apps/keyz-cfg/zkb.cpp |
15 | TARGET = zkbapplet | 13 | TARGET = zkbapplet |
16 | DESTDIR = $(OPIEDIR)/plugins/applets | 14 | DESTDIR = $(OPIEDIR)/plugins/applets |
17 | INCLUDEPATH += $(OPIEDIR)/include ../../apps/keyz-cfg | 15 | INCLUDEPATH += $(OPIEDIR)/include ../../apps/keyz-cfg |
18 | DEPENDPATH += ../$(OPIEDIR)/include | 16 | DEPENDPATH += ../$(OPIEDIR)/include |
19 | VERSION = 0.6.0 | 17 | VERSION = 0.6.0 |
20 | LIBS += -lqpe | 18 | LIBS += -lqpe |
21 | 19 | ||
22 | include ( $(OPIEDIR)/include.pro ) | 20 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/applets/zkbapplet/zkbwidget.cpp b/noncore/applets/zkbapplet/zkbwidget.cpp index 05a76e7..0b5ab78 100644 --- a/noncore/applets/zkbapplet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/zkbwidget.cpp | |||
@@ -1,52 +1,58 @@ | |||
1 | #include <opie2/otaskbarapplet.h> | ||
1 | #include <qpe/qcopenvelope_qws.h> | 2 | #include <qpe/qcopenvelope_qws.h> |
2 | #include <qpe/applnk.h> | 3 | #include <qpe/applnk.h> |
3 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
4 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
5 | #include <stdio.h> | 6 | #include <stdio.h> |
6 | #include <unistd.h> | 7 | #include <unistd.h> |
7 | #include "zkbwidget.h" | 8 | #include "zkbwidget.h" |
8 | #include "zkbcfg.h" | 9 | #include "zkbcfg.h" |
9 | 10 | ||
10 | ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), | 11 | ZkbWidget::ZkbWidget(QWidget* parent):QLabel(parent),keymap(0), |
11 | disabled(Resource::loadPixmap("zkb-disabled")) { | 12 | disabled(Resource::loadPixmap("zkb-disabled")) { |
12 | 13 | ||
13 | labels = new QPopupMenu(); | 14 | labels = new QPopupMenu(); |
14 | connect(labels, SIGNAL(activated(int)), this, | 15 | connect(labels, SIGNAL(activated(int)), this, |
15 | SLOT(labelChanged(int))); | 16 | SLOT(labelChanged(int))); |
16 | 17 | ||
17 | loadKeymap(); | 18 | loadKeymap(); |
18 | 19 | ||
19 | channel = new QCopChannel("QPE/zkb", this); | 20 | channel = new QCopChannel("QPE/zkb", this); |
20 | connect(channel, SIGNAL(received(const QCString&, const QByteArray&)), | 21 | connect(channel, SIGNAL(received(const QCString&, const QByteArray&)), |
21 | this, SLOT(signalReceived(const QCString&, const QByteArray&))); | 22 | this, SLOT(signalReceived(const QCString&, const QByteArray&))); |
22 | setFixedWidth ( AppLnk::smallIconSize() ); | 23 | setFixedWidth ( AppLnk::smallIconSize() ); |
23 | setFixedHeight ( AppLnk::smallIconSize() ); | 24 | setFixedHeight ( AppLnk::smallIconSize() ); |
24 | } | 25 | } |
25 | 26 | ||
26 | ZkbWidget::~ZkbWidget() { | 27 | ZkbWidget::~ZkbWidget() { |
27 | } | 28 | } |
28 | 29 | ||
30 | int ZkbWidget::position() | ||
31 | { | ||
32 | return 8; | ||
33 | } | ||
34 | |||
29 | bool ZkbWidget::loadKeymap() { | 35 | bool ZkbWidget::loadKeymap() { |
30 | ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); | 36 | ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); |
31 | QFontMetrics fm(font()); | 37 | QFontMetrics fm(font()); |
32 | 38 | ||
33 | if (keymap != 0) { | 39 | if (keymap != 0) { |
34 | delete keymap; | 40 | delete keymap; |
35 | keymap = 0; | 41 | keymap = 0; |
36 | } | 42 | } |
37 | 43 | ||
38 | Keymap* km = new Keymap(); | 44 | Keymap* km = new Keymap(); |
39 | 45 | ||
40 | if (!c.load("zkb.xml", *km, "")) { | 46 | if (!c.load("zkb.xml", *km, "")) { |
41 | delete km; | 47 | delete km; |
42 | setPixmap(disabled); | 48 | setPixmap(disabled); |
43 | return false; | 49 | return false; |
44 | } | 50 | } |
45 | 51 | ||
46 | connect(km, SIGNAL(stateChanged(const QString&)), | 52 | connect(km, SIGNAL(stateChanged(const QString&)), |
47 | this, SLOT(stateChanged(const QString&))); | 53 | this, SLOT(stateChanged(const QString&))); |
48 | 54 | ||
49 | qwsServer->setKeyboardFilter(km); | 55 | qwsServer->setKeyboardFilter(km); |
50 | 56 | ||
51 | Keymap* oldkm = keymap; | 57 | Keymap* oldkm = keymap; |
52 | keymap = km; | 58 | keymap = km; |
@@ -127,24 +133,30 @@ void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) { | |||
127 | } else if (msg == "reload()") { | 133 | } else if (msg == "reload()") { |
128 | QCopEnvelope("QPE/System", "busy()"); | 134 | QCopEnvelope("QPE/System", "busy()"); |
129 | QTimer::singleShot(0, this, SLOT(reload())); | 135 | QTimer::singleShot(0, this, SLOT(reload())); |
130 | } else if (msg == "switch(QString)") { | 136 | } else if (msg == "switch(QString)") { |
131 | QString lbl; | 137 | QString lbl; |
132 | stream >> lbl; | 138 | stream >> lbl; |
133 | 139 | ||
134 | if (keymap != 0) { | 140 | if (keymap != 0) { |
135 | State* state = keymap->getStateByLabel(lbl); | 141 | State* state = keymap->getStateByLabel(lbl); |
136 | if (state != 0) { | 142 | if (state != 0) { |
137 | keymap->setCurrentState(state); | 143 | keymap->setCurrentState(state); |
138 | setText(lbl); | 144 | setText(lbl); |
139 | } | 145 | } |
140 | } | 146 | } |
141 | } else if (msg == "debug(QString)") { | 147 | } else if (msg == "debug(QString)") { |
142 | QString flag; | 148 | QString flag; |
143 | stream >> flag; | 149 | stream >> flag; |
144 | } | 150 | } |
145 | } | 151 | } |
146 | 152 | ||
147 | void ZkbWidget::reload() { | 153 | void ZkbWidget::reload() { |
148 | loadKeymap(); | 154 | loadKeymap(); |
149 | QCopEnvelope("QPE/System", "notBusy()"); | 155 | QCopEnvelope("QPE/System", "notBusy()"); |
150 | } | 156 | } |
157 | |||
158 | Q_EXPORT_INTERFACE() | ||
159 | { | ||
160 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ZkbWidget> ); | ||
161 | } | ||
162 | |||
diff --git a/noncore/applets/zkbapplet/zkbwidget.h b/noncore/applets/zkbapplet/zkbwidget.h index a943563..7c67794 100644 --- a/noncore/applets/zkbapplet/zkbwidget.h +++ b/noncore/applets/zkbapplet/zkbwidget.h | |||
@@ -1,38 +1,39 @@ | |||
1 | #ifndef ZKBWIDGET_H | 1 | #ifndef ZKBWIDGET_H |
2 | #define ZKBWIDGET_H | 2 | #define ZKBWIDGET_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qcopchannel_qws.h> | 8 | #include <qcopchannel_qws.h> |
9 | 9 | ||
10 | #include "zkb.h" | 10 | #include "zkb.h" |
11 | 11 | ||
12 | class ZkbWidget : public QLabel { | 12 | class ZkbWidget : public QLabel { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | ZkbWidget(QWidget* parent); | 16 | ZkbWidget(QWidget* parent); |
17 | ~ZkbWidget(); | 17 | ~ZkbWidget(); |
18 | static int position(); | ||
18 | 19 | ||
19 | QSize sizeHint() const; | 20 | QSize sizeHint() const; |
20 | 21 | ||
21 | protected: | 22 | protected: |
22 | QLabel* label; | 23 | QLabel* label; |
23 | Keymap* keymap; | 24 | Keymap* keymap; |
24 | QPopupMenu* labels; | 25 | QPopupMenu* labels; |
25 | QCopChannel* channel; | 26 | QCopChannel* channel; |
26 | int w, h; | 27 | int w, h; |
27 | QPixmap disabled; | 28 | QPixmap disabled; |
28 | 29 | ||
29 | bool loadKeymap(); | 30 | bool loadKeymap(); |
30 | void mouseReleaseEvent(QMouseEvent*); | 31 | void mouseReleaseEvent(QMouseEvent*); |
31 | 32 | ||
32 | protected slots: | 33 | protected slots: |
33 | void stateChanged(const QString&); | 34 | void stateChanged(const QString&); |
34 | void labelChanged(int id); | 35 | void labelChanged(int id); |
35 | void signalReceived(const QCString& msg, const QByteArray& data); | 36 | void signalReceived(const QCString& msg, const QByteArray& data); |
36 | void reload(); | 37 | void reload(); |
37 | }; | 38 | }; |
38 | #endif | 39 | #endif |