summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp71
1 files changed, 36 insertions, 35 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
@@ -82,9 +82,9 @@ public:
}
#endif
}
- QPixmap* busyPixmap() const { return (QPixmap*)&bpm; }
+ QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; }
QIconViewItem* busyItem() const { return bsy; }
void setBigIcons( bool bi ) { bigIcns = bi; }
void updateCategoriesAndMimeTypes();
@@ -102,13 +102,13 @@ public:
bsy-> repaint ( );
bsy = c;
if ( bsy ) {
+ busystate = 5;
+ for ( int i = 0; i <= 5; i++ )
+ bpm [i] = QPixmap ( );
+ timerEvent ( 0 );
busytimer = startTimer ( 150 );
- busystate = 50;
- // not sure what this startTimer is for, maybe i am just to tired. But
- // currently that causes 100% cpuload on app launch
- //startTimer ( 0 );
}
else
killTimer ( busytimer );
}
@@ -117,41 +117,42 @@ public:
virtual void timerEvent ( QTimerEvent *te )
{
if ( !te || ( te-> timerId ( ) == busytimer )) {
if ( bsy ) {
- QPixmap *src = bsy-> QIconViewItem::pixmap();
- QImage img = src->convertToImage();
- QRgb* rgb;
- int count;
- if ( img.depth() == 32 ) {
- rgb = (QRgb*)img.bits();
- count = img.bytesPerLine()/sizeof(QRgb)*img.height();
- } else {
- rgb = img.colorTable();
- count = img.numColors();
- }
- int rc, gc, bc;
- int bs = ::abs ( busystate ) + 25;
- colorGroup().highlight().rgb( &rc, &gc, &bc );
- rc = rc * bs / 100;
- gc = gc * bs / 100;
- bc = bc * bs / 100;
+ if ( bpm [::abs(busystate)]. isNull ( )) {
+ QPixmap *src = bsy-> QIconViewItem::pixmap();
+ QImage img = src->convertToImage();
+ QRgb* rgb;
+ int count;
+ if ( img.depth() == 32 ) {
+ rgb = (QRgb*)img.bits();
+ count = img.bytesPerLine()/sizeof(QRgb)*img.height();
+ } else {
+ rgb = img.colorTable();
+ count = img.numColors();
+ }
+ int rc, gc, bc;
+ int bs = ::abs ( busystate * 10 ) + 25;
+ colorGroup().highlight().rgb( &rc, &gc, &bc );
+ rc = rc * bs / 100;
+ gc = gc * bs / 100;
+ bc = bc * bs / 100;
- for ( int r = 0; r < count; r++, rgb++ ) {
- int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100;
- int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100;
- int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100;
- int ai = qAlpha ( *rgb );
- *rgb = qRgba ( ri, gi, bi, ai );
+ for ( int r = 0; r < count; r++, rgb++ ) {
+ int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100;
+ int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100;
+ int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100;
+ int ai = qAlpha ( *rgb );
+ *rgb = qRgba ( ri, gi, bi, ai );
+ }
+
+ bpm [::abs(busystate)].convertFromImage( img );
}
-
- bpm.convertFromImage( img );
-
bsy-> repaint ( );
- busystate += 10;
- if ( busystate > 50 )
- busystate = -40;
+ busystate++;
+ if ( busystate > 5 )
+ busystate = -4;
}
}
}
@@ -310,9 +311,9 @@ private:
QIconViewItem* bsy;
bool ike;
bool bigIcns;
QPixmap bgPixmap;
- QPixmap bpm;
+ QPixmap bpm [6];
QColor bgColor;
int busytimer;
int busystate;
};