summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp32
-rw-r--r--core/launcher/launcherview.h9
2 files changed, 29 insertions, 12 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
@@ -57,20 +57,16 @@
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();
while ( it != bgCache->end() ) {
QMap<QString,BgPixmap*>::Iterator curr = it;
@@ -92,22 +88,25 @@ public:
AppLnk *appLnk() const { return app; }
AppLnk *takeAppLnk() { AppLnk* r=app; app=0; return r; }
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 ) :
QIconView(parent,name),
tf(""),
@@ -142,18 +141,18 @@ public:
void setBigIcons( bool bi ) {
bigIcns = bi;
#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)
{
#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
if ( busyPix.isNull() ) {
@@ -171,20 +170,23 @@ 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)
{
ike = TRUE;
if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
@@ -358,28 +360,32 @@ private:
int busyTimer;
bool ike;
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 ),
iteration(0),
app(applnk) // Takes ownership
@@ -415,16 +421,18 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg )
// Paint animation overlay
if ( liv->busyItem() == this )
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 );
QPainter p2( &dblBuf );
int x1, y1;
@@ -435,18 +443,20 @@ void LauncherItem::paintAnimatedIcon( QPainter *p )
x1 = x() - liv->contentsX();
y1 = y() + (height() - h) / 2 - liv->contentsY();
}
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 );
}
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 7863d6a..e40a006 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -29,16 +29,23 @@ class CategorySelect;
class LauncherIconView;
class QIconView;
class QIconViewItem;
class QLabel;
class QWidgetStack;
class MenuButton;
class QComboBox;
+
+
+enum BusyIndicatorType {
+ BIT_Normal = 0,
+ BIT_Animated
+};
+
class LauncherView : public QVBox
{
Q_OBJECT
public:
LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~LauncherView();
@@ -101,12 +108,12 @@ private:
QStringList typelist;
CategorySelect *catmb;
ViewMode vmode;
BackgroundType bgType;
QString bgName;
QColor textCol;
QImage loadBackgroundImage(QString &fname);
- int m_busyType;
+
};
#endif // LAUNCHERVIEW_H