summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-30 10:12:36 (UTC)
committer sandman <sandman>2002-09-30 10:12:36 (UTC)
commitece83520d6bf5c481275a3d4a8e792749119fa08 (patch) (unidiff)
treeeb1c8bfdc013a3aca46c4feaa2ff50e38e5d632b
parenta999acbcd1b8bc1715f2ad2dda6acedf423b89ea (diff)
downloadopie-ece83520d6bf5c481275a3d4a8e792749119fa08.zip
opie-ece83520d6bf5c481275a3d4a8e792749119fa08.tar.gz
opie-ece83520d6bf5c481275a3d4a8e792749119fa08.tar.bz2
Optimizations for the new busy indicator:
- QPixmaps are buffered now - real fix for the startTimer 100% cpu-load bug (was a typo)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index dbcb0d7..5daaeff 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -83,7 +83,7 @@ public:
83#endif 83#endif
84 } 84 }
85 85
86 QPixmap* busyPixmap() const { return (QPixmap*)&bpm; } 86 QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; }
87 QIconViewItem* busyItem() const { return bsy; } 87 QIconViewItem* busyItem() const { return bsy; }
88 void setBigIcons( bool bi ) { bigIcns = bi; } 88 void setBigIcons( bool bi ) { bigIcns = bi; }
89 89
@@ -103,11 +103,11 @@ public:
103 bsy = c; 103 bsy = c;
104 104
105 if ( bsy ) { 105 if ( bsy ) {
106 busystate = 5;
107 for ( int i = 0; i <= 5; i++ )
108 bpm [i] = QPixmap ( );
109 timerEvent ( 0 );
106 busytimer = startTimer ( 150 ); 110 busytimer = startTimer ( 150 );
107 busystate = 50;
108 // not sure what this startTimer is for, maybe i am just to tired. But
109 // currently that causes 100% cpuload on app launch
110 //startTimer ( 0 );
111 } 111 }
112 else 112 else
113 killTimer ( busytimer ); 113 killTimer ( busytimer );
@@ -118,6 +118,7 @@ public:
118 { 118 {
119 if ( !te || ( te-> timerId ( ) == busytimer )) { 119 if ( !te || ( te-> timerId ( ) == busytimer )) {
120 if ( bsy ) { 120 if ( bsy ) {
121 if ( bpm [::abs(busystate)]. isNull ( )) {
121 QPixmap *src = bsy-> QIconViewItem::pixmap(); 122 QPixmap *src = bsy-> QIconViewItem::pixmap();
122 QImage img = src->convertToImage(); 123 QImage img = src->convertToImage();
123 QRgb* rgb; 124 QRgb* rgb;
@@ -130,7 +131,7 @@ public:
130 count = img.numColors(); 131 count = img.numColors();
131 } 132 }
132 int rc, gc, bc; 133 int rc, gc, bc;
133 int bs = ::abs ( busystate ) + 25; 134 int bs = ::abs ( busystate * 10 ) + 25;
134 colorGroup().highlight().rgb( &rc, &gc, &bc ); 135 colorGroup().highlight().rgb( &rc, &gc, &bc );
135 rc = rc * bs / 100; 136 rc = rc * bs / 100;
136 gc = gc * bs / 100; 137 gc = gc * bs / 100;
@@ -144,13 +145,13 @@ public:
144 *rgb = qRgba ( ri, gi, bi, ai ); 145 *rgb = qRgba ( ri, gi, bi, ai );
145 } 146 }
146 147
147 bpm.convertFromImage( img ); 148 bpm [::abs(busystate)].convertFromImage( img );
148 149 }
149 bsy-> repaint ( ); 150 bsy-> repaint ( );
150 151
151 busystate += 10; 152 busystate++;
152 if ( busystate > 50 ) 153 if ( busystate > 5 )
153 busystate = -40; 154 busystate = -4;
154 } 155 }
155 } 156 }
156 } 157 }
@@ -311,7 +312,7 @@ private:
311 bool ike; 312 bool ike;
312 bool bigIcns; 313 bool bigIcns;
313 QPixmap bgPixmap; 314 QPixmap bgPixmap;
314 QPixmap bpm; 315 QPixmap bpm [6];
315 QColor bgColor; 316 QColor bgColor;
316 int busytimer; 317 int busytimer;
317 int busystate; 318 int busystate;