-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 15 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 13 | ||||
-rw-r--r-- | core/applets/cardmon/cardmon.h | 2 | ||||
-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 196 | ||||
-rw-r--r-- | core/applets/volumeapplet/volume.cpp | 5 |
5 files changed, 26 insertions, 205 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 3b329c6..f3a95ed 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp | |||
@@ -1,71 +1,72 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 "battery.h" | 20 | #include "battery.h" |
21 | #include "batterystatus.h" | 21 | #include "batterystatus.h" |
22 | 22 | ||
23 | #include <qpe/power.h> | 23 | #include <qpe/power.h> |
24 | #include <qpe/applnk.h> | ||
24 | 25 | ||
25 | #include <qpainter.h> | 26 | #include <qpainter.h> |
26 | #include <qtimer.h> | 27 | #include <qtimer.h> |
27 | 28 | ||
28 | 29 | ||
29 | BatteryMeter::BatteryMeter( QWidget *parent ) | 30 | BatteryMeter::BatteryMeter( QWidget *parent ) |
30 | : QWidget( parent ), charging(false) | 31 | : QWidget( parent ), charging(false) |
31 | { | 32 | { |
32 | ps = new PowerStatus; | 33 | ps = new PowerStatus; |
33 | startTimer( 10000 ); | 34 | startTimer( 10000 ); |
34 | setFixedHeight(12); | 35 | setFixedHeight( AppLnk::smallIconSize() ); |
35 | chargeTimer = new QTimer( this ); | 36 | chargeTimer = new QTimer( this ); |
36 | connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); | 37 | connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); |
37 | timerEvent(0); | 38 | timerEvent(0); |
38 | } | 39 | } |
39 | 40 | ||
40 | BatteryMeter::~BatteryMeter() | 41 | BatteryMeter::~BatteryMeter() |
41 | { | 42 | { |
42 | delete ps; | 43 | delete ps; |
43 | } | 44 | } |
44 | 45 | ||
45 | QSize BatteryMeter::sizeHint() const | 46 | QSize BatteryMeter::sizeHint() const |
46 | { | 47 | { |
47 | return QSize(10,12); | 48 | return QSize(10, height() ); |
48 | } | 49 | } |
49 | 50 | ||
50 | void BatteryMeter::mouseReleaseEvent( QMouseEvent *) | 51 | void BatteryMeter::mouseReleaseEvent( QMouseEvent *) |
51 | { | 52 | { |
52 | if ( batteryView && batteryView->isVisible() ) { | 53 | if ( batteryView && batteryView->isVisible() ) { |
53 | delete (QWidget *) batteryView; | 54 | delete (QWidget *) batteryView; |
54 | } else { | 55 | } else { |
55 | if ( !batteryView ) | 56 | if ( !batteryView ) |
56 | batteryView = new BatteryStatus( ps ); | 57 | batteryView = new BatteryStatus( ps ); |
57 | batteryView->showMaximized(); | 58 | batteryView->showMaximized(); |
58 | batteryView->raise(); | 59 | batteryView->raise(); |
59 | batteryView->show(); | 60 | batteryView->show(); |
60 | } | 61 | } |
61 | } | 62 | } |
62 | 63 | ||
63 | void BatteryMeter::timerEvent( QTimerEvent * ) | 64 | void BatteryMeter::timerEvent( QTimerEvent * ) |
64 | { | 65 | { |
65 | PowerStatus prev = *ps; | 66 | PowerStatus prev = *ps; |
66 | 67 | ||
67 | *ps = PowerStatusManager::readStatus(); | 68 | *ps = PowerStatusManager::readStatus(); |
68 | 69 | ||
69 | if ( prev != *ps ) { | 70 | if ( prev != *ps ) { |
70 | percent = ps->batteryPercentRemaining(); | 71 | percent = ps->batteryPercentRemaining(); |
71 | if ( !charging && ps->batteryStatus() == PowerStatus::Charging && percent < 0 ) { | 72 | if ( !charging && ps->batteryStatus() == PowerStatus::Charging && percent < 0 ) { |
@@ -95,58 +96,58 @@ void BatteryMeter::chargeTimeout() | |||
95 | batteryView->updatePercent( percent ); | 96 | batteryView->updatePercent( percent ); |
96 | } | 97 | } |
97 | 98 | ||
98 | void BatteryMeter::paintEvent( QPaintEvent* ) | 99 | void BatteryMeter::paintEvent( QPaintEvent* ) |
99 | { | 100 | { |
100 | QPainter p(this); | 101 | QPainter p(this); |
101 | 102 | ||
102 | QColor c; | 103 | QColor c; |
103 | QColor darkc; | 104 | QColor darkc; |
104 | QColor lightc; | 105 | QColor lightc; |
105 | if ( ps->acStatus() == PowerStatus::Offline ) { | 106 | if ( ps->acStatus() == PowerStatus::Offline ) { |
106 | c = blue.light(120); | 107 | c = blue.light(120); |
107 | darkc = c.dark(120); | 108 | darkc = c.dark(120); |
108 | lightc = c.light(140); | 109 | lightc = c.light(140); |
109 | } else if ( ps->acStatus() == PowerStatus::Online ) { | 110 | } else if ( ps->acStatus() == PowerStatus::Online ) { |
110 | c = green.dark(130); | 111 | c = green.dark(130); |
111 | darkc = c.dark(120); | 112 | darkc = c.dark(120); |
112 | lightc = c.light(180); | 113 | lightc = c.light(180); |
113 | } else { | 114 | } else { |
114 | c = red; | 115 | c = red; |
115 | darkc = c.dark(120); | 116 | darkc = c.dark(120); |
116 | lightc = c.light(160); | 117 | lightc = c.light(160); |
117 | } | 118 | } |
118 | 119 | ||
119 | int w = 6; | 120 | int w = height() / 2 ; |
120 | int h = height()-3; | 121 | int h = height() - 4; |
121 | int pix = (percent * h) / 100; | 122 | int pix = (percent * h) / 100; |
122 | int y2 = height() - 2; | 123 | int y2 = height() -2; |
123 | int y = y2 - pix; | 124 | int y = y2 - pix; |
124 | int x1 = (width() - w) / 2; | 125 | int x1 = (width() - w ) / 2; |
125 | 126 | ||
126 | p.setPen(QColor(80,80,80)); | 127 | p.setPen(QColor(80,80,80)); |
127 | p.drawLine(x1+w/4,0,x1+w/4+w/2,0); | 128 | p.drawLine(x1+w/4,0,x1+w/4+w/2,0); |
128 | p.drawRect(x1,1,w,height()-1); | 129 | p.drawRect(x1,1,w,height()-1); |
129 | p.setBrush(c); | 130 | p.setBrush(c); |
130 | 131 | ||
131 | int extra = ((percent * h) % 100)/(100/4); | 132 | int extra = ((percent * h) % 100)/(100/4); |
132 | 133 | ||
133 | #define Y(i) ((i<=extra)?y-1:y) | 134 | #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 | #define DRAWUPPER(i) if ( Y(i) >= 2 ) p.drawLine(i+x1,2,i+x1,Y(i)); |
135 | p.setPen( gray ); | 136 | p.setPen( gray ); |
136 | DRAWUPPER(1); | 137 | DRAWUPPER(1); |
137 | DRAWUPPER(3); | 138 | DRAWUPPER(3); |
138 | p.setPen( gray.light(130) ); | 139 | p.setPen( gray.light(130) ); |
139 | DRAWUPPER(2); | 140 | DRAWUPPER(2); |
140 | p.setPen( gray.dark(120) ); | 141 | p.setPen( gray.dark(120) ); |
141 | DRAWUPPER(4); | 142 | DRAWUPPER(4); |
142 | 143 | ||
143 | #define DRAW(i) { if ( Y(i) < y2 ) p.drawLine(i+x1,Y(i)+1,i+x1,y2); } | 144 | #define DRAW(i) { if ( Y(i) < y2 ) p.drawLine(i+x1,Y(i)+1, i+x1,y2); } |
144 | p.setPen( c ); | 145 | p.setPen( c ); |
145 | DRAW(1); | 146 | DRAW(1); |
146 | DRAW(3); | 147 | DRAW(3); |
147 | p.setPen( lightc ); | 148 | p.setPen( lightc ); |
148 | DRAW(2); | 149 | DRAW(2); |
149 | p.setPen(darkc); | 150 | p.setPen(darkc); |
150 | DRAW(4); | 151 | DRAW(4); |
151 | } | 152 | } |
152 | 153 | ||
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index f3f9044..b8c4553 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -2,90 +2,95 @@ | |||
2 | * cardmon.cpp | 2 | * cardmon.cpp |
3 | * | 3 | * |
4 | * --------------------- | 4 | * --------------------- |
5 | * | 5 | * |
6 | * copyright : (c) 2002 by Maximilian Reiss | 6 | * copyright : (c) 2002 by Maximilian Reiss |
7 | * email : max.reiss@gmx.de | 7 | * email : max.reiss@gmx.de |
8 | * based on two apps by Devin Butterfield | 8 | * based on two apps by Devin Butterfield |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | 19 | ||
20 | #include "cardmon.h" | 20 | #include "cardmon.h" |
21 | 21 | ||
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | 23 | ||
24 | #include <opie/odevice.h> | 24 | #include <opie/odevice.h> |
25 | 25 | ||
26 | #include <qpe/applnk.h> | ||
27 | |||
26 | #include <qcopchannel_qws.h> | 28 | #include <qcopchannel_qws.h> |
27 | #include <qpainter.h> | 29 | #include <qpainter.h> |
28 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
29 | #include <qfile.h> | 31 | #include <qfile.h> |
30 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
31 | #include <qtimer.h> | 33 | #include <qtimer.h> |
32 | #include <qapplication.h> | 34 | #include <qapplication.h> |
33 | 35 | ||
34 | #include <stdio.h> | 36 | #include <stdio.h> |
35 | #include <unistd.h> | 37 | #include <unistd.h> |
36 | #include <stdlib.h> | 38 | #include <stdlib.h> |
37 | #include <string.h> | 39 | #include <string.h> |
38 | #include <fcntl.h> | 40 | #include <fcntl.h> |
39 | #include <qsound.h> | 41 | #include <qsound.h> |
40 | 42 | ||
41 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 43 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
42 | #include <sys/vfs.h> | 44 | #include <sys/vfs.h> |
43 | #include <mntent.h> | 45 | #include <mntent.h> |
44 | #endif | 46 | #endif |
45 | 47 | ||
46 | using namespace Opie; | 48 | using namespace Opie; |
47 | 49 | ||
48 | CardMonitor::CardMonitor(QWidget * parent):QWidget(parent), | 50 | CardMonitor::CardMonitor(QWidget * parent):QWidget(parent), |
49 | pm(Resource:: | 51 | pm( Resource::loadPixmap("cardmon/pcmcia") ) |
50 | loadPixmap("cardmon/pcmcia")) | ||
51 | { | 52 | { |
52 | 53 | ||
53 | QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); | 54 | QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this); |
54 | connect(pcmciaChannel, | 55 | connect(pcmciaChannel, |
55 | SIGNAL(received(const QCString &, const QByteArray &)), this, | 56 | SIGNAL(received(const QCString &, const QByteArray &)), this, |
56 | SLOT(cardMessage(const QCString &, const QByteArray &))); | 57 | SLOT(cardMessage(const QCString &, const QByteArray &))); |
57 | 58 | ||
58 | QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); | 59 | QCopChannel *sdChannel = new QCopChannel("QPE/Card", this); |
59 | connect(sdChannel, | 60 | connect(sdChannel, |
60 | SIGNAL(received(const QCString &, const QByteArray &)), this, | 61 | SIGNAL(received(const QCString &, const QByteArray &)), this, |
61 | SLOT(cardMessage(const QCString &, const QByteArray &))); | 62 | SLOT(cardMessage(const QCString &, const QByteArray &))); |
62 | 63 | ||
63 | cardInPcmcia0 = FALSE; | 64 | cardInPcmcia0 = FALSE; |
64 | cardInPcmcia1 = FALSE; | 65 | cardInPcmcia1 = FALSE; |
65 | cardInSd = FALSE; | 66 | cardInSd = FALSE; |
66 | 67 | ||
67 | setFixedSize(pm.size()); | 68 | setFocusPolicy( NoFocus ); |
69 | |||
70 | setFixedWidth ( AppLnk::smallIconSize() ); | ||
71 | setFixedHeight ( AppLnk::smallIconSize() ); | ||
72 | |||
68 | getStatusPcmcia(TRUE); | 73 | getStatusPcmcia(TRUE); |
69 | getStatusSd(TRUE); | 74 | getStatusSd(TRUE); |
70 | repaint(FALSE); | 75 | repaint(FALSE); |
71 | popupMenu = 0; | 76 | popupMenu = 0; |
72 | } | 77 | } |
73 | 78 | ||
74 | CardMonitor::~CardMonitor() | 79 | CardMonitor::~CardMonitor() |
75 | { | 80 | { |
76 | if (popupMenu) { | 81 | if (popupMenu) { |
77 | delete popupMenu; | 82 | delete popupMenu; |
78 | } | 83 | } |
79 | } | 84 | } |
80 | 85 | ||
81 | void CardMonitor::popUp(QString message, QString icon) | 86 | void CardMonitor::popUp(QString message, QString icon) |
82 | { | 87 | { |
83 | if (!popupMenu) { | 88 | if (!popupMenu) { |
84 | popupMenu = new QPopupMenu(this); | 89 | popupMenu = new QPopupMenu(this); |
85 | } | 90 | } |
86 | 91 | ||
87 | popupMenu->clear(); | 92 | popupMenu->clear(); |
88 | if (icon.isEmpty()) { | 93 | if (icon.isEmpty()) { |
89 | popupMenu->insertItem(message, 0); | 94 | popupMenu->insertItem(message, 0); |
90 | } else { | 95 | } else { |
91 | popupMenu->insertItem(QIconSet(Resource::loadPixmap(icon)), | 96 | popupMenu->insertItem(QIconSet(Resource::loadPixmap(icon)), |
@@ -314,31 +319,31 @@ bool CardMonitor::getStatusSd(int showPopUp) | |||
314 | if (cardInSd) { | 319 | if (cardInSd) { |
315 | text += "New card: SD/MMC"; | 320 | text += "New card: SD/MMC"; |
316 | what = "on"; | 321 | what = "on"; |
317 | } else { | 322 | } else { |
318 | text += "Ejected: SD/MMC"; | 323 | text += "Ejected: SD/MMC"; |
319 | what = "off"; | 324 | what = "off"; |
320 | } | 325 | } |
321 | //qDebug("TEXT: " + text ); | 326 | //qDebug("TEXT: " + text ); |
322 | QSound::play(Resource::findSound("cardmon/card" + what)); | 327 | QSound::play(Resource::findSound("cardmon/card" + what)); |
323 | popUp(text, "cardmon/ide");// XX add SD pic | 328 | popUp(text, "cardmon/ide");// XX add SD pic |
324 | } | 329 | } |
325 | #else | 330 | #else |
326 | #error "Not on Linux" | 331 | #error "Not on Linux" |
327 | #endif | 332 | #endif |
328 | repaint( FALSE ); | 333 | repaint( FALSE ); |
329 | return ((cardWas == cardInSd) ? FALSE : TRUE); | 334 | return ((cardWas == cardInSd) ? FALSE : TRUE); |
330 | } | 335 | } |
331 | 336 | ||
332 | void CardMonitor::paintEvent(QPaintEvent *) | 337 | void CardMonitor::paintEvent(QPaintEvent *) |
333 | { | 338 | { |
334 | 339 | ||
335 | QPainter p(this); | 340 | QPainter p(this); |
336 | 341 | ||
337 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { | 342 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { |
338 | p.drawPixmap(0, 0, pm); | 343 | p.drawPixmap(0, 0, pm ); |
339 | show(); | 344 | show(); |
340 | } else { | 345 | } else { |
341 | //p.eraseRect(rect()); | 346 | //p.eraseRect(rect()); |
342 | hide(); | 347 | hide(); |
343 | } | 348 | } |
344 | } | 349 | } |
diff --git a/core/applets/cardmon/cardmon.h b/core/applets/cardmon/cardmon.h index 49bcae8..4f00920 100644 --- a/core/applets/cardmon/cardmon.h +++ b/core/applets/cardmon/cardmon.h | |||
@@ -1,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | * cardmon.h | 2 | * cardmon.h |
3 | * | 3 | * |
4 | * --------------------- | 4 | * --------------------- |
5 | * | 5 | * |
6 | * copyright : (c) 2002 by Maximilian Reiss | 6 | * copyright : (c) 2003 by Maximilian Reiss |
7 | * email : max.reiss@gmx.de | 7 | * email : max.reiss@gmx.de |
8 | * based on two apps by Devin Butterfield | 8 | * based on two apps by Devin Butterfield |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #ifndef CARDMON_H | 19 | #ifndef CARDMON_H |
20 | #define CARDMON_H | 20 | #define CARDMON_H |
21 | 21 | ||
22 | #include <qwidget.h> | 22 | #include <qwidget.h> |
23 | #include <qpixmap.h> | 23 | #include <qpixmap.h> |
24 | #include <qpopupmenu.h> | 24 | #include <qpopupmenu.h> |
25 | 25 | ||
26 | class CardMonitor : public QWidget { | 26 | class CardMonitor : public QWidget { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | public: | 28 | public: |
29 | CardMonitor( QWidget *parent = 0 ); | 29 | CardMonitor( QWidget *parent = 0 ); |
30 | ~CardMonitor(); | 30 | ~CardMonitor(); |
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index b83e16e..21b68e3 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -1,250 +1,64 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include "clipboard.h" | 21 | #include "clipboard.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/applnk.h> | ||
24 | 25 | ||
25 | #include <qpainter.h> | 26 | #include <qpainter.h> |
26 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
27 | #include <qwindowsystem_qws.h> | 28 | #include <qwindowsystem_qws.h> |
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #include <qclipboard.h> | 30 | #include <qclipboard.h> |
30 | #include <qtimer.h> | 31 | #include <qtimer.h> |
31 | 32 | ||
32 | //=========================================================================== | 33 | //=========================================================================== |
33 | 34 | ||
34 | /* XPM */ | ||
35 | static const char * paste_xpm[] = { | ||
36 | "14 16 167 2", | ||
37 | " c None", | ||
38 | ". c #96A0AC", | ||
39 | "+ c #9BB0D4", | ||
40 | "@ c #5E7095", | ||
41 | "# c #F1CA79", | ||
42 | "$ c #EFC56D", | ||
43 | "% c #C9AF76", | ||
44 | "& c #9FABBA", | ||
45 | "* c #AEBFDD", | ||
46 | "= c #8899BA", | ||
47 | "- c #726E68", | ||
48 | "; c #D19A33", | ||
49 | "> c #DA9524", | ||
50 | ", c #EFC065", | ||
51 | "' c #F3DDA6", | ||
52 | ") c #E9D192", | ||
53 | "! c #ADA895", | ||
54 | "~ c #9AA8BF", | ||
55 | "{ c #B4C2D8", | ||
56 | "] c #AEBED7", | ||
57 | "^ c #797E8A", | ||
58 | "/ c #B78534", | ||
59 | "( c #DE8516", | ||
60 | "_ c #8A4308", | ||
61 | ": c #F0C470", | ||
62 | "< c #F5EFD3", | ||
63 | "[ c #DFD7B4", | ||
64 | "} c #8F9BA6", | ||
65 | "| c #7C8BA3", | ||
66 | "1 c #808A9A", | ||
67 | "2 c #828892", | ||
68 | "3 c #727582", | ||
69 | "4 c #9A6435", | ||
70 | "5 c #F37004", | ||
71 | "6 c #A24104", | ||
72 | "7 c #F0C36E", | ||
73 | "8 c #F4EBCC", | ||
74 | "9 c #ECDCAF", | ||
75 | "0 c #CDC29B", | ||
76 | "a c #C1B486", | ||
77 | "b c #C3A86B", | ||
78 | "c c #B8924A", | ||
79 | "d c #B17B31", | ||
80 | "e c #C66C1C", | ||
81 | "f c #DE6610", | ||
82 | "g c #944311", | ||
83 | "h c #F3E8C6", | ||
84 | "i c #F3E0AB", | ||
85 | "j c #F2DB9B", | ||
86 | "k c #F1D382", | ||
87 | "l c #F0C056", | ||
88 | "m c #CCA354", | ||
89 | "n c #B7B09D", | ||
90 | "o c #C2A898", | ||
91 | "p c #BCA298", | ||
92 | "q c #9A959F", | ||
93 | "r c #526C8F", | ||
94 | "s c #F3E4B9", | ||
95 | "t c #F3DA99", | ||
96 | "u c #F4D78A", | ||
97 | "v c #F5CA6A", | ||
98 | "w c #F4B032", | ||
99 | "x c #C19A56", | ||
100 | "y c #C2D7EA", | ||
101 | "z c #C0D0E7", | ||
102 | "A c #B0C6E8", | ||
103 | "B c #A6C1EB", | ||
104 | "C c #6AA1E3", | ||
105 | "D c #F0C36D", | ||
106 | "E c #F3E2B0", | ||
107 | "F c #F3D891", | ||
108 | "G c #F3CF7A", | ||
109 | "H c #F4BC4C", | ||
110 | "I c #F3A51C", | ||
111 | "J c #BC9758", | ||
112 | "K c #CAE4FE", | ||
113 | "L c #C5DDFB", | ||
114 | "M c #B5D3FB", | ||
115 | "N c #A8CCFC", | ||
116 | "O c #63A6F6", | ||
117 | "P c #2180E3", | ||
118 | "Q c #F3E1AE", | ||
119 | "R c #F3D488", | ||
120 | "S c #F3C664", | ||
121 | "T c #F4B63C", | ||
122 | "U c #F2A61C", | ||
123 | "V c #BC9A5C", | ||
124 | "W c #CCE6FE", | ||
125 | "X c #C8DEFB", | ||
126 | "Y c #B9D6FB", | ||
127 | "Z c #B2D0FC", | ||
128 | "` c #84B6FB", | ||
129 | " .c #479DFB", | ||
130 | "..c #F3DFAC", | ||
131 | "+.c #F3CC76", | ||
132 | "@.c #F3BE52", | ||
133 | "#.c #F4B53A", | ||
134 | "$.c #F2AB24", | ||
135 | "%.c #BC9D61", | ||
136 | "&.c #CBE5FE", | ||
137 | "*.c #C3DBFB", | ||
138 | "=.c #B0D0FB", | ||
139 | "-.c #ACCBFC", | ||
140 | ";.c #A0C3FD", | ||
141 | ">.c #6EB1FF", | ||
142 | ",.c #F3DCA4", | ||
143 | "'.c #F3C35F", | ||
144 | ").c #F3BC4A", | ||
145 | "!.c #F3AC26", | ||
146 | "~.c #BC9E63", | ||
147 | "{.c #CAE4FF", | ||
148 | "].c #BCD7FB", | ||
149 | "^.c #A3C7FB", | ||
150 | "/.c #94BCFB", | ||
151 | "(.c #92BAFB", | ||
152 | "_.c #74B4FE", | ||
153 | ":.c #F1C46D", | ||
154 | "<.c #F4D99A", | ||
155 | "[.c #F4BE52", | ||
156 | "}.c #F4BB47", | ||
157 | "|.c #F4B63D", | ||
158 | "1.c #F4AD27", | ||
159 | "2.c #BC9E64", | ||
160 | "3.c #CAE5FF", | ||
161 | "4.c #BAD6FB", | ||
162 | "5.c #A1C5FB", | ||
163 | "6.c #9AC1FB", | ||
164 | "7.c #9DC1FC", | ||
165 | "8.c #7CBAFE", | ||
166 | "9.c #F5C870", | ||
167 | "0.c #F8DC9B", | ||
168 | "a.c #F8C65C", | ||
169 | "b.c #F8C252", | ||
170 | "c.c #F8BE49", | ||
171 | "d.c #F7B534", | ||
172 | "e.c #BFA46C", | ||
173 | "f.c #CBE4FF", | ||
174 | "g.c #B7D3FB", | ||
175 | "h.c #A4C6FB", | ||
176 | "i.c #A0C4FB", | ||
177 | "j.c #A2C4FC", | ||
178 | "k.c #80BDFF", | ||
179 | "l.c #BC9250", | ||
180 | "m.c #BF9461", | ||
181 | "n.c #BD8944", | ||
182 | "o.c #BD863D", | ||
183 | "p.c #BD8438", | ||
184 | "q.c #BC7C2C", | ||
185 | "r.c #988269", | ||
186 | "s.c #C5E7FF", | ||
187 | "t.c #C0DDFE", | ||
188 | "u.c #B2D4FE", | ||
189 | "v.c #ACD1FE", | ||
190 | "w.c #ACD0FE", | ||
191 | "x.c #7DC0FF", | ||
192 | "y.c #805835", | ||
193 | "z.c #754D26", | ||
194 | "A.c #754C22", | ||
195 | "B.c #754B20", | ||
196 | "C.c #75471A", | ||
197 | "D.c #534D4F", | ||
198 | "E.c #619BCE", | ||
199 | "F.c #6295C8", | ||
200 | "G.c #5C91C8", | ||
201 | "H.c #598FC8", | ||
202 | "I.c #588FC8", | ||
203 | "J.c #3E87CD", | ||
204 | " . + @ ", | ||
205 | " # $ % & * = - ; > ", | ||
206 | ", ' ) ! ~ { ] ^ / ( _ ", | ||
207 | ": < [ } | 1 2 3 4 5 6 ", | ||
208 | "7 8 9 0 a b c d e f g ", | ||
209 | "7 h i j k l m n o p q r ", | ||
210 | "7 s t u v w x y z A B C ", | ||
211 | "D E F G H I J K L M N O P ", | ||
212 | "D Q R S T U V W X Y Z ` . ", | ||
213 | "D ..+.@.#.$.%.&.*.=.-.;.>. ", | ||
214 | "7 ,.'.).T !.~.{.].^./.(._. ", | ||
215 | ":.<.[.}.|.1.2.3.4.5.6.7.8. ", | ||
216 | "9.0.a.b.c.d.e.f.g.h.i.j.k. ", | ||
217 | "l.m.n.o.p.q.r.s.t.u.v.w.x. ", | ||
218 | " y.z.A.B.C.D.E.F.G.H.I.J. ", | ||
219 | " "}; | ||
220 | |||
221 | 35 | ||
222 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) | 36 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) |
223 | { | 37 | { |
224 | setFixedWidth ( 14 ); | 38 | setFixedWidth ( AppLnk::smallIconSize() ); |
225 | setFixedHeight ( 18 ); | 39 | setFixedHeight ( AppLnk::smallIconSize() ); |
226 | m_clipboardPixmap = QPixmap ( paste_xpm ); | 40 | m_clipboardPixmap = QPixmap ( Resource::loadPixmap( "paste" ) ); |
227 | 41 | ||
228 | m_timer = new QTimer ( this ); | 42 | m_timer = new QTimer ( this ); |
229 | 43 | ||
230 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); | 44 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); |
231 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); | 45 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); |
232 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); | 46 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); |
233 | 47 | ||
234 | m_menu = 0; | 48 | m_menu = 0; |
235 | m_dirty = true; | 49 | m_dirty = true; |
236 | m_lasttext = QString::null; | 50 | m_lasttext = QString::null; |
237 | 51 | ||
238 | m_timer-> start ( 0, true ); | 52 | m_timer-> start ( 0, true ); |
239 | } | 53 | } |
240 | 54 | ||
241 | ClipboardApplet::~ClipboardApplet ( ) | 55 | ClipboardApplet::~ClipboardApplet ( ) |
242 | { | 56 | { |
243 | } | 57 | } |
244 | 58 | ||
245 | void ClipboardApplet::shutdown ( ) | 59 | void ClipboardApplet::shutdown ( ) |
246 | { | 60 | { |
247 | // the timer has to be stopped, or Qt/E will hang on quit() | 61 | // the timer has to be stopped, or Qt/E will hang on quit() |
248 | // see launcher/desktop.cpp | 62 | // see launcher/desktop.cpp |
249 | 63 | ||
250 | m_timer-> stop ( ); | 64 | m_timer-> stop ( ); |
@@ -305,49 +119,49 @@ void ClipboardApplet::action(int id) | |||
305 | break; | 119 | break; |
306 | 120 | ||
307 | default: | 121 | default: |
308 | if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { | 122 | if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { |
309 | QApplication::clipboard ( )-> setText ( m_history [id] ); | 123 | QApplication::clipboard ( )-> setText ( m_history [id] ); |
310 | 124 | ||
311 | for ( uint i = 0; i < m_history. count ( ); i++ ) | 125 | for ( uint i = 0; i < m_history. count ( ); i++ ) |
312 | m_menu-> setItemChecked ( i, i == uint( id )); | 126 | m_menu-> setItemChecked ( i, i == uint( id )); |
313 | 127 | ||
314 | unicode = 'V' - '@'; | 128 | unicode = 'V' - '@'; |
315 | scan = Key_V; | 129 | scan = Key_V; |
316 | } | 130 | } |
317 | break; | 131 | break; |
318 | } | 132 | } |
319 | 133 | ||
320 | if ( scan ) { | 134 | if ( scan ) { |
321 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); | 135 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); |
322 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); | 136 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); |
323 | } | 137 | } |
324 | } | 138 | } |
325 | 139 | ||
326 | void ClipboardApplet::paintEvent ( QPaintEvent* ) | 140 | void ClipboardApplet::paintEvent ( QPaintEvent* ) |
327 | { | 141 | { |
328 | QPainter p ( this ); | 142 | QPainter p ( this ); |
329 | p. drawPixmap ( 0, 1, m_clipboardPixmap ); | 143 | p. drawPixmap( 0, 1, m_clipboardPixmap ); |
330 | } | 144 | } |
331 | 145 | ||
332 | void ClipboardApplet::newData ( ) | 146 | void ClipboardApplet::newData ( ) |
333 | { | 147 | { |
334 | static bool excllock = false; | 148 | static bool excllock = false; |
335 | 149 | ||
336 | if ( excllock ) | 150 | if ( excllock ) |
337 | return; | 151 | return; |
338 | else | 152 | else |
339 | excllock = true; | 153 | excllock = true; |
340 | 154 | ||
341 | m_timer-> stop ( ); | 155 | m_timer-> stop ( ); |
342 | 156 | ||
343 | QCString type = "plain"; | 157 | QCString type = "plain"; |
344 | QString txt = QApplication::clipboard ( )-> text ( type ); | 158 | QString txt = QApplication::clipboard ( )-> text ( type ); |
345 | 159 | ||
346 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { | 160 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { |
347 | m_history. append ( txt ); | 161 | m_history. append ( txt ); |
348 | 162 | ||
349 | if ( m_history. count ( ) > 5 ) | 163 | if ( m_history. count ( ) > 5 ) |
350 | m_history. remove ( m_history. begin ( )); | 164 | m_history. remove ( m_history. begin ( )); |
351 | 165 | ||
352 | m_dirty = true; | 166 | m_dirty = true; |
353 | } | 167 | } |
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp index ed07ec4..906bb77 100644 --- a/core/applets/volumeapplet/volume.cpp +++ b/core/applets/volumeapplet/volume.cpp | |||
@@ -3,48 +3,49 @@ | |||
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | 22 | ||
23 | #include "volume.h" | 23 | #include "volume.h" |
24 | 24 | ||
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/applnk.h> | ||
27 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
28 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 29 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
29 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
30 | #endif | 31 | #endif |
31 | 32 | ||
32 | #include <qpainter.h> | 33 | #include <qpainter.h> |
33 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
34 | #include <qslider.h> | 35 | #include <qslider.h> |
35 | #include <qlayout.h> | 36 | #include <qlayout.h> |
36 | #include <qframe.h> | 37 | #include <qframe.h> |
37 | #include <qpixmap.h> | 38 | #include <qpixmap.h> |
38 | #include <qvbox.h> | 39 | #include <qvbox.h> |
39 | #include <qlabel.h> | 40 | #include <qlabel.h> |
40 | 41 | ||
41 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
42 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
43 | #include <qtimer.h> | 44 | #include <qtimer.h> |
44 | 45 | ||
45 | #include <opie/odevice.h> | 46 | #include <opie/odevice.h> |
46 | 47 | ||
47 | #include "oledbox.h" | 48 | #include "oledbox.h" |
48 | 49 | ||
49 | using namespace Opie; | 50 | using namespace Opie; |
50 | 51 | ||
@@ -704,50 +705,50 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | |||
704 | case UPD_Mic: { | 705 | case UPD_Mic: { |
705 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; | 706 | QCopEnvelope ( "QPE/System", "micChange(bool)" ) << m_mic_muted; |
706 | break; | 707 | break; |
707 | } | 708 | } |
708 | case UPD_Bass: { | 709 | case UPD_Bass: { |
709 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; | 710 | QCopEnvelope ( "QPE/System", "bassChange(bool)" ) << true; |
710 | break; | 711 | break; |
711 | } | 712 | } |
712 | case UPD_Treble: { | 713 | case UPD_Treble: { |
713 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; | 714 | QCopEnvelope ( "QPE/System", "trebleChange(bool)" ) << true; |
714 | break; | 715 | break; |
715 | } | 716 | } |
716 | 717 | ||
717 | case UPD_None: | 718 | case UPD_None: |
718 | break; | 719 | break; |
719 | } | 720 | } |
720 | #endif | 721 | #endif |
721 | } | 722 | } |
722 | 723 | ||
723 | //=========================================================================== | 724 | //=========================================================================== |
724 | 725 | ||
725 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 726 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
726 | : QWidget( parent, name ) | 727 | : QWidget( parent, name ) |
727 | { | 728 | { |
728 | setFixedHeight ( 18 ); | 729 | setFixedWidth ( AppLnk::smallIconSize() ); |
729 | setFixedWidth ( 14 ); | 730 | setFixedHeight ( AppLnk::smallIconSize() ); |
730 | 731 | ||
731 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); | 732 | m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" )); |
732 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); | 733 | m_dialog = new VolumeControl ( this, true, this, "volumecontrol" ); |
733 | 734 | ||
734 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); | 735 | connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool ))); |
735 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); | 736 | connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool ))); |
736 | } | 737 | } |
737 | 738 | ||
738 | VolumeApplet::~VolumeApplet() | 739 | VolumeApplet::~VolumeApplet() |
739 | { | 740 | { |
740 | delete m_pixmap; | 741 | delete m_pixmap; |
741 | } | 742 | } |
742 | 743 | ||
743 | 744 | ||
744 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) | 745 | void VolumeApplet::mousePressEvent ( QMouseEvent * ) |
745 | { | 746 | { |
746 | if ( m_dialog-> isVisible ( )) | 747 | if ( m_dialog-> isVisible ( )) |
747 | m_dialog-> hide ( ); | 748 | m_dialog-> hide ( ); |
748 | else | 749 | else |
749 | m_dialog-> show ( true ); | 750 | m_dialog-> show ( true ); |
750 | } | 751 | } |
751 | 752 | ||
752 | void VolumeApplet::redraw ( bool all ) | 753 | void VolumeApplet::redraw ( bool all ) |
753 | { | 754 | { |