author | drw <drw> | 2002-05-18 22:25:24 (UTC) |
---|---|---|
committer | drw <drw> | 2002-05-18 22:25:24 (UTC) |
commit | aa2cff2e8838829125c0ff4efe969b3835c79fa7 (patch) (unidiff) | |
tree | b47056d32711ee7bc3f24dcf86a6832df78f2815 | |
parent | be9add24a65c8ad89bc5425aa4d42c4b598a50be (diff) | |
download | opie-aa2cff2e8838829125c0ff4efe969b3835c79fa7.zip opie-aa2cff2e8838829125c0ff4efe969b3835c79fa7.tar.gz opie-aa2cff2e8838829125c0ff4efe969b3835c79fa7.tar.bz2 |
Added ability to turn off background image.
-rw-r--r-- | core/launcher/launcherview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 1598d13..30afe64 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -119,97 +119,97 @@ public: | |||
119 | hidden.clear(); | 119 | hidden.clear(); |
120 | } | 120 | } |
121 | 121 | ||
122 | void addCatsAndMimes(AppLnk* app) | 122 | void addCatsAndMimes(AppLnk* app) |
123 | { | 123 | { |
124 | // QStringList c = app->categories(); | 124 | // QStringList c = app->categories(); |
125 | // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { | 125 | // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { |
126 | // cats.replace(*cit,(void*)1); | 126 | // cats.replace(*cit,(void*)1); |
127 | // } | 127 | // } |
128 | QString maj=app->type(); | 128 | QString maj=app->type(); |
129 | int sl=maj.find('/'); | 129 | int sl=maj.find('/'); |
130 | if (sl>=0) { | 130 | if (sl>=0) { |
131 | QString k = maj.left(sl); | 131 | QString k = maj.left(sl); |
132 | mimes.replace(k,(void*)1); | 132 | mimes.replace(k,(void*)1); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | void drawBackground( QPainter *p, const QRect &r ) | 136 | void drawBackground( QPainter *p, const QRect &r ) |
137 | { | 137 | { |
138 | Config config("qpe"); | 138 | Config config("qpe"); |
139 | config.setGroup("Appearance"); | 139 | config.setGroup("Appearance"); |
140 | QString backgroundImage = config.readEntry("BackgroundImage","launcher/opie-background"); | 140 | QString backgroundImage = config.readEntry("BackgroundImage","launcher/opie-background"); |
141 | // if (backgroundImage.isNull()) backgroundImage="launcher/opie-background"; | 141 | // if (backgroundImage.isNull()) backgroundImage="launcher/opie-background"; |
142 | int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; | 142 | int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0; |
143 | //int backgroundMode = 2; | 143 | //int backgroundMode = 2; |
144 | 144 | ||
145 | if ( backgroundMode == 1 ) { | 145 | if ( backgroundMode == 1 ) { |
146 | 146 | ||
147 | // Double buffer the background | 147 | // Double buffer the background |
148 | static QPixmap *bg = NULL; | 148 | static QPixmap *bg = NULL; |
149 | static QColor bgColor; | 149 | static QColor bgColor; |
150 | 150 | ||
151 | if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { | 151 | if ( (bg == NULL) || (bgColor != colorGroup().button()) ) { |
152 | // Create a new background double buffer | 152 | // Create a new background double buffer |
153 | if (bg == NULL) | 153 | if (bg == NULL) |
154 | bg = new QPixmap( width(), height() ); | 154 | bg = new QPixmap( width(), height() ); |
155 | bgColor = colorGroup().button(); | 155 | bgColor = colorGroup().button(); |
156 | QPainter painter( bg ); | 156 | QPainter painter( bg ); |
157 | 157 | ||
158 | // 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); | 159 | painter.fillRect( QRect( 0, 0, width(), height() ), background); |
160 | // Overlay the Qtopia logo in the center | 160 | // Overlay the Qtopia logo in the center |
161 | QImage logo; | 161 | QImage logo; |
162 | if (QFile::exists(backgroundImage)) { | 162 | if (QFile::exists(backgroundImage)) { |
163 | logo = QImage(backgroundImage); | 163 | logo = QImage(backgroundImage); |
164 | } else { | 164 | } else { |
165 | logo = Resource::loadImage(backgroundImage ); | 165 | logo = Resource::loadImage(backgroundImage ); |
166 | } | 166 | } |
167 | if ( !logo.isNull() ) | 167 | if ( !logo.isNull() && config.readBoolEntry( "UseBackgroundImage", TRUE ) ) |
168 | painter.drawImage( (width() - logo.width()) / 2, | 168 | painter.drawImage( (width() - logo.width()) / 2, |
169 | (height() - logo.height()) / 2, logo ); | 169 | (height() - logo.height()) / 2, logo ); |
170 | } | 170 | } |
171 | 171 | ||
172 | // Draw the double buffer to the widget (it is tiled for when the icon view is large) | 172 | // Draw the double buffer to the widget (it is tiled for when the icon view is large) |
173 | p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), | 173 | p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), |
174 | (r.y() + contentsY()) % bg->height() ) ); | 174 | (r.y() + contentsY()) % bg->height() ) ); |
175 | } else if ( backgroundMode == 2 ) { | 175 | } else if ( backgroundMode == 2 ) { |
176 | static QPixmap *bg = 0; | 176 | static QPixmap *bg = 0; |
177 | static QColor bgColor; | 177 | static QColor bgColor; |
178 | if ( !bg || (bgColor != colorGroup().background()) ) { | 178 | if ( !bg || (bgColor != colorGroup().background()) ) { |
179 | bgColor = colorGroup().background(); | 179 | bgColor = colorGroup().background(); |
180 | bg = new QPixmap( width(), 9 ); | 180 | bg = new QPixmap( width(), 9 ); |
181 | QPainter painter( bg ); | 181 | QPainter painter( bg ); |
182 | for ( int i = 0; i < 3; i++ ) { | 182 | for ( int i = 0; i < 3; i++ ) { |
183 | painter.setPen( colorGroup().background().light(130) ); | 183 | painter.setPen( colorGroup().background().light(130) ); |
184 | painter.drawLine( 0, i*3, width()-1, i*3 ); | 184 | painter.drawLine( 0, i*3, width()-1, i*3 ); |
185 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); | 185 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); |
186 | painter.setPen( colorGroup().background().light(105) ); | 186 | painter.setPen( colorGroup().background().light(105) ); |
187 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); | 187 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), | 190 | p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(), |
191 | (r.y() + contentsY()) % bg->height() ) ); | 191 | (r.y() + contentsY()) % bg->height() ) ); |
192 | } else { | 192 | } else { |
193 | p->fillRect( r, QBrush( colorGroup().background().light(110) ) ); | 193 | p->fillRect( r, QBrush( colorGroup().background().light(110) ) ); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | void hideOrShowItems(bool resort); | 197 | void hideOrShowItems(bool resort); |
198 | 198 | ||
199 | void setTypeFilter(const QString& typefilter, bool resort) | 199 | void setTypeFilter(const QString& typefilter, bool resort) |
200 | { | 200 | { |
201 | tf = QRegExp(typefilter,FALSE,TRUE); | 201 | tf = QRegExp(typefilter,FALSE,TRUE); |
202 | hideOrShowItems(resort); | 202 | hideOrShowItems(resort); |
203 | } | 203 | } |
204 | 204 | ||
205 | void setCategoryFilter( int catfilter, bool resort ) | 205 | void setCategoryFilter( int catfilter, bool resort ) |
206 | { | 206 | { |
207 | Categories cat; | 207 | Categories cat; |
208 | cat.load( categoryFileName() ); | 208 | cat.load( categoryFileName() ); |
209 | QString str; | 209 | QString str; |
210 | if ( catfilter == -2 ) | 210 | if ( catfilter == -2 ) |
211 | cf = 0; | 211 | cf = 0; |
212 | else | 212 | else |
213 | cf = catfilter; | 213 | cf = catfilter; |
214 | hideOrShowItems(resort); | 214 | hideOrShowItems(resort); |
215 | } | 215 | } |