-rw-r--r-- | libopie2/opieui/oledbox.cpp | 58 | ||||
-rw-r--r-- | libopie2/opieui/oledbox.h | 95 | ||||
-rw-r--r-- | libopie2/opieui/opieui.pro | 6 |
3 files changed, 106 insertions, 53 deletions
diff --git a/libopie2/opieui/oledbox.cpp b/libopie2/opieui/oledbox.cpp index 52826f1..d18d4b6 100644 --- a/libopie2/opieui/oledbox.cpp +++ b/libopie2/opieui/oledbox.cpp | |||
@@ -1,277 +1,301 @@ | |||
1 | 1 | /* | |
2 | #include <qbitmap.h> | 2 | This file is part of the Opie Project |
3 | #include <qpainter.h> | 3 | =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org> |
4 | .=l. | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This program is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This program is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
4 | 29 | ||
5 | #include "oledbox.h" | 30 | #include "oledbox.h" |
6 | 31 | ||
32 | /* QT */ | ||
33 | #include <qbitmap.h> | ||
34 | #include <qpainter.h> | ||
7 | 35 | ||
8 | #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | 36 | namespace Opie { |
37 | namespace Ui { | ||
9 | 38 | ||
10 | /* XPM */ | 39 | /* XPM */ |
11 | static const char * ledborder_xpm[] = { | 40 | static const char * ledborder_xpm[] = { |
12 | "16 16 11 1", | 41 | "16 16 11 1", |
13 | " c None", | 42 | " c None", |
14 | ".c #626562", | 43 | ".c #626562", |
15 | "+c #7B7D7B", | 44 | "+c #7B7D7B", |
16 | "@c #949594", | 45 | "@c #949594", |
17 | "#c #ACAEAC", | 46 | "#c #ACAEAC", |
18 | "$c #CDCACD", | 47 | "$c #CDCACD", |
19 | "%c #CDCECD", | 48 | "%c #CDCECD", |
20 | ";c #E6E6E6", | 49 | ";c #E6E6E6", |
21 | ">c #FFFFFF", | 50 | ">c #FFFFFF", |
22 | ",c #E6E2E6", | 51 | ",c #E6E2E6", |
23 | "'c #FFFAFF", | 52 | "'c #FFFAFF", |
24 | " .++@@# ", | 53 | " .++@@# ", |
25 | " ...++@@##$ ", | 54 | " ...++@@##$ ", |
26 | " .....+@##$$% ", | 55 | " .....+@##$$% ", |
27 | " ..... #$%%% ", | 56 | " ..... #$%%% ", |
28 | " ... %%; ", | 57 | " ... %%; ", |
29 | ".... ;;;;", | 58 | ".... ;;;;", |
30 | "++. ;>>", | 59 | "++. ;>>", |
31 | "+++ >>>", | 60 | "+++ >>>", |
32 | "@@@ >>>", | 61 | "@@@ >>>", |
33 | "@@# >>>", | 62 | "@@# >>>", |
34 | "#### >>>>", | 63 | "#### >>>>", |
35 | " #$$ >>> ", | 64 | " #$$ >>> ", |
36 | " $$,,' >>>>> ", | 65 | " $$,,' >>>>> ", |
37 | " ,,,''>>>>>>> ", | 66 | " ,,,''>>>>>>> ", |
38 | " ,''>>>>>>> ", | 67 | " ,''>>>>>>> ", |
39 | " '>>>>> "}; | 68 | " '>>>>> "}; |
40 | 69 | ||
41 | 70 | ||
42 | QPixmap *OLedBox::s_border_pix = 0; | 71 | QPixmap *OLedBox::s_border_pix = 0; |
43 | 72 | ||
44 | #endif | ||
45 | |||
46 | |||
47 | OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name ) | 73 | OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name ) |
48 | { | 74 | { |
49 | m_color = col; | 75 | m_color = col; |
50 | m_on = false; | 76 | m_on = false; |
51 | m_readonly = true; | 77 | m_readonly = true; |
52 | 78 | ||
53 | m_pix [ 0 ] = m_pix [ 1 ] = 0; | 79 | m_pix [ 0 ] = m_pix [ 1 ] = 0; |
54 | 80 | ||
55 | setBackgroundMode ( PaletteBackground ); | 81 | setBackgroundMode ( PaletteBackground ); |
56 | 82 | ||
57 | #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | ||
58 | if ( !s_border_pix ) | 83 | if ( !s_border_pix ) |
59 | s_border_pix = new QPixmap ( ledborder_xpm ); | 84 | s_border_pix = new QPixmap( ledborder_xpm ); |
60 | #endif | ||
61 | } | 85 | } |
62 | 86 | ||
63 | OLedBox::~OLedBox ( ) | 87 | OLedBox::~OLedBox ( ) |
64 | { | 88 | { |
65 | delete m_pix [ 0 ]; | 89 | delete m_pix [ 0 ]; |
66 | delete m_pix [ 1 ]; | 90 | delete m_pix [ 1 ]; |
67 | } | 91 | } |
68 | 92 | ||
69 | QSize OLedBox::sizeHint ( ) const | 93 | QSize OLedBox::sizeHint ( ) const |
70 | { | 94 | { |
71 | return QSize ( 16, 16 ); | 95 | return QSize ( 16, 16 ); |
72 | } | 96 | } |
73 | 97 | ||
74 | bool OLedBox::isOn ( ) const | 98 | bool OLedBox::isOn ( ) const |
75 | { | 99 | { |
76 | return m_on; | 100 | return m_on; |
77 | } | 101 | } |
78 | 102 | ||
79 | QColor OLedBox::color ( ) const | 103 | QColor OLedBox::color ( ) const |
80 | { | 104 | { |
81 | return m_color; | 105 | return m_color; |
82 | } | 106 | } |
83 | 107 | ||
84 | void OLedBox::setOn ( bool b ) | 108 | void OLedBox::setOn ( bool b ) |
85 | { | 109 | { |
86 | if ( m_on != b ) { | 110 | if ( m_on != b ) { |
87 | m_on = b; | 111 | m_on = b; |
88 | update ( ); | 112 | update ( ); |
89 | } | 113 | } |
90 | } | 114 | } |
91 | 115 | ||
92 | void OLedBox::toggle ( ) | 116 | void OLedBox::toggle ( ) |
93 | { | 117 | { |
94 | setOn ( !isOn ( ) ); | 118 | setOn ( !isOn ( ) ); |
95 | } | 119 | } |
96 | 120 | ||
97 | void OLedBox::setColor ( const QColor &col ) | 121 | void OLedBox::setColor ( const QColor &col ) |
98 | { | 122 | { |
99 | if ( m_color != col ) { | 123 | if ( m_color != col ) { |
100 | m_color = col; | 124 | m_color = col; |
101 | 125 | ||
102 | delete m_pix [ 0 ]; | 126 | delete m_pix [ 0 ]; |
103 | delete m_pix [ 1 ]; | 127 | delete m_pix [ 1 ]; |
104 | m_pix[0] = m_pix[1] = 0; | 128 | m_pix[0] = m_pix[1] = 0; |
105 | update ( ); | 129 | update ( ); |
106 | } | 130 | } |
107 | } | 131 | } |
108 | 132 | ||
109 | void OLedBox::mousePressEvent ( QMouseEvent *e ) | 133 | void OLedBox::mousePressEvent ( QMouseEvent *e ) |
110 | { | 134 | { |
111 | if ( ! m_readonly && | 135 | if ( ! m_readonly && |
112 | e-> button ( ) == LeftButton ) { | 136 | e-> button ( ) == LeftButton ) { |
113 | m_on = !m_on; | 137 | m_on = !m_on; |
114 | update ( ); | 138 | update ( ); |
115 | emit toggled ( m_on ); | 139 | emit toggled ( m_on ); |
116 | } | 140 | } |
117 | } | 141 | } |
118 | 142 | ||
119 | 143 | ||
120 | void OLedBox::resizeEvent ( QResizeEvent * ) | 144 | void OLedBox::resizeEvent ( QResizeEvent * ) |
121 | { | 145 | { |
122 | delete m_pix [ 0 ]; | 146 | delete m_pix [ 0 ]; |
123 | delete m_pix [ 1 ]; | 147 | delete m_pix [ 1 ]; |
124 | m_pix[0] = m_pix[1] = 0; | 148 | m_pix[0] = m_pix[1] = 0; |
125 | 149 | ||
126 | update ( ); | 150 | update ( ); |
127 | } | 151 | } |
128 | 152 | ||
129 | void OLedBox::paintEvent ( QPaintEvent *e ) | 153 | void OLedBox::paintEvent ( QPaintEvent *e ) |
130 | { | 154 | { |
131 | int ind = m_on ? 1 : 0; | 155 | int ind = m_on ? 1 : 0; |
132 | 156 | ||
133 | if ( !m_pix [ ind ] ) { | 157 | if ( !m_pix [ ind ] ) { |
134 | m_pix [ ind ] = new QPixmap ( size ( )); | 158 | m_pix [ ind ] = new QPixmap ( size ( )); |
135 | 159 | ||
136 | drawLed ( m_pix [ ind ], m_on ? m_color : m_color. dark ( 300 ) ); | 160 | drawLed ( m_pix [ ind ], m_on ? m_color : m_color. dark ( 300 ) ); |
137 | } | 161 | } |
138 | if ( !e-> erased ( )) | 162 | if ( !e-> erased ( )) |
139 | erase ( ); | 163 | erase ( ); |
140 | 164 | ||
141 | QPainter p ( this ); | 165 | QPainter p ( this ); |
142 | p. drawPixmap ( 0, 0, *m_pix [ ind ] ); | 166 | p. drawPixmap ( 0, 0, *m_pix [ ind ] ); |
143 | } | 167 | } |
144 | 168 | ||
145 | // From KDE libkdeui / led.cpp | 169 | void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) |
146 | |||
147 | void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp | ||
148 | { | 170 | { |
149 | QPainter paint; | 171 | QPainter paint; |
150 | QColor color; | 172 | QColor color; |
151 | QBrush brush; | 173 | QBrush brush; |
152 | QPen pen; | 174 | QPen pen; |
153 | 175 | ||
154 | pix-> fill ( black ); | 176 | pix-> fill ( black ); |
155 | 177 | ||
156 | // First of all we want to know what area should be updated | 178 | // First of all we want to know what area should be updated |
157 | // Initialize coordinates, width, and height of the LED | 179 | // Initialize coordinates, width, and height of the LED |
158 | int width = pix-> width ( ); | 180 | int width = pix-> width ( ); |
159 | 181 | ||
160 | // Make sure the LED is round! | 182 | // Make sure the LED is round! |
161 | if ( width > pix-> height ( )) | 183 | if ( width > pix-> height ( )) |
162 | width = pix-> height ( ); | 184 | width = pix-> height ( ); |
163 | width -= 2; // leave one pixel border | 185 | width -= 2; // leave one pixel border |
164 | if ( width < 0 ) | 186 | if ( width < 0 ) |
165 | width = 0; | 187 | width = 0; |
166 | 188 | ||
167 | // maybe we could stop HERE, if width <=0 ? | 189 | // maybe we could stop HERE, if width <=0 ? |
168 | 190 | ||
169 | // start painting widget | 191 | // start painting widget |
170 | // | 192 | // |
171 | paint.begin( pix ); | 193 | paint.begin( pix ); |
172 | 194 | ||
173 | // Set the color of the LED according to given parameters | 195 | // Set the color of the LED according to given parameters |
174 | color = col; | 196 | color = col; |
175 | 197 | ||
176 | // Set the brush to SolidPattern, this fills the entire area | 198 | // Set the brush to SolidPattern, this fills the entire area |
177 | // of the ellipse which is drawn first | 199 | // of the ellipse which is drawn first |
178 | brush.setStyle( QBrush::SolidPattern ); | 200 | brush.setStyle( QBrush::SolidPattern ); |
179 | brush.setColor( color ); | 201 | brush.setColor( color ); |
180 | paint.setBrush( brush ); // Assign the brush to the painter | 202 | paint.setBrush( brush ); // Assign the brush to the painter |
181 | 203 | ||
182 | // Draws a "flat" LED with the given color: | 204 | // Draws a "flat" LED with the given color: |
183 | paint.drawEllipse( 1, 1, width, width ); | 205 | paint.drawEllipse( 1, 1, width, width ); |
184 | 206 | ||
185 | // Draw the bright light spot of the LED now, using modified "old" | 207 | // Draw the bright light spot of the LED now, using modified "old" |
186 | // painter routine taken from KDEUIs KLed widget: | 208 | // painter routine taken from KDEUIs KLed widget: |
187 | 209 | ||
188 | // Setting the new width of the pen is essential to avoid "pixelized" | 210 | // Setting the new width of the pen is essential to avoid "pixelized" |
189 | // shadow like it can be observed with the old LED code | 211 | // shadow like it can be observed with the old LED code |
190 | pen.setWidth( 2 ); | 212 | pen.setWidth( 2 ); |
191 | 213 | ||
192 | // shrink the light on the LED to a size about 2/3 of the complete LED | 214 | // shrink the light on the LED to a size about 2/3 of the complete LED |
193 | int pos = width / 5 + 1; | 215 | int pos = width / 5 + 1; |
194 | int light_width = width; | 216 | int light_width = width; |
195 | light_width *= 2; | 217 | light_width *= 2; |
196 | light_width /= 3; | 218 | light_width /= 3; |
197 | 219 | ||
198 | // Calculate the LEDs "light factor": | 220 | // Calculate the LEDs "light factor": |
199 | int light_quote = ( 130 * 2 / ( light_width ? light_width : 1 ) ) + 100; | 221 | int light_quote = ( 130 * 2 / ( light_width ? light_width : 1 ) ) + 100; |
200 | 222 | ||
201 | // Now draw the bright spot on the LED: | 223 | // Now draw the bright spot on the LED: |
202 | while ( light_width ) | 224 | while ( light_width ) |
203 | { | 225 | { |
204 | color = color.light( light_quote ); // make color lighter | 226 | color = color.light( light_quote ); // make color lighter |
205 | pen.setColor( color ); // set color as pen color | 227 | pen.setColor( color ); // set color as pen color |
206 | paint.setPen( pen ); // select the pen for drawing | 228 | paint.setPen( pen ); // select the pen for drawing |
207 | paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle) | 229 | paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle) |
208 | light_width--; | 230 | light_width--; |
209 | if ( !light_width ) | 231 | if ( !light_width ) |
210 | break; | 232 | break; |
211 | paint.drawEllipse( pos, pos, light_width, light_width ); | 233 | paint.drawEllipse( pos, pos, light_width, light_width ); |
212 | light_width--; | 234 | light_width--; |
213 | if ( !light_width ) | 235 | if ( !light_width ) |
214 | break; | 236 | break; |
215 | paint.drawEllipse( pos, pos, light_width, light_width ); | 237 | paint.drawEllipse( pos, pos, light_width, light_width ); |
216 | pos++; | 238 | pos++; |
217 | light_width--; | 239 | light_width--; |
218 | } | 240 | } |
219 | 241 | ||
220 | // Drawing of bright spot finished, now draw a thin border | 242 | // Drawing of bright spot finished, now draw a thin border |
221 | // around the LED which resembles a shadow with light coming | 243 | // around the LED which resembles a shadow with light coming |
222 | // from the upper left. | 244 | // from the upper left. |
223 | 245 | ||
224 | #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | 246 | #ifndef QT_CAN_DRAW_ARCS |
225 | paint. drawPixmap ( 0, 0, *s_border_pix ); | 247 | paint.drawPixmap ( 0, 0, *s_border_pix ); |
226 | paint. end ( ); | 248 | paint.end ( ); |
227 | 249 | ||
228 | pix-> setMask ( pix-> createHeuristicMask ( )); | 250 | pix->setMask ( pix-> createHeuristicMask ( )); |
229 | 251 | ||
230 | #else | 252 | #else |
231 | pen.setWidth( 3 ); | 253 | pen.setWidth( 3 ); |
232 | brush.setStyle( QBrush::NoBrush ); // Switch off the brush | 254 | brush.setStyle( QBrush::NoBrush ); // Switch off the brush |
233 | paint.setBrush( brush ); // This avoids filling of the ellipse | 255 | paint.setBrush( brush ); // This avoids filling of the ellipse |
234 | 256 | ||
235 | // Set the initial color value to 200 (bright) and start | 257 | // Set the initial color value to 200 (bright) and start |
236 | // drawing the shadow border at 45 (45*16 = 720). | 258 | // drawing the shadow border at 45 (45*16 = 720). |
237 | int shadow_color = 200, angle; | 259 | int shadow_color = 200, angle; |
238 | 260 | ||
239 | for ( angle = 720; angle < 6480; angle += 240 ) | 261 | for ( angle = 720; angle < 6480; angle += 240 ) |
240 | { | 262 | { |
241 | color.setRgb( shadow_color, shadow_color, shadow_color ); | 263 | color.setRgb( shadow_color, shadow_color, shadow_color ); |
242 | pen.setColor( color ); | 264 | pen.setColor( color ); |
243 | paint.setPen( pen ); | 265 | paint.setPen( pen ); |
244 | paint.drawArc( 0, 0, width+2, width+2, angle, 240 ); | 266 | paint.drawArc( 0, 0, width+2, width+2, angle, 240 ); |
245 | paint.drawArc( 1, 1, width, width, angle, 240 ); | 267 | paint.drawArc( 1, 1, width, width, angle, 240 ); |
246 | paint.drawArc( 2, 2, width-2, width-2, angle, 240 ); | 268 | paint.drawArc( 2, 2, width-2, width-2, angle, 240 ); |
247 | if ( angle < 2320 ) { | 269 | if ( angle < 2320 ) { |
248 | shadow_color -= 25; // set color to a darker value | 270 | shadow_color -= 25; // set color to a darker value |
249 | if ( shadow_color < 100 ) | 271 | if ( shadow_color < 100 ) |
250 | shadow_color = 100; | 272 | shadow_color = 100; |
251 | } | 273 | } |
252 | else if ( ( angle > 2320 ) && ( angle < 5760 ) ) { | 274 | else if ( ( angle > 2320 ) && ( angle < 5760 ) ) { |
253 | shadow_color += 25; // set color to a brighter value | 275 | shadow_color += 25; // set color to a brighter value |
254 | if ( shadow_color > 255 ) | 276 | if ( shadow_color > 255 ) |
255 | shadow_color = 255; | 277 | shadow_color = 255; |
256 | } | 278 | } |
257 | else { | 279 | else { |
258 | shadow_color -= 25; // set color to a darker value again | 280 | shadow_color -= 25; // set color to a darker value again |
259 | if ( shadow_color < 100 ) | 281 | if ( shadow_color < 100 ) |
260 | shadow_color = 100; | 282 | shadow_color = 100; |
261 | } // end if ( angle < 2320 ) | 283 | } // end if ( angle < 2320 ) |
262 | } // end for ( angle = 720; angle < 6480; angle += 160 ) | 284 | } // end for ( angle = 720; angle < 6480; angle += 160 ) |
263 | paint.end(); | 285 | paint.end(); |
264 | // | 286 | // |
265 | // painting done | 287 | // painting done |
266 | 288 | ||
267 | QBitmap mask ( pix-> width ( ), pix-> height ( ), true ); | 289 | QBitmap mask ( pix-> width ( ), pix-> height ( ), true ); |
268 | QPainter mp ( &mask ); | 290 | QPainter mp ( &mask ); |
269 | mp. setPen ( Qt::NoPen ); | 291 | mp. setPen ( Qt::NoPen ); |
270 | mp. setBrush ( Qt::color1 ); | 292 | mp. setBrush ( Qt::color1 ); |
271 | mp. drawEllipse ( 0, 0, width + 2, width + 2 ); | 293 | mp. drawEllipse ( 0, 0, width + 2, width + 2 ); |
272 | mp. end ( ); | 294 | mp. end ( ); |
273 | 295 | ||
274 | pix-> setMask ( mask ); | 296 | pix-> setMask ( mask ); |
275 | #endif | 297 | #endif |
276 | } | 298 | } |
277 | 299 | ||
300 | }; | ||
301 | }; | ||
diff --git a/libopie2/opieui/oledbox.h b/libopie2/opieui/oledbox.h index dd930bd..c02cc77 100644 --- a/libopie2/opieui/oledbox.h +++ b/libopie2/opieui/oledbox.h | |||
@@ -1,56 +1,85 @@ | |||
1 | #ifndef __OPIE_OLED_H__ | 1 | /* |
2 | #define __OPIE_OLED_H__ | 2 | This file is part of the Opie Project |
3 | =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org> | ||
4 | .=l. | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This program is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This program is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
3 | 27 | ||
28 | */ | ||
29 | |||
30 | #ifndef OLEDBOX_H | ||
31 | #define OLEDBOX_H | ||
32 | |||
33 | /* QT */ | ||
4 | #include <qwidget.h> | 34 | #include <qwidget.h> |
5 | #include <qcolor.h> | 35 | #include <qcolor.h> |
6 | 36 | ||
7 | class QPixmap; | 37 | class QPixmap; |
8 | 38 | ||
9 | #define _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | 39 | namespace Opie { |
40 | namespace Ui { | ||
10 | 41 | ||
11 | class OLedBox : public QWidget { | 42 | class OLedBox : public QWidget |
12 | Q_OBJECT | 43 | { |
13 | 44 | Q_OBJECT | |
14 | public: | ||
15 | OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 ); | ||
16 | virtual ~OLedBox ( ); | ||
17 | 45 | ||
18 | QColor color ( ) const; | 46 | public: |
19 | bool isOn ( ) const; | 47 | OLedBox( const QColor& col = red, QWidget* parent = 0, const char* name = 0 ); |
20 | void setReadOnly( bool R ) | 48 | virtual ~OLedBox(); |
21 | { m_readonly = R; } | ||
22 | inline bool readOnly( void ) const | ||
23 | { return m_readonly; } | ||
24 | |||
25 | virtual QSize sizeHint ( ) const; | ||
26 | 49 | ||
27 | public slots: | 50 | QColor color() const; |
28 | void toggle ( ); | 51 | bool isOn() const; |
29 | void setOn ( bool on ); | 52 | void setReadOnly( bool R ) { m_readonly = R; } |
30 | void setColor ( const QColor &col ); | 53 | bool readOnly( void ) const { return m_readonly; } |
54 | |||
55 | virtual QSize sizeHint() const; | ||
56 | |||
57 | public slots: | ||
58 | void toggle(); | ||
59 | void setOn( bool on ); | ||
60 | void setColor( const QColor& col ); | ||
31 | 61 | ||
32 | signals: | 62 | signals: |
33 | void toggled ( bool ); | 63 | void toggled( bool ); |
34 | 64 | ||
35 | protected: | 65 | protected: |
36 | virtual void paintEvent ( QPaintEvent *e ); | 66 | virtual void paintEvent( QPaintEvent* e ); |
37 | virtual void resizeEvent ( QResizeEvent *e ); | 67 | virtual void resizeEvent( QResizeEvent* e ); |
38 | 68 | ||
39 | virtual void mousePressEvent ( QMouseEvent *e ); | 69 | virtual void mousePressEvent( QMouseEvent* e ); |
40 | 70 | ||
41 | private: | 71 | private: |
42 | void drawLed ( QPixmap *, const QColor &col ); | 72 | void drawLed( QPixmap *, const QColor& col ); |
43 | 73 | ||
44 | private: | 74 | private: |
45 | QPixmap *m_pix [2]; | 75 | QPixmap *m_pix [2]; |
46 | 76 | ||
47 | QColor m_color; | 77 | QColor m_color; |
48 | bool m_on; | 78 | bool m_on; |
49 | bool m_readonly; | 79 | bool m_readonly; |
50 | 80 | ||
51 | #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | ||
52 | static QPixmap *s_border_pix; | 81 | static QPixmap *s_border_pix; |
53 | #endif | ||
54 | }; | 82 | }; |
55 | 83 | }; | |
84 | }; | ||
56 | #endif | 85 | #endif |
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro index 24157a1..ffa8b83 100644 --- a/libopie2/opieui/opieui.pro +++ b/libopie2/opieui/opieui.pro | |||
@@ -1,65 +1,65 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = oclickablelabel.h \ | 4 | HEADERS = oclickablelabel.h \ |
5 | odialog.h \ | 5 | odialog.h \ |
6 | ofontselector.h \ | 6 | ofontselector.h \ |
7 | oimageeffect.h \ | 7 | oimageeffect.h \ |
8 | okeyconfigwidget.h \ | 8 | okeyconfigwidget.h \ |
9 | oledbox.h \ | ||
9 | olistview.h \ | 10 | olistview.h \ |
10 | opixmapeffect.h \ | 11 | opixmapeffect.h \ |
11 | opopupmenu.h \ | 12 | opopupmenu.h \ |
12 | opixmapprovider.h \ | 13 | opixmapprovider.h \ |
13 | oselector.h \ | 14 | oselector.h \ |
14 | oseparator.h \ | 15 | oseparator.h \ |
15 | otabinfo.h \ | 16 | otabinfo.h \ |
16 | otabbar.h \ | 17 | otabbar.h \ |
17 | otabwidget.h \ | 18 | otabwidget.h \ |
18 | oledbox.h \ | ||
19 | otaskbarapplet.h \ | 19 | otaskbarapplet.h \ |
20 | otimepicker.h \ | 20 | otimepicker.h \ |
21 | oversatileview.h \ | 21 | oversatileview.h \ |
22 | oversatileviewitem.h \ | 22 | oversatileviewitem.h \ |
23 | owait.h | 23 | owait.h |
24 | 24 | ||
25 | SOURCES = oclickablelabel.cpp \ | 25 | SOURCES = oclickablelabel.cpp \ |
26 | odialog.cpp \ | 26 | odialog.cpp \ |
27 | ofontselector.cpp \ | 27 | ofontselector.cpp \ |
28 | oimageeffect.cpp \ | 28 | oimageeffect.cpp \ |
29 | okeyconfigwidget.cpp \ | 29 | okeyconfigwidget.cpp \ |
30 | oledbox.cpp \ | ||
30 | olistview.cpp \ | 31 | olistview.cpp \ |
31 | opixmapeffect.cpp \ | 32 | opixmapeffect.cpp \ |
32 | opopupmenu.cpp \ | 33 | opopupmenu.cpp \ |
33 | opixmapprovider.cpp \ | 34 | opixmapprovider.cpp \ |
34 | oselector.cpp \ | 35 | oselector.cpp \ |
35 | oseparator.cpp \ | 36 | oseparator.cpp \ |
36 | otabbar.cpp \ | 37 | otabbar.cpp \ |
37 | otabwidget.cpp \ | 38 | otabwidget.cpp \ |
38 | oledbox.cpp \ | ||
39 | otaskbarapplet.cpp \ | 39 | otaskbarapplet.cpp \ |
40 | otimepicker.cpp \ | 40 | otimepicker.cpp \ |
41 | oversatileview.cpp \ | 41 | oversatileview.cpp \ |
42 | oversatileviewitem.cpp \ | 42 | oversatileviewitem.cpp \ |
43 | owait.cpp | 43 | owait.cpp |
44 | 44 | ||
45 | include( big-screen/big-screen.pro ) | 45 | include( big-screen/big-screen.pro ) |
46 | include( fileselector/fileselector.pro ) | 46 | include( fileselector/fileselector.pro ) |
47 | 47 | ||
48 | INTERFACES = otimepickerbase.ui | 48 | INTERFACES = otimepickerbase.ui |
49 | 49 | ||
50 | TARGET = opieui2 | 50 | TARGET = opieui2 |
51 | VERSION = 1.8.5 | 51 | VERSION = 1.9.0 |
52 | 52 | ||
53 | INCLUDEPATH += $(OPIEDIR)/include | 53 | INCLUDEPATH += $(OPIEDIR)/include |
54 | DEPENDPATH += $(OPIEDIR)/include | 54 | DEPENDPATH += $(OPIEDIR)/include |
55 | 55 | ||
56 | LIBS += -lopiecore2 | 56 | LIBS += -lopiecore2 |
57 | 57 | ||
58 | !contains( platform, x11 ) { | 58 | !contains( platform, x11 ) { |
59 | include( $(OPIEDIR)/include.pro ) | 59 | include( $(OPIEDIR)/include.pro ) |
60 | } | 60 | } |
61 | 61 | ||
62 | contains( platform, x11 ) { | 62 | contains( platform, x11 ) { |
63 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 63 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
64 | } | 64 | } |
65 | 65 | ||