summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-23 23:51:11 (UTC)
committer sandman <sandman>2002-10-23 23:51:11 (UTC)
commit36e13db0a1d44abd5a160a34e4679b90d62826c7 (patch) (unidiff)
tree6996137d6ffd992e7eef8be1802d667b3184f62a
parent8d8ebc66cefd889c0cbc13d7d3d4158bdcb55962 (diff)
downloadopie-36e13db0a1d44abd5a160a34e4679b90d62826c7.zip
opie-36e13db0a1d44abd5a160a34e4679b90d62826c7.tar.gz
opie-36e13db0a1d44abd5a160a34e4679b90d62826c7.tar.bz2
- fix for the busy indicator timer, in case someone switches to non-blink
style, while the indicator is blinking - the launcher QIconView is now drawn flickerfree into a background QPixmap
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp57
1 files changed, 50 insertions, 7 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 6e63fca..9fc4565 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -109,12 +109,17 @@ public:
109 QIconViewItem *oldbsy = bsy; 109 QIconViewItem *oldbsy = bsy;
110 bsy = c; 110 bsy = c;
111 111
112 if ( oldbsy ) 112 if ( oldbsy )
113 oldbsy-> repaint ( ); 113 oldbsy-> repaint ( );
114 114
115 if ( busytimer ) {
116 killTimer ( busytimer );
117 busytimer = 0;
118 }
119
115 if ( bsy ) { 120 if ( bsy ) {
116 QPixmap *src = bsy-> QIconViewItem::pixmap(); 121 QPixmap *src = bsy-> QIconViewItem::pixmap();
117 for ( int i = 0; i <= 5; i++ ) { 122 for ( int i = 0; i <= 5; i++ ) {
118 QImage img = src->convertToImage(); 123 QImage img = src->convertToImage();
119 QRgb* rgb; 124 QRgb* rgb;
120 int count; 125 int count;
@@ -139,26 +144,22 @@ public:
139 int ai = qAlpha ( *rgb ); 144 int ai = qAlpha ( *rgb );
140 *rgb = qRgba ( ri, gi, bi, ai ); 145 *rgb = qRgba ( ri, gi, bi, ai );
141 } 146 }
142 147
143 bpm [i].convertFromImage( img ); 148 bpm [i].convertFromImage( img );
144 } 149 }
150
145 if ( busyType == BIT_Blinking ) { 151 if ( busyType == BIT_Blinking ) {
146 busystate = 0; 152 busystate = 0;
147 if ( busytimer )
148 killTimer ( busytimer );
149 busytimer = startTimer ( 200 ); 153 busytimer = startTimer ( 200 );
150 } 154 }
151 else 155 else {
152 busystate = 3; 156 busystate = 3;
157 }
153 timerEvent ( 0 ); 158 timerEvent ( 0 );
154 } 159 }
155 else {
156 killTimer ( busytimer );
157 busytimer = 0;
158 }
159 } 160 }
160 } 161 }
161 162
162 virtual void timerEvent ( QTimerEvent *te ) 163 virtual void timerEvent ( QTimerEvent *te )
163 { 164 {
164 if ( !te || ( te-> timerId ( ) == busytimer )) { 165 if ( !te || ( te-> timerId ( ) == busytimer )) {
@@ -329,12 +330,53 @@ protected:
329 setSpacing( 2 ); 330 setSpacing( 2 );
330 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 331 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
331 setGridY( fontMetrics().height()+2 ); 332 setGridY( fontMetrics().height()+2 );
332 } 333 }
333 } 334 }
334 335
336
337 // flicker free redrawing of busy indicator
338 // code was taken from QScrollView::viewportPaintEvent
339 void viewportPaintEvent( QPaintEvent* pe )
340 {
341 static QPixmap *pix = new QPixmap ( );
342
343 QWidget* vp = viewport();
344
345 if ( vp-> size ( ) != pix-> size ( ))
346 pix-> resize ( vp-> size ( ));
347
348 QPainter p(pix, vp);
349 QRect r = pe->rect();
350 if ( clipper ( ) != vp ) {
351 QRect rr(
352 -vp->x(), -vp->y(),
353 clipper()->width(), clipper()->height()
354 );
355 r &= rr;
356 if ( r.isValid() ) {
357 int ex = r.x() + vp->x() + contentsX();
358 int ey = r.y() + vp->y() + contentsY();
359 int ew = r.width();
360 int eh = r.height();
361 drawContentsOffset(&p,
362 contentsX()+vp->x(),
363 contentsY()+vp->y(),
364 ex, ey, ew, eh);
365 }
366 } else {
367 r &= clipper()->rect();
368 int ex = r.x() + contentsX();
369 int ey = r.y() + contentsY();
370 int ew = r.width();
371 int eh = r.height();
372 drawContentsOffset(&p, contentsX(), contentsY(), ex, ey, ew, eh);
373 }
374 bitBlt ( vp, r.topLeft(), pix, r );
375 }
376
335private: 377private:
336 QList<AppLnk> hidden; 378 QList<AppLnk> hidden;
337 QDict<void> mimes; 379 QDict<void> mimes;
338 QDict<void> cats; 380 QDict<void> cats;
339 SortMethod sortmeth; 381 SortMethod sortmeth;
340 QRegExp tf; 382 QRegExp tf;
@@ -928,6 +970,7 @@ void LauncherView::setBusyIndicatorType ( const QString &type )
928{ 970{
929 if ( type. lower ( ) == "blink" ) 971 if ( type. lower ( ) == "blink" )
930 icons-> setBusyIndicatorType ( BIT_Blinking ); 972 icons-> setBusyIndicatorType ( BIT_Blinking );
931 else 973 else
932 icons-> setBusyIndicatorType ( BIT_Normal ); 974 icons-> setBusyIndicatorType ( BIT_Normal );
933} 975}
976