summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opieui/oledbox.cpp50
-rw-r--r--libopie2/opieui/oledbox.h53
-rw-r--r--libopie2/opieui/opieui.pro6
3 files changed, 81 insertions, 28 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,20 +1,49 @@
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 36namespace Opie {
37namespace Ui {
9 38
10/* XPM */ 39/* XPM */
11static const char * ledborder_xpm[] = { 40static 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",
@@ -32,41 +61,36 @@ static const char * ledborder_xpm[] = {
32"@@@ >>>", 61"@@@ >>>",
33"@@# >>>", 62"@@# >>>",
34"#### >>>>", 63"#### >>>>",
35" #$$ >>> ", 64" #$$ >>> ",
36" $$,,' >>>>> ", 65" $$,,' >>>>> ",
37" ,,,''>>>>>>> ", 66" ,,,''>>>>>>> ",
38" ,''>>>>>>> ", 67" ,''>>>>>>> ",
39" '>>>>> "}; 68" '>>>>> "};
40 69
41 70
42QPixmap *OLedBox::s_border_pix = 0; 71QPixmap *OLedBox::s_border_pix = 0;
43 72
44#endif
45
46
47OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name ) 73OLedBox::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
63OLedBox::~OLedBox ( ) 87OLedBox::~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
69QSize OLedBox::sizeHint ( ) const 93QSize OLedBox::sizeHint ( ) const
70{ 94{
71 return QSize ( 16, 16 ); 95 return QSize ( 16, 16 );
72} 96}
@@ -133,27 +157,25 @@ void OLedBox::paintEvent ( QPaintEvent *e )
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 169void OLedBox::drawLed ( QPixmap *pix, const QColor &col )
146
147void 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
@@ -212,25 +234,25 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK
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).
@@ -266,12 +288,14 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK
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,35 +1,65 @@
1#ifndef __OPIE_OLED_H__ 1/*
2#define __OPIE_OLED_H__ 2                 This file is part of the Opie Project
3 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*/
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
7class QPixmap; 37class QPixmap;
8 38
9#define _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 39namespace Opie {
40namespace Ui {
10 41
11class OLedBox : public QWidget { 42class OLedBox : public QWidget
43{
12 Q_OBJECT 44 Q_OBJECT
13 45
14public: 46public:
15 OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 ); 47 OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 );
16 virtual ~OLedBox ( ); 48 virtual ~OLedBox ( );
17 49
18 QColor color ( ) const; 50 QColor color ( ) const;
19 bool isOn ( ) const; 51 bool isOn ( ) const;
20 void setReadOnly( bool R ) 52 void setReadOnly( bool R ) { m_readonly = R; }
21 { m_readonly = R; } 53 bool readOnly( void ) const { return m_readonly; }
22 inline bool readOnly( void ) const
23 { return m_readonly; }
24 54
25 virtual QSize sizeHint ( ) const; 55 virtual QSize sizeHint ( ) const;
26 56
27public slots: 57public slots:
28 void toggle ( ); 58 void toggle ( );
29 void setOn ( bool on ); 59 void setOn ( bool on );
30 void setColor ( const QColor &col ); 60 void setColor ( const QColor &col );
31 61
32signals: 62signals:
33 void toggled ( bool ); 63 void toggled ( bool );
34 64
35protected: 65protected:
@@ -39,18 +69,17 @@ protected:
39 virtual void mousePressEvent ( QMouseEvent *e ); 69 virtual void mousePressEvent ( QMouseEvent *e );
40 70
41private: 71private:
42 void drawLed ( QPixmap *, const QColor &col ); 72 void drawLed ( QPixmap *, const QColor &col );
43 73
44private: 74private:
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,63 +1,63 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = oclickablelabel.h \ 4HEADERS = 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
25SOURCES = oclickablelabel.cpp \ 25SOURCES = 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
45include( big-screen/big-screen.pro ) 45include( big-screen/big-screen.pro )
46include( fileselector/fileselector.pro ) 46include( fileselector/fileselector.pro )
47 47
48INTERFACES = otimepickerbase.ui 48INTERFACES = otimepickerbase.ui
49 49
50TARGET = opieui2 50TARGET = opieui2
51VERSION = 1.8.5 51VERSION = 1.9.0
52 52
53INCLUDEPATH += $(OPIEDIR)/include 53INCLUDEPATH += $(OPIEDIR)/include
54DEPENDPATH += $(OPIEDIR)/include 54DEPENDPATH += $(OPIEDIR)/include
55 55
56LIBS += -lopiecore2 56LIBS += -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
62contains( platform, x11 ) { 62contains( platform, x11 ) {
63 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 63 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib