summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-30 23:06:39 (UTC)
committer sandman <sandman>2002-09-30 23:06:39 (UTC)
commit37a8266f4a32d07a27d453897febf1f25963a4d0 (patch) (side-by-side diff)
tree38f41045da51b99b76a69b42beaafd0124564cc9
parent6fdaab436d4fa72b3de06a1a9cf9be0bd964677a (diff)
downloadopie-37a8266f4a32d07a27d453897febf1f25963a4d0.zip
opie-37a8266f4a32d07a27d453897febf1f25963a4d0.tar.gz
opie-37a8266f4a32d07a27d453897febf1f25963a4d0.tar.bz2
- again some speedups for the new busy indicator
- (inefficient) fix for background pixmaps with alpha channel (untested)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 5daaeff..33717bc 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -94,47 +94,36 @@ public:
// We don't want rubberbanding (yet)
}
void setBusy(bool on)
{
QIconViewItem *c = on ? currentItem() : 0;
+ qDebug ( "set busy %d -> %s", on, c ? c-> text ().latin1() : "(null)" );
+
if ( bsy != c ) {
- if ( bsy )
- bsy-> repaint ( );
+ QIconViewItem *oldbsy = bsy;
bsy = c;
- if ( bsy ) {
- busystate = 5;
- for ( int i = 0; i <= 5; i++ )
- bpm [i] = QPixmap ( );
- timerEvent ( 0 );
- busytimer = startTimer ( 150 );
- }
- else
- killTimer ( busytimer );
- }
- }
+ if ( oldbsy )
+ oldbsy-> repaint ( );
- virtual void timerEvent ( QTimerEvent *te )
- {
- if ( !te || ( te-> timerId ( ) == busytimer )) {
if ( bsy ) {
- if ( bpm [::abs(busystate)]. isNull ( )) {
QPixmap *src = bsy-> QIconViewItem::pixmap();
+ for ( int i = 0; i <= 5; i++ ) {
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;
+ int bs = ::abs ( i * 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++ ) {
@@ -142,19 +131,36 @@ public:
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 [i].convertFromImage( img );
+ }
+ busystate = 0;
+ if ( busytimer )
+ killTimer ( busytimer );
+ timerEvent ( 0 );
+ busytimer = startTimer ( 180 );
+ }
+ else {
+ killTimer ( busytimer );
+ busytimer = 0;
+ }
+ }
}
- bsy-> repaint ( );
+ virtual void timerEvent ( QTimerEvent *te )
+ {
+ if ( !te || ( te-> timerId ( ) == busytimer )) {
+ if ( bsy ) {
busystate++;
if ( busystate > 5 )
busystate = -4;
+
+ bsy-> repaint ( );
}
}
}
bool inKeyEvent() const { return ike; }
void keyPressEvent(QKeyEvent* e)
@@ -203,12 +209,13 @@ public:
bgColor = c;
}
void drawBackground( QPainter *p, const QRect &r )
{
if ( !bgPixmap.isNull() ) {
+ p-> fillRect ( r, bgColor );
p->drawTiledPixmap( r, bgPixmap,
QPoint( (r.x() + contentsX()) % bgPixmap.width(),
(r.y() + contentsY()) % bgPixmap.height() ) );
} else {
p->fillRect( r, bgColor );
}