summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp50
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 {
public:
LauncherIconView( QWidget* parent, const char* name=0 ) :
QIconView(parent,name),
tf(""),
cf(0),
bsy(0),
bigIcns(TRUE),
bgColor(white)
{
sortmeth = Name;
hidden.setAutoDelete(TRUE);
ike = FALSE;
+ busytimer = 0;
calculateGrid( Bottom );
}
~LauncherIconView()
{
#if 0 // debuggery
QListIterator<AppLnk> it(hidden);
AppLnk* l;
while ((l=it.current())) {
++it;
//qDebug("%p: hidden (should remove)",l);
}
@@ -88,53 +89,76 @@ public:
void updateCategoriesAndMimeTypes();
void doAutoScroll()
{
// We don't want rubberbanding (yet)
}
void setBusy(bool on)
{
QIconViewItem *c = on ? currentItem() : 0;
if ( bsy != c ) {
- if ( c ) {
- QPixmap *src = c->pixmap();
+ if ( bsy )
+ bsy-> repaint ( );
+ bsy = c;
+
+ if ( bsy ) {
+ busytimer = startTimer ( 150 );
+ busystate = 50;
+ startTimer ( 0 );
+ }
+ else
+ killTimer ( busytimer );
+ }
+ }
+
+ 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 );
- int ri, gi, bi;
+ 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))/2;
- int gi = (gc+qGreen(*rgb))/2;
- int bi = (bc+qBlue(*rgb))/2;
- int ai = qAlpha(*rgb);
- *rgb = qRgba(ri,gi,bi,ai);
+ 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.convertFromImage( img );
+
+ bsy-> repaint ( );
+
+ busystate += 10;
+ if ( busystate > 50 )
+ busystate = -40;
}
- QIconViewItem* o = bsy;
- bsy = c;
- if ( o ) o->repaint();
- if ( c ) c->repaint();
}
}
bool inKeyEvent() const { return ike; }
void keyPressEvent(QKeyEvent* e)
{
ike = TRUE;
if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space )
returnPressed(currentItem());
QIconView::keyPressEvent(e);
ike = FALSE;
}
@@ -278,24 +302,26 @@ private:
QList<AppLnk> hidden;
QDict<void> mimes;
QDict<void> cats;
SortMethod sortmeth;
QRegExp tf;
int cf;
QIconViewItem* bsy;
bool ike;
bool bigIcns;
QPixmap bgPixmap;
QPixmap bpm;
QColor bgColor;
+ int busytimer;
+ int busystate;
};
bool LauncherView::bsy=FALSE;
void LauncherView::setBusy(bool on)
{
icons->setBusy(on);
}
class LauncherItem : public QIconViewItem
{