summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-04 23:02:52 (UTC)
committer mickeyl <mickeyl>2005-01-04 23:02:52 (UTC)
commitb41e4499d41fc92cc1ed4ed487e57d0a002c1a02 (patch) (side-by-side diff)
tree828e8b126797d6c317194569ea80eb4421914803
parent9826b609736b73068b534ee67183de620b4a5ccf (diff)
downloadopie-b41e4499d41fc92cc1ed4ed487e57d0a002c1a02.zip
opie-b41e4499d41fc92cc1ed4ed487e57d0a002c1a02.tar.gz
opie-b41e4499d41fc92cc1ed4ed487e57d0a002c1a02.tar.bz2
- use proper file headers
- use namespaces - sort alphabetically in .pro file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/oledbox.cpp58
-rw-r--r--libopie2/opieui/oledbox.h95
-rw-r--r--libopie2/opieui/opieui.pro6
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,84 +1,108 @@
-
-#include <qbitmap.h>
-#include <qpainter.h>
+/*
+                 This file is part of the Opie Project
+ =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org>
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#include "oledbox.h"
+/* QT */
+#include <qbitmap.h>
+#include <qpainter.h>
-#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
+namespace Opie {
+namespace Ui {
/* XPM */
static const char * ledborder_xpm[] = {
"16 16 11 1",
" c None",
". c #626562",
"+ c #7B7D7B",
"@ c #949594",
"# c #ACAEAC",
"$ c #CDCACD",
"% c #CDCECD",
"; c #E6E6E6",
"> c #FFFFFF",
", c #E6E2E6",
"' c #FFFAFF",
" .++@@# ",
" ...++@@##$ ",
" .....+@##$$% ",
" ..... #$%%% ",
" ... %%; ",
".... ;;;;",
"++. ;>>",
"+++ >>>",
"@@@ >>>",
"@@# >>>",
"#### >>>>",
" #$$ >>> ",
" $$,,' >>>>> ",
" ,,,''>>>>>>> ",
" ,''>>>>>>> ",
" '>>>>> "};
QPixmap *OLedBox::s_border_pix = 0;
-#endif
-
-
OLedBox::OLedBox ( const QColor &col, QWidget *parent, const char *name ) : QWidget ( parent, name )
{
m_color = col;
m_on = false;
m_readonly = true;
m_pix [ 0 ] = m_pix [ 1 ] = 0;
setBackgroundMode ( PaletteBackground );
-#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
if ( !s_border_pix )
- s_border_pix = new QPixmap ( ledborder_xpm );
-#endif
+ s_border_pix = new QPixmap( ledborder_xpm );
}
OLedBox::~OLedBox ( )
{
delete m_pix [ 0 ];
delete m_pix [ 1 ];
}
QSize OLedBox::sizeHint ( ) const
{
return QSize ( 16, 16 );
}
bool OLedBox::isOn ( ) const
{
return m_on;
}
QColor OLedBox::color ( ) const
{
return m_color;
}
void OLedBox::setOn ( bool b )
@@ -121,51 +145,49 @@ void OLedBox::resizeEvent ( QResizeEvent * )
{
delete m_pix [ 0 ];
delete m_pix [ 1 ];
m_pix[0] = m_pix[1] = 0;
update ( );
}
void OLedBox::paintEvent ( QPaintEvent *e )
{
int ind = m_on ? 1 : 0;
if ( !m_pix [ ind ] ) {
m_pix [ ind ] = new QPixmap ( size ( ));
drawLed ( m_pix [ ind ], m_on ? m_color : m_color. dark ( 300 ) );
}
if ( !e-> erased ( ))
erase ( );
QPainter p ( this );
p. drawPixmap ( 0, 0, *m_pix [ ind ] );
}
-// From KDE libkdeui / led.cpp
-
-void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNKEN led lamp
+void OLedBox::drawLed ( QPixmap *pix, const QColor &col )
{
QPainter paint;
QColor color;
QBrush brush;
QPen pen;
pix-> fill ( black );
// First of all we want to know what area should be updated
// Initialize coordinates, width, and height of the LED
int width = pix-> width ( );
// Make sure the LED is round!
if ( width > pix-> height ( ))
width = pix-> height ( );
width -= 2; // leave one pixel border
if ( width < 0 )
width = 0;
// maybe we could stop HERE, if width <=0 ?
// start painting widget
//
paint.begin( pix );
@@ -200,53 +222,53 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK
// Now draw the bright spot on the LED:
while ( light_width )
{
color = color.light( light_quote ); // make color lighter
pen.setColor( color ); // set color as pen color
paint.setPen( pen ); // select the pen for drawing
paint.drawEllipse( pos, pos, light_width, light_width ); // draw the ellipse (circle)
light_width--;
if ( !light_width )
break;
paint.drawEllipse( pos, pos, light_width, light_width );
light_width--;
if ( !light_width )
break;
paint.drawEllipse( pos, pos, light_width, light_width );
pos++;
light_width--;
}
// Drawing of bright spot finished, now draw a thin border
// around the LED which resembles a shadow with light coming
// from the upper left.
-#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
- paint. drawPixmap ( 0, 0, *s_border_pix );
- paint. end ( );
+#ifndef QT_CAN_DRAW_ARCS
+ paint.drawPixmap ( 0, 0, *s_border_pix );
+ paint.end ( );
- pix-> setMask ( pix-> createHeuristicMask ( ));
+ pix->setMask ( pix-> createHeuristicMask ( ));
#else
pen.setWidth( 3 );
brush.setStyle( QBrush::NoBrush ); // Switch off the brush
paint.setBrush( brush ); // This avoids filling of the ellipse
// Set the initial color value to 200 (bright) and start
// drawing the shadow border at 45 (45*16 = 720).
int shadow_color = 200, angle;
for ( angle = 720; angle < 6480; angle += 240 )
{
color.setRgb( shadow_color, shadow_color, shadow_color );
pen.setColor( color );
paint.setPen( pen );
paint.drawArc( 0, 0, width+2, width+2, angle, 240 );
paint.drawArc( 1, 1, width, width, angle, 240 );
paint.drawArc( 2, 2, width-2, width-2, angle, 240 );
if ( angle < 2320 ) {
shadow_color -= 25; // set color to a darker value
if ( shadow_color < 100 )
shadow_color = 100;
}
else if ( ( angle > 2320 ) && ( angle < 5760 ) ) {
@@ -254,24 +276,26 @@ void OLedBox::drawLed ( QPixmap *pix, const QColor &col ) // paint a ROUND SUNK
if ( shadow_color > 255 )
shadow_color = 255;
}
else {
shadow_color -= 25; // set color to a darker value again
if ( shadow_color < 100 )
shadow_color = 100;
} // end if ( angle < 2320 )
} // end for ( angle = 720; angle < 6480; angle += 160 )
paint.end();
//
// painting done
QBitmap mask ( pix-> width ( ), pix-> height ( ), true );
QPainter mp ( &mask );
mp. setPen ( Qt::NoPen );
mp. setBrush ( Qt::color1 );
mp. drawEllipse ( 0, 0, width + 2, width + 2 );
mp. end ( );
pix-> setMask ( mask );
#endif
}
+};
+};
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 @@
-#ifndef __OPIE_OLED_H__
-#define __OPIE_OLED_H__
+/*
+                 This file is part of the Opie Project
+ =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org>
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This program is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef OLEDBOX_H
+#define OLEDBOX_H
+
+/* QT */
#include <qwidget.h>
#include <qcolor.h>
class QPixmap;
-#define _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
+namespace Opie {
+namespace Ui {
-class OLedBox : public QWidget {
- Q_OBJECT
-
-public:
- OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 );
- virtual ~OLedBox ( );
+class OLedBox : public QWidget
+{
+ Q_OBJECT
- QColor color ( ) const;
- bool isOn ( ) const;
- void setReadOnly( bool R )
- { m_readonly = R; }
- inline bool readOnly( void ) const
- { return m_readonly; }
-
- virtual QSize sizeHint ( ) const;
+ public:
+ OLedBox( const QColor& col = red, QWidget* parent = 0, const char* name = 0 );
+ virtual ~OLedBox();
-public slots:
- void toggle ( );
- void setOn ( bool on );
- void setColor ( const QColor &col );
+ QColor color() const;
+ bool isOn() const;
+ void setReadOnly( bool R ) { m_readonly = R; }
+ bool readOnly( void ) const { return m_readonly; }
+
+ virtual QSize sizeHint() const;
+
+ public slots:
+ void toggle();
+ void setOn( bool on );
+ void setColor( const QColor& col );
-signals:
- void toggled ( bool );
+ signals:
+ void toggled( bool );
-protected:
- virtual void paintEvent ( QPaintEvent *e );
- virtual void resizeEvent ( QResizeEvent *e );
+ protected:
+ virtual void paintEvent( QPaintEvent* e );
+ virtual void resizeEvent( QResizeEvent* e );
- virtual void mousePressEvent ( QMouseEvent *e );
+ virtual void mousePressEvent( QMouseEvent* e );
-private:
- void drawLed ( QPixmap *, const QColor &col );
+ private:
+ void drawLed( QPixmap *, const QColor& col );
-private:
+ private:
QPixmap *m_pix [2];
QColor m_color;
bool m_on;
bool m_readonly;
-#ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
static QPixmap *s_border_pix;
-#endif
};
-
+};
+};
#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 @@
TEMPLATE = lib
CONFIG += qt warn_on
DESTDIR = $(OPIEDIR)/lib
HEADERS = oclickablelabel.h \
odialog.h \
ofontselector.h \
oimageeffect.h \
okeyconfigwidget.h \
+ oledbox.h \
olistview.h \
opixmapeffect.h \
opopupmenu.h \
opixmapprovider.h \
oselector.h \
oseparator.h \
otabinfo.h \
otabbar.h \
otabwidget.h \
- oledbox.h \
otaskbarapplet.h \
otimepicker.h \
oversatileview.h \
oversatileviewitem.h \
owait.h
SOURCES = oclickablelabel.cpp \
odialog.cpp \
ofontselector.cpp \
oimageeffect.cpp \
okeyconfigwidget.cpp \
+ oledbox.cpp \
olistview.cpp \
opixmapeffect.cpp \
opopupmenu.cpp \
opixmapprovider.cpp \
oselector.cpp \
oseparator.cpp \
otabbar.cpp \
otabwidget.cpp \
- oledbox.cpp \
otaskbarapplet.cpp \
otimepicker.cpp \
oversatileview.cpp \
oversatileviewitem.cpp \
owait.cpp
include( big-screen/big-screen.pro )
include( fileselector/fileselector.pro )
INTERFACES = otimepickerbase.ui
TARGET = opieui2
-VERSION = 1.8.5
+VERSION = 1.9.0
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lopiecore2
!contains( platform, x11 ) {
include( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
}