summaryrefslogtreecommitdiff
path: root/core/applets
Unidiff
Diffstat (limited to 'core/applets') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/.cvsignore3
-rw-r--r--core/applets/batteryapplet/Makefile.in122
-rw-r--r--core/applets/batteryapplet/battery.cpp152
-rw-r--r--core/applets/batteryapplet/battery.h55
-rw-r--r--core/applets/batteryapplet/batteryapplet.pro12
-rw-r--r--core/applets/batteryapplet/batteryappletimpl.cpp63
-rw-r--r--core/applets/batteryapplet/batteryappletimpl.h44
-rw-r--r--core/applets/batteryapplet/batterystatus.cpp140
-rw-r--r--core/applets/batteryapplet/batterystatus.h45
-rw-r--r--core/applets/batteryapplet/qpe-batteryapplet.control9
-rwxr-xr-xcore/applets/batteryapplet/qpe-batteryapplet.postinst2
-rwxr-xr-xcore/applets/batteryapplet/qpe-batteryapplet.postrm2
-rw-r--r--core/applets/clipboardapplet/Makefile.in115
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp80
-rw-r--r--core/applets/clipboardapplet/clipboard.h47
-rw-r--r--core/applets/clipboardapplet/clipboardapplet.pro10
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.cpp64
-rw-r--r--core/applets/clipboardapplet/clipboardappletimpl.h44
-rw-r--r--core/applets/clipboardapplet/qpe-clipboardapplet.control9
-rw-r--r--core/applets/clipboardapplet/qpe-clipboardapplet.postinst2
-rw-r--r--core/applets/clipboardapplet/qpe-clipboardapplet.postrm2
-rw-r--r--core/applets/clockapplet/.cvsignore3
-rw-r--r--core/applets/clockapplet/Makefile.in115
-rw-r--r--core/applets/clockapplet/clock.cpp97
-rw-r--r--core/applets/clockapplet/clock.h46
-rw-r--r--core/applets/clockapplet/clockapplet.pro12
-rw-r--r--core/applets/clockapplet/clockappletimpl.cpp65
-rw-r--r--core/applets/clockapplet/clockappletimpl.h46
-rw-r--r--core/applets/clockapplet/qpe-clockapplet.control9
-rwxr-xr-xcore/applets/clockapplet/qpe-clockapplet.postinst2
-rwxr-xr-xcore/applets/clockapplet/qpe-clockapplet.postrm2
-rw-r--r--core/applets/volumeapplet/.cvsignore3
-rw-r--r--core/applets/volumeapplet/Makefile.in115
-rw-r--r--core/applets/volumeapplet/qpe-volumeapplet.control9
-rwxr-xr-xcore/applets/volumeapplet/qpe-volumeapplet.postinst2
-rwxr-xr-xcore/applets/volumeapplet/qpe-volumeapplet.postrm2
-rw-r--r--core/applets/volumeapplet/volume.cpp199
-rw-r--r--core/applets/volumeapplet/volume.h75
-rw-r--r--core/applets/volumeapplet/volumeapplet.pro12
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.cpp64
-rw-r--r--core/applets/volumeapplet/volumeappletimpl.h44
41 files changed, 1944 insertions, 0 deletions
diff --git a/core/applets/batteryapplet/.cvsignore b/core/applets/batteryapplet/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/core/applets/batteryapplet/.cvsignore
@@ -0,0 +1,3 @@
1moc_*
2*.moc
3Makefile
diff --git a/core/applets/batteryapplet/Makefile.in b/core/applets/batteryapplet/Makefile.in
new file mode 100644
index 0000000..0493fd6
--- a/dev/null
+++ b/core/applets/batteryapplet/Makefile.in
@@ -0,0 +1,122 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../../plugins/applets/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= batteryapplet
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =battery.h \
27 batterystatus.h \
28 batteryappletimpl.h
29 SOURCES =battery.cpp \
30 batterystatus.cpp \
31 batteryappletimpl.cpp
32 OBJECTS =battery.o \
33 batterystatus.o \
34 batteryappletimpl.o
35INTERFACES =
36UICDECLS =
37UICIMPLS =
38 SRCMOC =moc_battery.cpp
39 OBJMOC =moc_battery.o
40
41
42####### Implicit rules
43
44.SUFFIXES: .cpp .cxx .cc .C .c
45
46.cpp.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.cxx.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.cc.o:
53 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
54
55.C.o:
56 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
57
58.c.o:
59 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
60
61####### Build rules
62
63
64all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
65
66$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
67 $(SYSCONF_LINK_LIB)
68
69moc: $(SRCMOC)
70
71tmake:
72 tmake batteryapplet.pro
73
74clean:
75 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
76 -rm -f *~ core
77 -rm -f allmoc.cpp
78
79####### Extension Modules
80
81listpromodules:
82 @echo
83
84listallmodules:
85 @echo
86
87listaddonpromodules:
88 @echo
89
90listaddonentmodules:
91 @echo
92
93
94REQUIRES=
95
96####### Sub-libraries
97
98
99###### Combined headers
100
101
102
103####### Compile
104
105battery.o: battery.cpp \
106 battery.h \
107 batterystatus.h
108
109batterystatus.o: batterystatus.cpp \
110 batterystatus.h
111
112batteryappletimpl.o: batteryappletimpl.cpp \
113 battery.h \
114 batteryappletimpl.h
115
116moc_battery.o: moc_battery.cpp \
117 battery.h
118
119moc_battery.cpp: battery.h
120 $(MOC) battery.h -o moc_battery.cpp
121
122
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
new file mode 100644
index 0000000..3d254fc
--- a/dev/null
+++ b/core/applets/batteryapplet/battery.cpp
@@ -0,0 +1,152 @@
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 "battery.h"
21#include "batterystatus.h"
22
23#include <qpe/power.h>
24
25#include <qpainter.h>
26#include <qtimer.h>
27
28
29BatteryMeter::BatteryMeter( QWidget *parent = 0 )
30 : QWidget( parent ), charging(false)
31{
32 ps = new PowerStatus;
33 startTimer( 10000 );
34 setFixedHeight(12);
35 chargeTimer = new QTimer( this );
36 connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) );
37 timerEvent(0);
38}
39
40BatteryMeter::~BatteryMeter()
41{
42 delete ps;
43}
44
45QSize BatteryMeter::sizeHint() const
46{
47 return QSize(10,12);
48}
49
50void BatteryMeter::mouseReleaseEvent( QMouseEvent *)
51{
52 if ( batteryView && batteryView->isVisible() ) {
53 delete (QWidget *) batteryView;
54 } else {
55 if ( !batteryView )
56 batteryView = new BatteryStatus( ps );
57 batteryView->showMaximized();
58 batteryView->raise();
59 batteryView->show();
60 }
61}
62
63void BatteryMeter::timerEvent( QTimerEvent * )
64{
65 PowerStatus prev = *ps;
66
67 *ps = PowerStatusManager::readStatus();
68
69 if ( prev != *ps ) {
70 percent = ps->batteryPercentRemaining();
71 if ( !charging && ps->batteryStatus() == PowerStatus::Charging && percent < 0 ) {
72 percent = 0;
73 charging = true;
74 chargeTimer->start( 500 );
75 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) {
76 charging = false;
77 chargeTimer->stop();
78 if ( batteryView )
79 batteryView->updatePercent( percent );
80 }
81 repaint(FALSE);
82 if ( batteryView )
83 batteryView->repaint();
84 }
85}
86
87void BatteryMeter::chargeTimeout()
88{
89 percent += 20;
90 if ( percent > 100 )
91 percent = 0;
92
93 repaint(FALSE);
94 if ( batteryView )
95 batteryView->updatePercent( percent );
96}
97
98void BatteryMeter::paintEvent( QPaintEvent* )
99{
100 QPainter p(this);
101
102 QColor c;
103 QColor darkc;
104 QColor lightc;
105 if ( ps->acStatus() == PowerStatus::Offline ) {
106 c = blue.light(120);
107 darkc = c.dark(120);
108 lightc = c.light(140);
109 } else if ( ps->acStatus() == PowerStatus::Online ) {
110 c = green.dark(130);
111 darkc = c.dark(120);
112 lightc = c.light(180);
113 } else {
114 c = red;
115 darkc = c.dark(120);
116 lightc = c.light(160);
117 }
118
119 int w = 6;
120 int h = height()-3;
121 int pix = (percent * h) / 100;
122 int y2 = height() - 2;
123 int y = y2 - pix;
124 int x1 = (width() - w) / 2;
125
126 p.setPen(QColor(80,80,80));
127 p.drawLine(x1+w/4,0,x1+w/4+w/2,0);
128 p.drawRect(x1,1,w,height()-1);
129 p.setBrush(c);
130
131 int extra = ((percent * h) % 100)/(100/4);
132
133#define Y(i) ((i<=extra)?y-1:y)
134#define DRAWUPPER(i) if ( Y(i) >= 2 ) p.drawLine(i+x1,2,i+x1,Y(i));
135 p.setPen( gray );
136 DRAWUPPER(1);
137 DRAWUPPER(3);
138 p.setPen( gray.light(130) );
139 DRAWUPPER(2);
140 p.setPen( gray.dark(120) );
141 DRAWUPPER(4);
142
143#define DRAW(i) { if ( Y(i) < y2 ) p.drawLine(i+x1,Y(i)+1,i+x1,y2); }
144 p.setPen( c );
145 DRAW(1);
146 DRAW(3);
147 p.setPen( lightc );
148 DRAW(2);
149 p.setPen(darkc);
150 DRAW(4);
151}
152
diff --git a/core/applets/batteryapplet/battery.h b/core/applets/batteryapplet/battery.h
new file mode 100644
index 0000000..d4807b0
--- a/dev/null
+++ b/core/applets/batteryapplet/battery.h
@@ -0,0 +1,55 @@
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 BATTERY_H
21#define BATTERY_H
22
23#include <qwidget.h>
24#include <qguardedptr.h>
25
26class PowerStatus;
27class BatteryStatus;
28class QTimer;
29
30class BatteryMeter : public QWidget
31{
32 Q_OBJECT
33public:
34 BatteryMeter( QWidget *parent = 0 );
35 ~BatteryMeter();
36
37 QSize sizeHint() const;
38
39protected:
40 void timerEvent( QTimerEvent * );
41 void paintEvent( QPaintEvent* );
42 void mouseReleaseEvent( QMouseEvent * );
43
44protected slots:
45 void chargeTimeout();
46
47protected:
48 QGuardedPtr<BatteryStatus> batteryView;
49 PowerStatus *ps;
50 QTimer *chargeTimer;
51 int percent;
52 bool charging;
53};
54
55#endif
diff --git a/core/applets/batteryapplet/batteryapplet.pro b/core/applets/batteryapplet/batteryapplet.pro
new file mode 100644
index 0000000..fa0fca8
--- a/dev/null
+++ b/core/applets/batteryapplet/batteryapplet.pro
@@ -0,0 +1,12 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3 HEADERS= battery.h batterystatus.h batteryappletimpl.h
4 SOURCES= battery.cpp batterystatus.cpp batteryappletimpl.cpp
5 TARGET = batteryapplet
6 DESTDIR = ../../plugins/applets
7INCLUDEPATH += $(QPEDIR)/include
8DEPENDPATH += ../$(QPEDIR)/include ..
9LIBS += -lqpe
10 VERSION = 1.0.0
11
12TRANSLATIONS += ../../i18n/de/libbatteryapplet.ts
diff --git a/core/applets/batteryapplet/batteryappletimpl.cpp b/core/applets/batteryapplet/batteryappletimpl.cpp
new file mode 100644
index 0000000..3f3079a
--- a/dev/null
+++ b/core/applets/batteryapplet/batteryappletimpl.cpp
@@ -0,0 +1,63 @@
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 "battery.h"
21#include "batteryappletimpl.h"
22
23
24BatteryAppletImpl::BatteryAppletImpl()
25 : battery(0), ref(0)
26{
27}
28
29BatteryAppletImpl::~BatteryAppletImpl()
30{
31 delete battery;
32}
33
34QWidget *BatteryAppletImpl::applet( QWidget *parent )
35{
36 if ( !battery )
37 battery = new BatteryMeter( parent );
38 return battery;
39}
40
41int BatteryAppletImpl::position() const
42{
43 return 8;
44}
45
46QRESULT BatteryAppletImpl::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
54 if ( *iface )
55 (*iface)->addRef();
56 return QS_OK;
57}
58
59Q_EXPORT_INTERFACE()
60{
61 Q_CREATE_INSTANCE( BatteryAppletImpl )
62}
63
diff --git a/core/applets/batteryapplet/batteryappletimpl.h b/core/applets/batteryapplet/batteryappletimpl.h
new file mode 100644
index 0000000..94f49db
--- a/dev/null
+++ b/core/applets/batteryapplet/batteryappletimpl.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 BATTERYAPPLETIMPL_H
21#define BATTERYAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class BatteryMeter;
26
27class BatteryAppletImpl : public TaskbarAppletInterface
28{
29public:
30 BatteryAppletImpl();
31 virtual ~BatteryAppletImpl();
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 BatteryMeter *battery;
41 ulong ref;
42};
43
44#endif
diff --git a/core/applets/batteryapplet/batterystatus.cpp b/core/applets/batteryapplet/batterystatus.cpp
new file mode 100644
index 0000000..d18b6c9
--- a/dev/null
+++ b/core/applets/batteryapplet/batterystatus.cpp
@@ -0,0 +1,140 @@
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 "batterystatus.h"
21
22#include <qpe/power.h>
23
24#include <qpainter.h>
25#include <qpushbutton.h>
26#include <qdrawutil.h>
27
28
29BatteryStatus::BatteryStatus( const PowerStatus *p, QWidget *parent )
30 : QWidget( parent, 0, WDestructiveClose), ps(p)
31{
32 setCaption( tr("Battery Status") );
33 QPushButton *pb = new QPushButton( tr("Close"), this );
34 pb->move( 70, 220 );
35 pb->show();
36 connect( pb, SIGNAL( clicked() ), this, SLOT( close() ) );
37 percent = ps->batteryPercentRemaining();
38 show();
39}
40
41BatteryStatus::~BatteryStatus()
42{
43}
44
45void BatteryStatus::updatePercent( int pc )
46{
47 percent = pc;
48 repaint(FALSE);
49}
50
51void BatteryStatus::drawSegment( QPainter *p, const QRect &r, const QColor &topgrad, const QColor &botgrad, const QColor &highlight, int hightlight_height )
52{
53 int h1, h2, s1, s2, v1, v2, ng = r.height(), hy = ng*30/100, hh = hightlight_height;
54 topgrad.hsv( &h1, &s1, &v1 );
55 botgrad.hsv( &h2, &s2, &v2 );
56 for ( int j = 0; j < hy-2; j++ ) {
57 p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1),
58 v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) );
59 p->drawLine( r.x(), r.top()+hy-2-j, r.x()+r.width(), r.top()+hy-2-j );
60 }
61 for ( int j = 0; j < hh; j++ ) {
62 p->setPen( highlight );
63 p->drawLine( r.x(), r.top()+hy-2+j, r.x()+r.width(), r.top()+hy-2+j );
64 }
65 for ( int j = 0; j < ng-hy-hh; j++ ) {
66 p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1),
67 v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) );
68 p->drawLine( r.x(), r.top()+hy+hh-2+j, r.x()+r.width(), r.top()+hy+hh-2+j );
69 }
70}
71
72void BatteryStatus::paintEvent( QPaintEvent * )
73{
74 QPainter p(this);
75 QString text;
76 if ( ps->batteryStatus() == PowerStatus::Charging ) {
77 text = tr("Charging");
78 } else if ( ps->batteryPercentAccurate() ) {
79 text.sprintf( tr("Percentage battery remaining") + ": %i%%", percent );
80 } else {
81 text = tr("Battery status: ");
82 switch ( ps->batteryStatus() ) {
83 case PowerStatus::High:
84 text += tr("Good");
85 break;
86 case PowerStatus::Low:
87 text += tr("Low");
88 break;
89 case PowerStatus::VeryLow:
90 text += tr("Very Low");
91 break;
92 case PowerStatus::Critical:
93 text += tr("Critical");
94 break;
95 default: // NotPresent, etc.
96 text += tr("Unknown");
97 }
98 }
99 p.drawText( 10, 120, text );
100 if ( ps->acStatus() == PowerStatus::Backup )
101 p.drawText( 10, 150, tr("On backup power") );
102 else if ( ps->acStatus() == PowerStatus::Online )
103 p.drawText( 10, 150, tr("Power on-line") );
104 else if ( ps->acStatus() == PowerStatus::Offline )
105 p.drawText( 10, 150, tr("External power disconnected") );
106
107 if ( ps->batteryTimeRemaining() >= 0 ) {
108 text.sprintf( tr("Battery time remaining") + ": %im %02is",
109 ps->batteryTimeRemaining() / 60, ps->batteryTimeRemaining() % 60 );
110 p.drawText( 10, 180, text );
111 }
112
113 QColor c;
114 QColor darkc;
115 QColor lightc;
116 if ( ps->acStatus() == PowerStatus::Offline ) {
117 c = blue.light(120);
118 darkc = c.dark(280);
119 lightc = c.light(145);
120 } else if ( ps->acStatus() == PowerStatus::Online ) {
121 c = green.dark(130);
122 darkc = c.dark(200);
123 lightc = c.light(220);
124 } else {
125 c = red;
126 darkc = c.dark(280);
127 lightc = c.light(140);
128 }
129 if ( percent < 0 )
130 return;
131
132 int percent2 = percent * 2;
133 p.setPen( black );
134 qDrawShadePanel( &p, 9, 30, 204, 39, colorGroup(), TRUE, 1, NULL);
135 qDrawShadePanel( &p, 212, 37, 12, 24, colorGroup(), TRUE, 1, NULL);
136 drawSegment( &p, QRect( 10, 30, percent2, 40 ), lightc, darkc, lightc.light(115), 6 );
137 drawSegment( &p, QRect( 11 + percent2, 30, 200 - percent2, 40 ), white.light(80), black, white.light(90), 6 );
138 drawSegment( &p, QRect( 212, 37, 10, 25 ), white.light(80), black, white.light(90), 2 );
139}
140
diff --git a/core/applets/batteryapplet/batterystatus.h b/core/applets/batteryapplet/batterystatus.h
new file mode 100644
index 0000000..85b2c4d
--- a/dev/null
+++ b/core/applets/batteryapplet/batterystatus.h
@@ -0,0 +1,45 @@
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 BATTERY_STATUS_H
21#define BATTERY_STATUS_H
22
23#include <qwidget.h>
24
25class PowerStatus;
26
27class BatteryStatus : public QWidget
28{
29public:
30 BatteryStatus( const PowerStatus *s, QWidget *parent=0 );
31 ~BatteryStatus();
32
33 void updatePercent( int );
34
35protected:
36 void drawSegment( QPainter *p, const QRect &r, const QColor &topgrad, const QColor &botgrad, const QColor &highlight, int hightlight_height );
37 void paintEvent( QPaintEvent *pe );
38
39private:
40 const PowerStatus *ps;
41 int percent;
42};
43
44#endif
45
diff --git a/core/applets/batteryapplet/qpe-batteryapplet.control b/core/applets/batteryapplet/qpe-batteryapplet.control
new file mode 100644
index 0000000..83d0b8b
--- a/dev/null
+++ b/core/applets/batteryapplet/qpe-batteryapplet.control
@@ -0,0 +1,9 @@
1Files: plugins/applets/libbatteryapplet.so*
2Priority: optional
3Section: qpe/taskbar
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qpe-base ($QPE_VERSION)
8Description: Battery Monitor applet
9 Battery Monitor applet for the Qtopia environment taskbar.
diff --git a/core/applets/batteryapplet/qpe-batteryapplet.postinst b/core/applets/batteryapplet/qpe-batteryapplet.postinst
new file mode 100755
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/batteryapplet/qpe-batteryapplet.postinst
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/batteryapplet/qpe-batteryapplet.postrm b/core/applets/batteryapplet/qpe-batteryapplet.postrm
new file mode 100755
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/batteryapplet/qpe-batteryapplet.postrm
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/clipboardapplet/Makefile.in b/core/applets/clipboardapplet/Makefile.in
new file mode 100644
index 0000000..2ddeb42
--- a/dev/null
+++ b/core/applets/clipboardapplet/Makefile.in
@@ -0,0 +1,115 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../../plugins/applets/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= clipboardapplet
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =clipboard.h \
27 clipboardappletimpl.h
28 SOURCES =clipboard.cpp \
29 clipboardappletimpl.cpp
30 OBJECTS =clipboard.o \
31 clipboardappletimpl.o
32INTERFACES =
33UICDECLS =
34UICIMPLS =
35 SRCMOC =moc_clipboard.cpp
36 OBJMOC =moc_clipboard.o
37
38
39####### Implicit rules
40
41.SUFFIXES: .cpp .cxx .cc .C .c
42
43.cpp.o:
44 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
45
46.cxx.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.cc.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.C.o:
53 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
54
55.c.o:
56 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
57
58####### Build rules
59
60
61all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
62
63$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
64 $(SYSCONF_LINK_LIB)
65
66moc: $(SRCMOC)
67
68tmake:
69 tmake clipboardapplet.pro
70
71clean:
72 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
73 -rm -f *~ core
74 -rm -f allmoc.cpp
75
76####### Extension Modules
77
78listpromodules:
79 @echo
80
81listallmodules:
82 @echo
83
84listaddonpromodules:
85 @echo
86
87listaddonentmodules:
88 @echo
89
90
91REQUIRES=
92
93####### Sub-libraries
94
95
96###### Combined headers
97
98
99
100####### Compile
101
102clipboard.o: clipboard.cpp \
103 clipboard.h
104
105clipboardappletimpl.o: clipboardappletimpl.cpp \
106 clipboard.h \
107 clipboardappletimpl.h
108
109moc_clipboard.o: moc_clipboard.cpp \
110 clipboard.h
111
112moc_clipboard.cpp: clipboard.h
113 $(MOC) clipboard.h -o moc_clipboard.cpp
114
115
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
new file mode 100644
index 0000000..57beffc
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -0,0 +1,80 @@
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
21#include "clipboard.h"
22
23#include <qpe/resource.h>
24
25#include <qpainter.h>
26#include <qpopupmenu.h>
27#include <qwindowsystem_qws.h>
28
29
30//===========================================================================
31
32ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name )
33 : QWidget( parent, name )
34{
35 setFixedWidth( 14 );
36 clipboardPixmap = Resource::loadPixmap( "clipboard" );
37 menu = 0;
38}
39
40ClipboardApplet::~ClipboardApplet()
41{
42}
43
44void ClipboardApplet::mousePressEvent( QMouseEvent *)
45{
46 if ( !menu ) {
47 menu = new QPopupMenu(this);
48 menu->insertItem(tr("Cut"));
49 menu->insertItem(tr("Copy"));
50 menu->insertItem(tr("Paste"));
51 connect(menu, SIGNAL(selected(int)), this, SLOT(action(int)));
52 }
53 menu->popup(mapToGlobal(QPoint(0,0)));
54}
55
56void ClipboardApplet::action(int i)
57{
58 ushort unicode=0;
59 int scan=0;
60
61 if ( i == 0 )
62 { unicode='X'-'@'; scan=Key_X; } // Cut
63 else if ( i == 1 )
64 { unicode='C'-'@'; scan=Key_C; } // Copy
65 else if ( i == 2 )
66 { unicode='V'-'@'; scan=Key_V; } // Paste
67
68 if ( scan ) {
69 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
70 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
71 }
72}
73
74void ClipboardApplet::paintEvent( QPaintEvent* )
75{
76 QPainter p(this);
77 p.drawPixmap( 0, 1, clipboardPixmap );
78}
79
80
diff --git a/core/applets/clipboardapplet/clipboard.h b/core/applets/clipboardapplet/clipboard.h
new file mode 100644
index 0000000..9dd59ed
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboard.h
@@ -0,0 +1,47 @@
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 __CLIPBOARD_APPLET_H__
21#define __CLIPBOARD_APPLET_H__
22
23#include <qwidget.h>
24#include <qpixmap.h>
25
26class ClipboardApplet : public QWidget
27{
28 Q_OBJECT
29public:
30 ClipboardApplet( QWidget *parent = 0, const char *name=0 );
31 ~ClipboardApplet();
32
33protected:
34 void mousePressEvent( QMouseEvent *);
35 void paintEvent( QPaintEvent* );
36
37private slots:
38 void action(int);
39
40private:
41 QPopupMenu* menu;
42 QPixmap clipboardPixmap;
43};
44
45
46#endif // __CLIPBOARD_APPLET_H__
47
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro
new file mode 100644
index 0000000..b0624ef
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboardapplet.pro
@@ -0,0 +1,10 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3 HEADERS= clipboard.h clipboardappletimpl.h
4 SOURCES= clipboard.cpp clipboardappletimpl.cpp
5 TARGET = clipboardapplet
6 DESTDIR = ../../plugins/applets
7INCLUDEPATH += $(QPEDIR)/include
8DEPENDPATH += ../$(QPEDIR)/include
9LIBS += -lqpe
10 VERSION = 1.0.0
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.cpp b/core/applets/clipboardapplet/clipboardappletimpl.cpp
new file mode 100644
index 0000000..8080690
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboardappletimpl.cpp
@@ -0,0 +1,64 @@
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 "clipboard.h"
21#include "clipboardappletimpl.h"
22
23
24ClipboardAppletImpl::ClipboardAppletImpl()
25 : clipboard(0), ref(0)
26{
27}
28
29ClipboardAppletImpl::~ClipboardAppletImpl()
30{
31 delete clipboard;
32}
33
34QWidget *ClipboardAppletImpl::applet( QWidget *parent )
35{
36 if ( !clipboard )
37 clipboard = new ClipboardApplet( parent );
38 return clipboard;
39}
40
41int ClipboardAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT ClipboardAppletImpl::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
54 if ( *iface )
55 (*iface)->addRef();
56 return QS_OK;
57}
58
59Q_EXPORT_INTERFACE()
60{
61 Q_CREATE_INSTANCE( ClipboardAppletImpl )
62}
63
64
diff --git a/core/applets/clipboardapplet/clipboardappletimpl.h b/core/applets/clipboardapplet/clipboardappletimpl.h
new file mode 100644
index 0000000..0426109
--- a/dev/null
+++ b/core/applets/clipboardapplet/clipboardappletimpl.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 CLIPBOARDAPPLETIMPL_H
21#define CLIPBOARDAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class ClipboardApplet;
26
27class ClipboardAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ClipboardAppletImpl();
31 virtual ~ClipboardAppletImpl();
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 ClipboardApplet *clipboard;
41 ulong ref;
42};
43
44#endif
diff --git a/core/applets/clipboardapplet/qpe-clipboardapplet.control b/core/applets/clipboardapplet/qpe-clipboardapplet.control
new file mode 100644
index 0000000..26cbc55
--- a/dev/null
+++ b/core/applets/clipboardapplet/qpe-clipboardapplet.control
@@ -0,0 +1,9 @@
1Files: plugins/applets/libclipboardapplet.so*
2Priority: optional
3Section: qpe/taskbar
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qpe-base ($QPE_VERSION)
8Description: Clipboard applet
9 Clipboard applet for the Qtopia environment taskbar.
diff --git a/core/applets/clipboardapplet/qpe-clipboardapplet.postinst b/core/applets/clipboardapplet/qpe-clipboardapplet.postinst
new file mode 100644
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/clipboardapplet/qpe-clipboardapplet.postinst
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/clipboardapplet/qpe-clipboardapplet.postrm b/core/applets/clipboardapplet/qpe-clipboardapplet.postrm
new file mode 100644
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/clipboardapplet/qpe-clipboardapplet.postrm
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/clockapplet/.cvsignore b/core/applets/clockapplet/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/core/applets/clockapplet/.cvsignore
@@ -0,0 +1,3 @@
1moc_*
2*.moc
3Makefile
diff --git a/core/applets/clockapplet/Makefile.in b/core/applets/clockapplet/Makefile.in
new file mode 100644
index 0000000..fcf737e
--- a/dev/null
+++ b/core/applets/clockapplet/Makefile.in
@@ -0,0 +1,115 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../../plugins/applets/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= clockapplet
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =clock.h \
27 clockappletimpl.h
28 SOURCES =clock.cpp \
29 clockappletimpl.cpp
30 OBJECTS =clock.o \
31 clockappletimpl.o
32INTERFACES =
33UICDECLS =
34UICIMPLS =
35 SRCMOC =moc_clock.cpp
36 OBJMOC =moc_clock.o
37
38
39####### Implicit rules
40
41.SUFFIXES: .cpp .cxx .cc .C .c
42
43.cpp.o:
44 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
45
46.cxx.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.cc.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.C.o:
53 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
54
55.c.o:
56 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
57
58####### Build rules
59
60
61all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
62
63$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
64 $(SYSCONF_LINK_LIB)
65
66moc: $(SRCMOC)
67
68tmake:
69 tmake clockapplet.pro
70
71clean:
72 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
73 -rm -f *~ core
74 -rm -f allmoc.cpp
75
76####### Extension Modules
77
78listpromodules:
79 @echo
80
81listallmodules:
82 @echo
83
84listaddonpromodules:
85 @echo
86
87listaddonentmodules:
88 @echo
89
90
91REQUIRES=
92
93####### Sub-libraries
94
95
96###### Combined headers
97
98
99
100####### Compile
101
102clock.o: clock.cpp \
103 clock.h
104
105clockappletimpl.o: clockappletimpl.cpp \
106 clock.h \
107 clockappletimpl.h
108
109moc_clock.o: moc_clock.cpp \
110 clock.h
111
112moc_clock.cpp: clock.h
113 $(MOC) clock.h -o moc_clock.cpp
114
115
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp
new file mode 100644
index 0000000..178dcbe
--- a/dev/null
+++ b/core/applets/clockapplet/clock.cpp
@@ -0,0 +1,97 @@
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
21#include "clock.h"
22
23#include <qpe/global.h>
24#include <qpe/qpeapplication.h>
25#include <qpe/config.h>
26
27#include <qmainwindow.h>
28#include <qlayout.h>
29#include <qpushbutton.h>
30#include <qmessagebox.h>
31#include <qdatetime.h>
32#include <qtimer.h>
33#include <qpopupmenu.h>
34#include <stdlib.h>
35
36
37LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent )
38{
39 // If you want a sunken border around the clock do this:
40 // setFrameStyle( QFrame::Panel | QFrame::Sunken );
41 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
42 connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime( ) ) );
43 connect( qApp, SIGNAL( clockChanged( bool ) ),
44 this, SLOT( slotClockChanged( bool ) ) );
45 Config config( "qpe" );
46 config.setGroup( "Time" );
47 ampmFormat = config.readBoolEntry( "AMPM", TRUE );
48 timerId = 0;
49 timerEvent( 0 );
50 show();
51}
52
53void LauncherClock::mouseReleaseEvent( QMouseEvent * )
54{
55 Global::execute( "systemtime" );
56}
57
58
59void LauncherClock::timerEvent( QTimerEvent *e )
60{
61 if ( !e || e->timerId() == timerId ) {
62 killTimer( timerId );
63 changeTime();
64 QTime t = QTime::currentTime();
65 int ms = (60 - t.second())*1000 - t.msec();
66 timerId = startTimer( ms );
67 } else {
68 QLabel::timerEvent( e );
69 }
70}
71
72void LauncherClock::updateTime( void )
73{
74 changeTime();
75}
76
77void LauncherClock::changeTime( void )
78{
79 QTime tm = QDateTime::currentDateTime().time();
80 QString s;
81 if( ampmFormat ) {
82 int hour = tm.hour();
83 if (hour == 0)
84 hour = 12;
85 if (hour > 12)
86 hour -= 12;
87 s.sprintf( "%2d%c%02d %s", hour, ':', tm.minute(), (tm.hour() >= 12) ? "PM" : "AM" );
88 } else
89 s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() );
90 setText( s );
91}
92
93void LauncherClock::slotClockChanged( bool pm )
94{
95 ampmFormat = pm;
96 updateTime();
97}
diff --git a/core/applets/clockapplet/clock.h b/core/applets/clockapplet/clock.h
new file mode 100644
index 0000000..9670d90
--- a/dev/null
+++ b/core/applets/clockapplet/clock.h
@@ -0,0 +1,46 @@
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 __LAUNCHER_CLOCK_H__
21#define __LAUNCHER_CLOCK_H__
22
23
24#include <qlabel.h>
25#include <qdatetime.h>
26
27class LauncherClock : public QLabel
28{
29 Q_OBJECT
30public:
31 LauncherClock( QWidget *parent );
32
33protected slots:
34 void updateTime( void );
35 void slotClockChanged( bool pm );
36
37protected:
38 void mouseReleaseEvent( QMouseEvent * );
39 void timerEvent( QTimerEvent * );
40 void changeTime( void );
41 bool ampmFormat;
42 int timerId;
43};
44
45
46#endif // __LAUNCHER_CLOCK_H__
diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro
new file mode 100644
index 0000000..29a4e8b
--- a/dev/null
+++ b/core/applets/clockapplet/clockapplet.pro
@@ -0,0 +1,12 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3 HEADERS= clock.h clockappletimpl.h
4 SOURCES= clock.cpp clockappletimpl.cpp
5 TARGET = clockapplet
6 DESTDIR = ../../plugins/applets
7INCLUDEPATH += $(QPEDIR)/include
8DEPENDPATH += ../$(QPEDIR)/include ..
9LIBS += -lqpe
10 VERSION = 1.0.0
11
12TRANSLATIONS += ../../i18n/de/libclockapplet.ts
diff --git a/core/applets/clockapplet/clockappletimpl.cpp b/core/applets/clockapplet/clockappletimpl.cpp
new file mode 100644
index 0000000..8bf1baf
--- a/dev/null
+++ b/core/applets/clockapplet/clockappletimpl.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 "clock.h"
21#include "clockappletimpl.h"
22
23
24ClockAppletImpl::ClockAppletImpl()
25 : clock(0), ref(0)
26{
27}
28
29ClockAppletImpl::~ClockAppletImpl()
30{
31 delete clock;
32}
33
34QWidget *ClockAppletImpl::applet( QWidget *parent )
35{
36 if ( !clock )
37 clock = new LauncherClock( parent );
38 return clock;
39}
40
41int ClockAppletImpl::position() const
42{
43 return 10;
44}
45
46#ifndef QT_NO_COMPONENT
47QRESULT ClockAppletImpl::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
60Q_EXPORT_INTERFACE()
61{
62 Q_CREATE_INSTANCE( ClockAppletImpl )
63}
64#endif
65
diff --git a/core/applets/clockapplet/clockappletimpl.h b/core/applets/clockapplet/clockappletimpl.h
new file mode 100644
index 0000000..0c0912e
--- a/dev/null
+++ b/core/applets/clockapplet/clockappletimpl.h
@@ -0,0 +1,46 @@
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 CLOCKAPPLETIMPL_H
21#define CLOCKAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class LauncherClock;
26
27class ClockAppletImpl : public TaskbarAppletInterface
28{
29public:
30 ClockAppletImpl();
31 virtual ~ClockAppletImpl();
32
33#ifndef QT_NO_COMPONENT
34 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
35 Q_REFCOUNT
36#endif
37
38 virtual QWidget *applet( QWidget *parent );
39 virtual int position() const;
40
41private:
42 LauncherClock *clock;
43 ulong ref;
44};
45
46#endif
diff --git a/core/applets/clockapplet/qpe-clockapplet.control b/core/applets/clockapplet/qpe-clockapplet.control
new file mode 100644
index 0000000..9532ca8
--- a/dev/null
+++ b/core/applets/clockapplet/qpe-clockapplet.control
@@ -0,0 +1,9 @@
1Files: plugins/applets/libclockapplet.so*
2Priority: optional
3Section: qpe/taskbar
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qpe-base ($QPE_VERSION)
8Description: Clock applet
9 Clock applet for the Qtopia environment taskbar.
diff --git a/core/applets/clockapplet/qpe-clockapplet.postinst b/core/applets/clockapplet/qpe-clockapplet.postinst
new file mode 100755
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/clockapplet/qpe-clockapplet.postinst
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/clockapplet/qpe-clockapplet.postrm b/core/applets/clockapplet/qpe-clockapplet.postrm
new file mode 100755
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/clockapplet/qpe-clockapplet.postrm
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/volumeapplet/.cvsignore b/core/applets/volumeapplet/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/core/applets/volumeapplet/.cvsignore
@@ -0,0 +1,3 @@
1moc_*
2*.moc
3Makefile
diff --git a/core/applets/volumeapplet/Makefile.in b/core/applets/volumeapplet/Makefile.in
new file mode 100644
index 0000000..7020cb7
--- a/dev/null
+++ b/core/applets/volumeapplet/Makefile.in
@@ -0,0 +1,115 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../../plugins/applets/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= volumeapplet
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =volume.h \
27 volumeappletimpl.h
28 SOURCES =volume.cpp \
29 volumeappletimpl.cpp
30 OBJECTS =volume.o \
31 volumeappletimpl.o
32INTERFACES =
33UICDECLS =
34UICIMPLS =
35 SRCMOC =moc_volume.cpp
36 OBJMOC =moc_volume.o
37
38
39####### Implicit rules
40
41.SUFFIXES: .cpp .cxx .cc .C .c
42
43.cpp.o:
44 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
45
46.cxx.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.cc.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.C.o:
53 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
54
55.c.o:
56 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
57
58####### Build rules
59
60
61all: $(DESTDIR)$(SYSCONF_LINK_TARGET)
62
63$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
64 $(SYSCONF_LINK_LIB)
65
66moc: $(SRCMOC)
67
68tmake:
69 tmake volumeapplet.pro
70
71clean:
72 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
73 -rm -f *~ core
74 -rm -f allmoc.cpp
75
76####### Extension Modules
77
78listpromodules:
79 @echo
80
81listallmodules:
82 @echo
83
84listaddonpromodules:
85 @echo
86
87listaddonentmodules:
88 @echo
89
90
91REQUIRES=
92
93####### Sub-libraries
94
95
96###### Combined headers
97
98
99
100####### Compile
101
102volume.o: volume.cpp \
103 volume.h
104
105volumeappletimpl.o: volumeappletimpl.cpp \
106 volume.h \
107 volumeappletimpl.h
108
109moc_volume.o: moc_volume.cpp \
110 volume.h
111
112moc_volume.cpp: volume.h
113 $(MOC) volume.h -o moc_volume.cpp
114
115
diff --git a/core/applets/volumeapplet/qpe-volumeapplet.control b/core/applets/volumeapplet/qpe-volumeapplet.control
new file mode 100644
index 0000000..a80262a
--- a/dev/null
+++ b/core/applets/volumeapplet/qpe-volumeapplet.control
@@ -0,0 +1,9 @@
1Files: plugins/applets/libvolumeapplet.so*
2Priority: optional
3Section: qpe/taskbar
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qpe-base ($QPE_VERSION)
8Description: Volume applet
9 Volume applet for the Qtopia environment taskbar.
diff --git a/core/applets/volumeapplet/qpe-volumeapplet.postinst b/core/applets/volumeapplet/qpe-volumeapplet.postinst
new file mode 100755
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/volumeapplet/qpe-volumeapplet.postinst
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/volumeapplet/qpe-volumeapplet.postrm b/core/applets/volumeapplet/qpe-volumeapplet.postrm
new file mode 100755
index 0000000..ba76ffa
--- a/dev/null
+++ b/core/applets/volumeapplet/qpe-volumeapplet.postrm
@@ -0,0 +1,2 @@
1#!/bin/sh
2/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadApplets()"
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
new file mode 100644
index 0000000..35dbf22
--- a/dev/null
+++ b/core/applets/volumeapplet/volume.cpp
@@ -0,0 +1,199 @@
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
21#include "volume.h"
22
23#include <qpe/resource.h>
24#include <qpe/qpeapplication.h>
25#include <qpe/config.h>
26#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
27#include <qpe/qcopenvelope_qws.h>
28#endif
29
30#include <qpainter.h>
31#include <qcheckbox.h>
32#include <qslider.h>
33#include <qlayout.h>
34#include <qframe.h>
35#include <qpixmap.h>
36
37
38VolumeControl::VolumeControl( QWidget *parent, const char *name )
39 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
40{
41 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
42
43 QVBoxLayout *vbox = new QVBoxLayout( this );
44 slider = new QSlider( this );
45 muteBox = new QCheckBox( tr("Mute"), this );
46 slider->setRange( 0, 100 );
47 slider->setTickmarks( QSlider::Both );
48 slider->setTickInterval( 20 );
49 slider->setFocusPolicy( QWidget::NoFocus );
50 muteBox->setFocusPolicy( QWidget::NoFocus );
51 vbox->setMargin( 6 );
52 vbox->setSpacing( 3 );
53 vbox->addWidget( slider, 0, Qt::AlignVCenter | Qt::AlignHCenter );
54 vbox->addWidget( muteBox );
55 setFixedHeight( 100 );
56 setFixedWidth( sizeHint().width() );
57 setFocusPolicy(QWidget::NoFocus);
58}
59
60void VolumeControl::keyPressEvent( QKeyEvent *e)
61{
62 switch(e->key()) {
63 case Key_Up:
64 slider->subtractStep();
65 break;
66 case Key_Down:
67 slider->addStep();
68 break;
69 case Key_Space:
70 muteBox->toggle();
71 break;
72 case Key_Escape:
73 close();
74 break;
75 }
76}
77
78//===========================================================================
79
80VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
81 : QWidget( parent, name )
82{
83 setFixedHeight( 18 );
84 setFixedWidth( 14 );
85 volumePixmap = Resource::loadPixmap( "volume" );
86 muted = FALSE; // ### read from pref
87 volumePercent = 50; // ### read from pref
88 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( volumeChanged(bool) ) );
89 writeSystemVolume();
90}
91
92VolumeApplet::~VolumeApplet()
93{
94}
95
96void VolumeApplet::mousePressEvent( QMouseEvent *)
97{
98 // Create a small volume control window to adjust the volume with
99 VolumeControl *vc = new VolumeControl;
100 vc->slider->setValue( 100 - volumePercent );
101 vc->muteBox->setChecked( muted );
102 connect( vc->slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderMoved( int ) ) );
103 connect( vc->muteBox, SIGNAL( toggled( bool ) ), this, SLOT( mute( bool ) ) );
104 QPoint curPos = mapToGlobal( rect().topLeft() );
105 vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 100 );
106 vc->show();
107}
108
109void VolumeApplet::volumeChanged( bool nowMuted )
110{
111 int previousVolume = volumePercent;
112
113 if ( !nowMuted )
114 readSystemVolume();
115
116 // Handle case where muting it toggled
117 if ( muted != nowMuted ) {
118 muted = nowMuted;
119 repaint( TRUE );
120 return;
121 }
122
123 // Avoid over repainting
124 if ( previousVolume != volumePercent )
125 repaint( 2, height() - 3, width() - 4, 2, FALSE );
126}
127
128
129void VolumeApplet::mute( bool toggled )
130{
131 muted = toggled;
132 // clear if removing mute
133 repaint( !toggled );
134 writeSystemVolume();
135}
136
137
138void VolumeApplet::sliderMoved( int percent )
139{
140 setVolume( 100 - percent );
141}
142
143
144void VolumeApplet::readSystemVolume()
145{
146 Config cfg("Sound");
147 cfg.setGroup("System");
148 volumePercent = cfg.readNumEntry("Volume");
149}
150
151
152void VolumeApplet::setVolume( int percent )
153{
154 // clamp volume percent to be between 0 and 100
155 volumePercent = (percent < 0) ? 0 : ((percent > 100) ? 100 : percent);
156 // repaint just the little volume rectangle
157 repaint( 2, height() - 3, width() - 4, 2, FALSE );
158 writeSystemVolume();
159}
160
161
162void VolumeApplet::writeSystemVolume()
163{
164 {
165 Config cfg("Sound");
166 cfg.setGroup("System");
167 cfg.writeEntry("Volume",volumePercent);
168 }
169#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
170 // Send notification that the volume has changed
171 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted;
172#endif
173}
174
175
176void VolumeApplet::paintEvent( QPaintEvent* )
177{
178 QPainter p(this);
179
180 if (volumePixmap.isNull())
181 volumePixmap = Resource::loadPixmap( "volume" );
182 p.drawPixmap( 0, 1, volumePixmap );
183 p.setPen( darkGray );
184 p.drawRect( 1, height() - 4, width() - 2, 4 );
185
186 int pixelsWide = volumePercent * (width() - 4) / 100;
187 p.fillRect( 2, height() - 3, pixelsWide, 2, red );
188 p.fillRect( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray );
189
190 if ( muted ) {
191 p.setPen( red );
192 p.drawLine( 1, 2, width() - 2, height() - 5 );
193 p.drawLine( 1, 3, width() - 2, height() - 4 );
194 p.drawLine( width() - 2, 2, 1, height() - 5 );
195 p.drawLine( width() - 2, 3, 1, height() - 4 );
196 }
197}
198
199
diff --git a/core/applets/volumeapplet/volume.h b/core/applets/volumeapplet/volume.h
new file mode 100644
index 0000000..5704cad
--- a/dev/null
+++ b/core/applets/volumeapplet/volume.h
@@ -0,0 +1,75 @@
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 __VOLUME_APPLET_H__
21#define __VOLUME_APPLET_H__
22
23
24#include <qwidget.h>
25#include <qframe.h>
26#include <qpixmap.h>
27#include <qguardedptr.h>
28
29class QSlider;
30class QCheckBox;
31
32class VolumeControl : public QFrame
33{
34 Q_OBJECT
35public:
36 VolumeControl( QWidget *parent=0, const char *name=0 );
37
38public:
39 QSlider *slider;
40 QCheckBox *muteBox;
41
42private:
43 void keyPressEvent( QKeyEvent * );
44};
45
46class VolumeApplet : public QWidget
47{
48 Q_OBJECT
49public:
50 VolumeApplet( QWidget *parent = 0, const char *name=0 );
51 ~VolumeApplet();
52 bool isMute( ) { return muted; }
53 int percent( ) { return volumePercent; }
54
55public slots:
56 void volumeChanged( bool muted );
57 void setVolume( int percent );
58 void sliderMoved( int percent );
59 void mute( bool );
60
61private:
62 void readSystemVolume();
63 void writeSystemVolume();
64 void mousePressEvent( QMouseEvent * );
65 void paintEvent( QPaintEvent* );
66
67private:
68 int volumePercent;
69 bool muted;
70 QPixmap volumePixmap;
71};
72
73
74#endif // __VOLUME_APPLET_H__
75
diff --git a/core/applets/volumeapplet/volumeapplet.pro b/core/applets/volumeapplet/volumeapplet.pro
new file mode 100644
index 0000000..a33cf81
--- a/dev/null
+++ b/core/applets/volumeapplet/volumeapplet.pro
@@ -0,0 +1,12 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3 HEADERS= volume.h volumeappletimpl.h
4 SOURCES= volume.cpp volumeappletimpl.cpp
5 TARGET = volumeapplet
6 DESTDIR = ../../plugins/applets
7INCLUDEPATH += $(QPEDIR)/include
8DEPENDPATH += ../$(QPEDIR)/include
9LIBS += -lqpe
10 VERSION = 1.0.0
11
12TRANSLATIONS += ../../i18n/de/libvolumeapplet.ts
diff --git a/core/applets/volumeapplet/volumeappletimpl.cpp b/core/applets/volumeapplet/volumeappletimpl.cpp
new file mode 100644
index 0000000..676ab61
--- a/dev/null
+++ b/core/applets/volumeapplet/volumeappletimpl.cpp
@@ -0,0 +1,64 @@
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 "volume.h"
21#include "volumeappletimpl.h"
22
23
24VolumeAppletImpl::VolumeAppletImpl()
25 : volume(0), ref(0)
26{
27}
28
29VolumeAppletImpl::~VolumeAppletImpl()
30{
31 delete volume;
32}
33
34QWidget *VolumeAppletImpl::applet( QWidget *parent )
35{
36 if ( !volume )
37 volume = new VolumeApplet( parent );
38 return volume;
39}
40
41int VolumeAppletImpl::position() const
42{
43 return 6;
44}
45
46QRESULT VolumeAppletImpl::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
54 if ( *iface )
55 (*iface)->addRef();
56 return QS_OK;
57}
58
59Q_EXPORT_INTERFACE()
60{
61 Q_CREATE_INSTANCE( VolumeAppletImpl )
62}
63
64
diff --git a/core/applets/volumeapplet/volumeappletimpl.h b/core/applets/volumeapplet/volumeappletimpl.h
new file mode 100644
index 0000000..9b2952a
--- a/dev/null
+++ b/core/applets/volumeapplet/volumeappletimpl.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 VOLUMEAPPLETIMPL_H
21#define VOLUMEAPPLETIMPL_H
22
23#include <qpe/taskbarappletinterface.h>
24
25class VolumeApplet;
26
27class VolumeAppletImpl : public TaskbarAppletInterface
28{
29public:
30 VolumeAppletImpl();
31 virtual ~VolumeAppletImpl();
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 VolumeApplet *volume;
41 ulong ref;
42};
43
44#endif