Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/launcherview.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 85163b6..62c678d 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -59,16 +59,12 @@ class BgPixmap public: BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} QPixmap pm; int ref; }; -enum BusyIndicatorType { - BIT_Normal = 0, - BIT_Blinking -}; static QMap<QString,BgPixmap*> *bgCache = 0; static void cleanup_cache() { QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); @@ -94,18 +90,21 @@ public: void animateIcon(); void resetIcon(); virtual int compare ( QIconViewItem * i ) const; void paintItem( QPainter *p, const QColorGroup &cg ); + + void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } protected: bool isBigIcon; int iteration; AppLnk* app; private: void paintAnimatedIcon( QPainter *p ); + BusyIndicatorType busyType; }; class LauncherIconView : public QIconView { public: LauncherIconView( QWidget* parent, const char* name=0 ) : @@ -144,14 +143,14 @@ public: #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY busyPix.resize(0,0); #endif } void updateCategoriesAndMimeTypes(); - - void doAutoScroll() + void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } + void doAutoScroll() { // We don't want rubberbanding (yet) } void setBusy(bool on) { @@ -173,16 +172,19 @@ public: LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; if ( bsy != c ) { LauncherItem *oldBusy = bsy; bsy = c; - if ( oldBusy ) + if ( oldBusy ) { oldBusy->resetIcon(); - if ( bsy ) + } + if ( bsy ) { + bsy->setBusyIndicatorType( busyType ) ; bsy->animateIcon(); + } } } bool inKeyEvent() const { return ike; } void keyPressEvent(QKeyEvent* e) { @@ -360,24 +362,28 @@ private: bool bigIcns; QPixmap bgPixmap; QColor bgColor; #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY QPixmap busyPix; #endif + BusyIndicatorType busyType; }; bool LauncherView::bsy=FALSE; void LauncherView::setBusy(bool on) { icons->setBusy(on); } void LauncherView::setBusyIndicatorType( const QString& type ) { - /* ### FIXME */ + if ( type. lower ( ) == "animated" ) + icons->setBusyIndicatorType( BIT_Animated ) ; + else + icons->setBusyIndicatorType( BIT_Normal ) ; } LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) : QIconViewItem( parent, applnk->name(), bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), isBigIcon( bigIcon ), @@ -417,12 +423,14 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg ) paintAnimatedIcon(p); if ( liv->currentItem() == this ) liv->setItemTextBackground( oldBrush ); } + + void LauncherItem::paintAnimatedIcon( QPainter *p ) { LauncherIconView* liv = (LauncherIconView*)iconView(); int pic = iteration % 16; int w = pixmap()->width(), h = pixmap()->height(); QPixmap dblBuf( w, h + 4 ); @@ -437,14 +445,16 @@ void LauncherItem::paintAnimatedIcon( QPainter *p ) } y1 -= 2; p2.translate(-x1,-y1); liv->drawBackground( &p2, QRect(x1,y1,w,h+4) ); int bounceY = 2; #ifdef BOUNCE_BUSY_ICON - bounceY = 4 - ((iteration+2)%8); - bounceY = bounceY < 0 ? -bounceY : bounceY; + if ( busyType == BIT_Animated ) { + bounceY = 4 - ((iteration+2)%8); + bounceY = bounceY < 0 ? -bounceY : bounceY; + } #endif p2.drawPixmap( x1, y1 + bounceY, *pixmap() ); #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h ); #endif p->drawPixmap( x1, y1, dblBuf ); |