-rw-r--r-- | core/launcher/launcherview.cpp | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index c2bde53..9f86136 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -58,24 +58,25 @@ class LauncherIconView : public QIconView { | |||
58 | public: | 58 | public: |
59 | LauncherIconView( QWidget* parent, const char* name=0 ) : | 59 | LauncherIconView( QWidget* parent, const char* name=0 ) : |
60 | QIconView(parent,name), | 60 | QIconView(parent,name), |
61 | tf(""), | 61 | tf(""), |
62 | cf(0), | 62 | cf(0), |
63 | bsy(0), | 63 | bsy(0), |
64 | bigIcns(TRUE), | 64 | bigIcns(TRUE), |
65 | bgColor(white) | 65 | bgColor(white) |
66 | { | 66 | { |
67 | sortmeth = Name; | 67 | sortmeth = Name; |
68 | hidden.setAutoDelete(TRUE); | 68 | hidden.setAutoDelete(TRUE); |
69 | ike = FALSE; | 69 | ike = FALSE; |
70 | busytimer = 0; | ||
70 | calculateGrid( Bottom ); | 71 | calculateGrid( Bottom ); |
71 | } | 72 | } |
72 | 73 | ||
73 | ~LauncherIconView() | 74 | ~LauncherIconView() |
74 | { | 75 | { |
75 | #if 0 // debuggery | 76 | #if 0 // debuggery |
76 | QListIterator<AppLnk> it(hidden); | 77 | QListIterator<AppLnk> it(hidden); |
77 | AppLnk* l; | 78 | AppLnk* l; |
78 | while ((l=it.current())) { | 79 | while ((l=it.current())) { |
79 | ++it; | 80 | ++it; |
80 | //qDebug("%p: hidden (should remove)",l); | 81 | //qDebug("%p: hidden (should remove)",l); |
81 | } | 82 | } |
@@ -88,53 +89,76 @@ public: | |||
88 | 89 | ||
89 | void updateCategoriesAndMimeTypes(); | 90 | void updateCategoriesAndMimeTypes(); |
90 | 91 | ||
91 | void doAutoScroll() | 92 | void doAutoScroll() |
92 | { | 93 | { |
93 | // We don't want rubberbanding (yet) | 94 | // We don't want rubberbanding (yet) |
94 | } | 95 | } |
95 | 96 | ||
96 | void setBusy(bool on) | 97 | void setBusy(bool on) |
97 | { | 98 | { |
98 | QIconViewItem *c = on ? currentItem() : 0; | 99 | QIconViewItem *c = on ? currentItem() : 0; |
99 | if ( bsy != c ) { | 100 | if ( bsy != c ) { |
100 | if ( c ) { | 101 | if ( bsy ) |
101 | QPixmap *src = c->pixmap(); | 102 | bsy-> repaint ( ); |
103 | bsy = c; | ||
104 | |||
105 | if ( bsy ) { | ||
106 | busytimer = startTimer ( 150 ); | ||
107 | busystate = 50; | ||
108 | startTimer ( 0 ); | ||
109 | } | ||
110 | else | ||
111 | killTimer ( busytimer ); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | virtual void timerEvent ( QTimerEvent *te ) | ||
116 | { | ||
117 | if ( !te || ( te-> timerId ( ) == busytimer )) { | ||
118 | if ( bsy ) { | ||
119 | QPixmap *src = bsy-> QIconViewItem::pixmap(); | ||
102 | QImage img = src->convertToImage(); | 120 | QImage img = src->convertToImage(); |
103 | QRgb* rgb; | 121 | QRgb* rgb; |
104 | int count; | 122 | int count; |
105 | if ( img.depth() == 32 ) { | 123 | if ( img.depth() == 32 ) { |
106 | rgb = (QRgb*)img.bits(); | 124 | rgb = (QRgb*)img.bits(); |
107 | count = img.bytesPerLine()/sizeof(QRgb)*img.height(); | 125 | count = img.bytesPerLine()/sizeof(QRgb)*img.height(); |
108 | } else { | 126 | } else { |
109 | rgb = img.colorTable(); | 127 | rgb = img.colorTable(); |
110 | count = img.numColors(); | 128 | count = img.numColors(); |
111 | } | 129 | } |
112 | int rc, gc, bc; | 130 | int rc, gc, bc; |
131 | int bs = ::abs ( busystate ) + 25; | ||
113 | colorGroup().highlight().rgb( &rc, &gc, &bc ); | 132 | colorGroup().highlight().rgb( &rc, &gc, &bc ); |
114 | int ri, gi, bi; | 133 | rc = rc * bs / 100; |
134 | gc = gc * bs / 100; | ||
135 | bc = bc * bs / 100; | ||
136 | |||
115 | for ( int r = 0; r < count; r++, rgb++ ) { | 137 | for ( int r = 0; r < count; r++, rgb++ ) { |
116 | int ri = (rc+qRed(*rgb))/2; | 138 | int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; |
117 | int gi = (gc+qGreen(*rgb))/2; | 139 | int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; |
118 | int bi = (bc+qBlue(*rgb))/2; | 140 | int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; |
119 | int ai = qAlpha(*rgb); | 141 | int ai = qAlpha ( *rgb ); |
120 | *rgb = qRgba(ri,gi,bi,ai); | 142 | *rgb = qRgba ( ri, gi, bi, ai ); |
121 | } | 143 | } |
122 | 144 | ||
123 | bpm.convertFromImage( img ); | 145 | bpm.convertFromImage( img ); |
146 | |||
147 | bsy-> repaint ( ); | ||
148 | |||
149 | busystate += 10; | ||
150 | if ( busystate > 50 ) | ||
151 | busystate = -40; | ||
124 | } | 152 | } |
125 | QIconViewItem* o = bsy; | ||
126 | bsy = c; | ||
127 | if ( o ) o->repaint(); | ||
128 | if ( c ) c->repaint(); | ||
129 | } | 153 | } |
130 | } | 154 | } |
131 | 155 | ||
132 | bool inKeyEvent() const { return ike; } | 156 | bool inKeyEvent() const { return ike; } |
133 | void keyPressEvent(QKeyEvent* e) | 157 | void keyPressEvent(QKeyEvent* e) |
134 | { | 158 | { |
135 | ike = TRUE; | 159 | ike = TRUE; |
136 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) | 160 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) |
137 | returnPressed(currentItem()); | 161 | returnPressed(currentItem()); |
138 | QIconView::keyPressEvent(e); | 162 | QIconView::keyPressEvent(e); |
139 | ike = FALSE; | 163 | ike = FALSE; |
140 | } | 164 | } |
@@ -278,24 +302,26 @@ private: | |||
278 | QList<AppLnk> hidden; | 302 | QList<AppLnk> hidden; |
279 | QDict<void> mimes; | 303 | QDict<void> mimes; |
280 | QDict<void> cats; | 304 | QDict<void> cats; |
281 | SortMethod sortmeth; | 305 | SortMethod sortmeth; |
282 | QRegExp tf; | 306 | QRegExp tf; |
283 | int cf; | 307 | int cf; |
284 | QIconViewItem* bsy; | 308 | QIconViewItem* bsy; |
285 | bool ike; | 309 | bool ike; |
286 | bool bigIcns; | 310 | bool bigIcns; |
287 | QPixmap bgPixmap; | 311 | QPixmap bgPixmap; |
288 | QPixmap bpm; | 312 | QPixmap bpm; |
289 | QColor bgColor; | 313 | QColor bgColor; |
314 | int busytimer; | ||
315 | int busystate; | ||
290 | }; | 316 | }; |
291 | 317 | ||
292 | 318 | ||
293 | bool LauncherView::bsy=FALSE; | 319 | bool LauncherView::bsy=FALSE; |
294 | 320 | ||
295 | void LauncherView::setBusy(bool on) | 321 | void LauncherView::setBusy(bool on) |
296 | { | 322 | { |
297 | icons->setBusy(on); | 323 | icons->setBusy(on); |
298 | } | 324 | } |
299 | 325 | ||
300 | class LauncherItem : public QIconViewItem | 326 | class LauncherItem : public QIconViewItem |
301 | { | 327 | { |