author | harlekin <harlekin> | 2003-04-26 18:09:02 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-04-26 18:09:02 (UTC) |
commit | e2d44ce9293a3db6710753c2e7e2c38a54f60faf (patch) (unidiff) | |
tree | 0934dcd9e1af931a3e61f6f0d09e9aaa838b53e1 /core | |
parent | fb10c3a3ba4e509db788cee5009b2480a8381190 (diff) | |
download | opie-e2d44ce9293a3db6710753c2e7e2c38a54f60faf.zip opie-e2d44ce9293a3db6710753c2e7e2c38a54f60faf.tar.gz opie-e2d44ce9293a3db6710753c2e7e2c38a54f60faf.tar.bz2 |
make applets more flexible regarding size
-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 | |||
@@ -21,6 +21,7 @@ | |||
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> |
@@ -31,7 +32,7 @@ BatteryMeter::BatteryMeter( QWidget *parent ) | |||
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); |
@@ -44,7 +45,7 @@ BatteryMeter::~BatteryMeter() | |||
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 *) |
@@ -116,12 +117,12 @@ void BatteryMeter::paintEvent( QPaintEvent* ) | |||
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); |
@@ -140,7 +141,7 @@ void BatteryMeter::paintEvent( QPaintEvent* ) | |||
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); |
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 | |||
@@ -23,6 +23,8 @@ | |||
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> |
@@ -46,8 +48,7 @@ | |||
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); |
@@ -64,7 +65,11 @@ pm(Resource:: | |||
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); |
@@ -335,7 +340,7 @@ void CardMonitor::paintEvent(QPaintEvent *) | |||
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()); |
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 | |||
@@ -3,7 +3,7 @@ | |||
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 | */ |
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 | |||
@@ -21,6 +21,7 @@ | |||
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> |
@@ -31,199 +32,12 @@ | |||
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 | ||
@@ -326,7 +140,7 @@ void ClipboardApplet::action(int id) | |||
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 ( ) |
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 | |||
@@ -24,6 +24,7 @@ | |||
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> |
@@ -725,8 +726,8 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd ) | |||
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" ); |