summaryrefslogtreecommitdiff
authordrw <drw>2002-05-18 22:25:24 (UTC)
committer drw <drw>2002-05-18 22:25:24 (UTC)
commitaa2cff2e8838829125c0ff4efe969b3835c79fa7 (patch) (unidiff)
treeb47056d32711ee7bc3f24dcf86a6832df78f2815
parentbe9add24a65c8ad89bc5425aa4d42c4b598a50be (diff)
downloadopie-aa2cff2e8838829125c0ff4efe969b3835c79fa7.zip
opie-aa2cff2e8838829125c0ff4efe969b3835c79fa7.tar.gz
opie-aa2cff2e8838829125c0ff4efe969b3835c79fa7.tar.bz2
Added ability to turn off background image.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp2
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
@@ -71,193 +71,193 @@ public:
71 //qDebug("%p: hidden (should remove)",l); 71 //qDebug("%p: hidden (should remove)",l);
72 } 72 }
73#endif 73#endif
74 } 74 }
75 75
76 QIconViewItem* busyItem() const { return bsy; } 76 QIconViewItem* busyItem() const { return bsy; }
77 77
78 void updateCategoriesAndMimeTypes(); 78 void updateCategoriesAndMimeTypes();
79 79
80 void doAutoScroll() 80 void doAutoScroll()
81 { 81 {
82 // We don't want rubberbanding (yet) 82 // We don't want rubberbanding (yet)
83 } 83 }
84 84
85 void setBusy(bool on) 85 void setBusy(bool on)
86 { 86 {
87 QIconViewItem *c = on ? currentItem() : 0; 87 QIconViewItem *c = on ? currentItem() : 0;
88 if ( bsy != c ) { 88 if ( bsy != c ) {
89 QIconViewItem* o = bsy; 89 QIconViewItem* o = bsy;
90 bsy = c; 90 bsy = c;
91 if ( o ) o->repaint(); 91 if ( o ) o->repaint();
92 if ( c ) c->repaint(); 92 if ( c ) c->repaint();
93 } 93 }
94 } 94 }
95 95
96 bool inKeyEvent() const { return ike; } 96 bool inKeyEvent() const { return ike; }
97 void keyPressEvent(QKeyEvent* e) 97 void keyPressEvent(QKeyEvent* e)
98 { 98 {
99 ike = TRUE; 99 ike = TRUE;
100 if ( e->key() == Key_F33 ) { 100 if ( e->key() == Key_F33 ) {
101 // "OK" button 101 // "OK" button
102 returnPressed(currentItem()); 102 returnPressed(currentItem());
103 } 103 }
104 QIconView::keyPressEvent(e); 104 QIconView::keyPressEvent(e);
105 ike = FALSE; 105 ike = FALSE;
106 } 106 }
107 107
108 void addItem(AppLnk* app, bool resort=TRUE); 108 void addItem(AppLnk* app, bool resort=TRUE);
109 bool removeLink(const QString& linkfile); 109 bool removeLink(const QString& linkfile);
110 110
111 QStringList mimeTypes() const; 111 QStringList mimeTypes() const;
112 QStringList categories() const; 112 QStringList categories() const;
113 113
114 void clear() 114 void clear()
115 { 115 {
116 mimes.clear(); 116 mimes.clear();
117 cats.clear(); 117 cats.clear();
118 QIconView::clear(); 118 QIconView::clear();
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 }
216 216
217 enum SortMethod { Name, Date, Type }; 217 enum SortMethod { Name, Date, Type };
218 218
219 void setSortMethod( SortMethod m ) 219 void setSortMethod( SortMethod m )
220 { 220 {
221 if ( sortmeth != m ) { 221 if ( sortmeth != m ) {
222 sortmeth = m; 222 sortmeth = m;
223 sort(); 223 sort();
224 } 224 }
225 } 225 }
226 226
227 int compare(const AppLnk* a, const AppLnk* b) 227 int compare(const AppLnk* a, const AppLnk* b)
228 { 228 {
229 switch (sortmeth) { 229 switch (sortmeth) {
230 case Name: 230 case Name:
231 return a->name().compare(b->name()); 231 return a->name().compare(b->name());
232 case Date: { 232 case Date: {
233 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); 233 QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file());
234 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); 234 QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file());
235 return fa.lastModified().secsTo(fb.lastModified()); 235 return fa.lastModified().secsTo(fb.lastModified());
236 } 236 }
237 case Type: 237 case Type:
238 return a->type().compare(b->type()); 238 return a->type().compare(b->type());
239 } 239 }
240 return 0; 240 return 0;
241 } 241 }
242 242
243protected: 243protected:
244 244
245 void styleChange( QStyle &old ) 245 void styleChange( QStyle &old )
246 { 246 {
247 QIconView::styleChange( old ); 247 QIconView::styleChange( old );
248 //### duplicated code from LauncherView constructor 248 //### duplicated code from LauncherView constructor
249 int dw = QApplication::desktop()->width(); 249 int dw = QApplication::desktop()->width();
250 setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240 250 setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240
251 } 251 }
252 252
253private: 253private:
254 QList<AppLnk> hidden; 254 QList<AppLnk> hidden;
255 QDict<void> mimes; 255 QDict<void> mimes;
256 QDict<void> cats; 256 QDict<void> cats;
257 SortMethod sortmeth; 257 SortMethod sortmeth;
258 QRegExp tf; 258 QRegExp tf;
259 int cf; 259 int cf;
260 QIconViewItem* bsy; 260 QIconViewItem* bsy;
261 bool ike; 261 bool ike;
262 262
263}; 263};