-rw-r--r-- | core/launcher/launcherview.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 7b20fdc..0df949e 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -14,24 +14,25 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "launcherview.h" | 21 | #include "launcherview.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/applnk.h> | 24 | #include <qpe/applnk.h> |
25 | #include <qpe/qpedebug.h> | 25 | #include <qpe/qpedebug.h> |
26 | #include <qpe/config.h> | ||
26 | #include <qpe/categories.h> | 27 | #include <qpe/categories.h> |
27 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
28 | #include <qpe/menubutton.h> | 29 | #include <qpe/menubutton.h> |
29 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
30 | #include <qpe/qpetoolbar.h> | 31 | #include <qpe/qpetoolbar.h> |
31 | 32 | ||
32 | #include <qtimer.h> | 33 | #include <qtimer.h> |
33 | #include <qdict.h> | 34 | #include <qdict.h> |
34 | #include <qfile.h> | 35 | #include <qfile.h> |
35 | #include <qfileinfo.h> | 36 | #include <qfileinfo.h> |
36 | #include <qhbox.h> | 37 | #include <qhbox.h> |
37 | #include <qiconview.h> | 38 | #include <qiconview.h> |
@@ -117,44 +118,53 @@ public: | |||
117 | // cats.replace(*cit,(void*)1); | 118 | // cats.replace(*cit,(void*)1); |
118 | // } | 119 | // } |
119 | QString maj=app->type(); | 120 | QString maj=app->type(); |
120 | int sl=maj.find('/'); | 121 | int sl=maj.find('/'); |
121 | if (sl>=0) { | 122 | if (sl>=0) { |
122 | QString k = maj.left(sl); | 123 | QString k = maj.left(sl); |
123 | mimes.replace(k,(void*)1); | 124 | mimes.replace(k,(void*)1); |
124 | } | 125 | } |
125 | } | 126 | } |
126 | 127 | ||
127 | void drawBackground( QPainter *p, const QRect &r ) | 128 | void drawBackground( QPainter *p, const QRect &r ) |
128 | { | 129 | { |
130 | Config config("qpe"); | ||
131 | config.setGroup("Appearance"); | ||
132 | QString backgroundImage = config.readEntry("BackgroundImage"); | ||
133 | |||
134 | if (backgroundImage.isNull()) backgroundImage="qpe-background"; | ||
129 | int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; | 135 | int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; |
130 | //int backgroundMode = 2; | 136 | //int backgroundMode = 2; |
131 | 137 | ||
132 | if ( backgroundMode == 1 ) { | 138 | if ( backgroundMode == 1 ) { |
133 | 139 | ||
134 | // Double buffer the background | 140 | // Double buffer the background |
135 | static QPixmap *bg = NULL; | 141 | static QPixmap *bg = NULL; |
136 | static QColor bgColor; | 142 | static QColor bgColor; |
137 | 143 | ||
138 | if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { | 144 | if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { |
139 | // Create a new background double buffer | 145 | // Create a new background double buffer |
140 | if (bg == NULL) | 146 | if (bg == NULL) |
141 | bg = new QPixmap( width(), height() ); | 147 | bg = new QPixmap( width(), height() ); |
142 | bgColor = colorGroup().button(); | 148 | bgColor = colorGroup().button(); |
143 | QPainter painter( bg ); | 149 | QPainter painter( bg ); |
144 | 150 | ||
145 | painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); | 151 | painter.fillRect( QRect( 0, 0, width(), height() ), colorGroup().background().light(110)); |
146 | 152 | // Overlay the Qtopia logo in the center | |
147 | // Overlay the Qtopia logo in the center | 153 | QImage logo; |
148 | QImage logo = Resource::loadImage( "qpe-background" ); | 154 | if (QFile::exists(backgroundImage)) { |
155 | logo = QImage(backgroundImage); | ||
156 | } else { | ||
157 | logo = Resource::loadImage(backgroundImage ); | ||
158 | } | ||
149 | if ( !logo.isNull() ) | 159 | if ( !logo.isNull() ) |
150 | painter.drawImage( (width() - logo.width()) / 2, | 160 | painter.drawImage( (width() - logo.width()) / 2, |
151 | (height() - logo.height()) / 2, logo ); | 161 | (height() - logo.height()) / 2, logo ); |
152 | } | 162 | } |
153 | 163 | ||
154 | // Draw the double buffer to the widget (it is tiled for when the icon view is large) | 164 | // Draw the double buffer to the widget (it is tiled for when the icon view is large) |
155 | p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), | 165 | p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), |
156 | (r.y() + contentsY()) % bg->height() ) ); | 166 | (r.y() + contentsY()) % bg->height() ) ); |
157 | } else if ( backgroundMode == 2 ) { | 167 | } else if ( backgroundMode == 2 ) { |
158 | static QPixmap *bg = 0; | 168 | static QPixmap *bg = 0; |
159 | static QColor bgColor; | 169 | static QColor bgColor; |
160 | if ( !bg || (bgColor != colorGroup().background()) ) { | 170 | if ( !bg || (bgColor != colorGroup().background()) ) { |