summaryrefslogtreecommitdiff
authordrw <drw>2002-05-18 20:59:09 (UTC)
committer drw <drw>2002-05-18 20:59:09 (UTC)
commit1d935738d89d038e05013d8d099bcf4da14073ea (patch) (unidiff)
tree449b1a9185ede01d2fe7f90249603bc3a2f4f473
parentdd86981ce4191e7916dc97c114267763c9a07018 (diff)
downloadopie-1d935738d89d038e05013d8d099bcf4da14073ea.zip
opie-1d935738d89d038e05013d8d099bcf4da14073ea.tar.gz
opie-1d935738d89d038e05013d8d099bcf4da14073ea.tar.bz2
Added Launcher icon text and background color options
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 6354bb7..1598d13 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -33,33 +33,41 @@
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qdict.h> 34#include <qdict.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qfileinfo.h> 36#include <qfileinfo.h>
37#include <qhbox.h> 37#include <qhbox.h>
38#include <qiconview.h> 38#include <qiconview.h>
39#include <qpainter.h> 39#include <qpainter.h>
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42 42
43class LauncherIconView : public QIconView { 43class LauncherIconView : public QIconView {
44public: 44public:
45 QColor iconText;
46 QColor background;
47
45 LauncherIconView( QWidget* parent, const char* name=0 ) : 48 LauncherIconView( QWidget* parent, const char* name=0 ) :
46 QIconView(parent,name), 49 QIconView(parent,name),
47 tf(""), 50 tf(""),
48 cf(0), 51 cf(0),
49 bsy(0) 52 bsy(0)
50 { 53 {
51 sortmeth = Name; 54 sortmeth = Name;
52 hidden.setAutoDelete(TRUE); 55 hidden.setAutoDelete(TRUE);
53 ike = FALSE; 56 ike = FALSE;
57
58 Config config( "qpe" );
59 config.setGroup( "Appearance" );
60 iconText = QColor( config.readEntry( "LauncherIconText", "#000000" ) );
61 background = QColor( config.readEntry( "LauncherBackground", "#FFFFFF" ) );
54 } 62 }
55 63
56 ~LauncherIconView() 64 ~LauncherIconView()
57 { 65 {
58#if 0 // debuggery 66#if 0 // debuggery
59 QListIterator<AppLnk> it(hidden); 67 QListIterator<AppLnk> it(hidden);
60 AppLnk* l; 68 AppLnk* l;
61 while ((l=it.current())) { 69 while ((l=it.current())) {
62 ++it; 70 ++it;
63 //qDebug("%p: hidden (should remove)",l); 71 //qDebug("%p: hidden (should remove)",l);
64 } 72 }
65#endif 73#endif
@@ -138,25 +146,26 @@ public:
138 146
139 // Double buffer the background 147 // Double buffer the background
140 static QPixmap *bg = NULL; 148 static QPixmap *bg = NULL;
141 static QColor bgColor; 149 static QColor bgColor;
142 150
143 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { 151 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) {
144 // Create a new background double buffer 152 // Create a new background double buffer
145 if (bg == NULL) 153 if (bg == NULL)
146 bg = new QPixmap( width(), height() ); 154 bg = new QPixmap( width(), height() );
147 bgColor = colorGroup().button(); 155 bgColor = colorGroup().button();
148 QPainter painter( bg ); 156 QPainter painter( bg );
149 157
150 painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); 158// painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110));
159 painter.fillRect( QRect( 0, 0, width(), height() ), background);
151 // Overlay the Qtopia logo in the center 160 // Overlay the Qtopia logo in the center
152 QImage logo; 161 QImage logo;
153 if (QFile::exists(backgroundImage)) { 162 if (QFile::exists(backgroundImage)) {
154 logo = QImage(backgroundImage); 163 logo = QImage(backgroundImage);
155 } else { 164 } else {
156 logo = Resource::loadImage(backgroundImage ); 165 logo = Resource::loadImage(backgroundImage );
157 } 166 }
158 if ( !logo.isNull() ) 167 if ( !logo.isNull() )
159 painter.drawImage( (width() - logo.width()) / 2, 168 painter.drawImage( (width() - logo.width()) / 2,
160 (height() - logo.height()) / 2, logo ); 169 (height() - logo.height()) / 2, logo );
161 } 170 }
162 171
@@ -278,24 +287,28 @@ public:
278 287
279 virtual int compare ( QIconViewItem * i ) const; 288 virtual int compare ( QIconViewItem * i ) const;
280 289
281 void paintItem( QPainter *p, const QColorGroup &cg ) 290 void paintItem( QPainter *p, const QColorGroup &cg )
282 { 291 {
283 LauncherIconView* liv = (LauncherIconView*)iconView(); 292 LauncherIconView* liv = (LauncherIconView*)iconView();
284 QBrush oldBrush( liv->itemTextBackground() ); 293 QBrush oldBrush( liv->itemTextBackground() );
285 QColorGroup mycg( cg ); 294 QColorGroup mycg( cg );
286 if ( liv->currentItem() == this ) { 295 if ( liv->currentItem() == this ) {
287 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); 296 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
288 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); 297 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
289 } 298 }
299 else {
300 mycg.setColor( QColorGroup::Text, liv->iconText );
301 }
302
290 QIconViewItem::paintItem(p,mycg); 303 QIconViewItem::paintItem(p,mycg);
291 if ( liv->currentItem() == this ) 304 if ( liv->currentItem() == this )
292 liv->setItemTextBackground( oldBrush ); 305 liv->setItemTextBackground( oldBrush );
293 if ( liv->busyItem() == this ) { 306 if ( liv->busyItem() == this ) {
294 static QPixmap* busypm=0; 307 static QPixmap* busypm=0;
295 if ( !busypm ) 308 if ( !busypm )
296 busypm = new QPixmap(Resource::loadPixmap("launching")); 309 busypm = new QPixmap(Resource::loadPixmap("launching"));
297 p->drawPixmap(x()+(width()-busypm->width())/2, y(),*busypm); 310 p->drawPixmap(x()+(width()-busypm->width())/2, y(),*busypm);
298 } 311 }
299 } 312 }
300 313
301protected: 314protected: