author | sandman <sandman> | 2002-10-01 22:44:28 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-01 22:44:28 (UTC) |
commit | 8f904d99e7b6e04b6043226a63f6c417171a7cad (patch) (side-by-side diff) | |
tree | 07d5f2b7e1338cf1035fe92436328a9c74208b03 | |
parent | 895280b5ff189fff2e77d6f5f27668e7dad0d88d (diff) | |
download | opie-8f904d99e7b6e04b6043226a63f6c417171a7cad.zip opie-8f904d99e7b6e04b6043226a63f6c417171a7cad.tar.gz opie-8f904d99e7b6e04b6043226a63f6c417171a7cad.tar.bz2 |
busyindicator type can now be changed at run-time
-rw-r--r-- | core/launcher/launcher.cpp | 14 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 31 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 3 |
4 files changed, 43 insertions, 7 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 6948976..66cc3e6 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -242,16 +242,19 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, docview->setFileSystems(fs); docview->setToolsEnabled(TRUE); setTabAppearance( "Documents", cfg ); // No tr connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); ((LauncherView*)stack->widget(0))->setFocus(); + cfg. setGroup ( "GUI" ); + setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); + categoryBar->show(); stack->show(); } void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) { QString grp( "Tab %1" ); // No tr cfg.setGroup( grp.arg(id) ); @@ -366,16 +369,22 @@ void CategoryTabWidget::setBusy(bool on) } LauncherView *CategoryTabWidget::view( const QString &id ) { int idx = ids.findIndex( id ); return (LauncherView *)stack->widget(idx); } +void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) +{ + for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) + view ( *it )-> setBusyIndicatorType ( type ); +} + //=========================================================================== CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) : QTabBar( parent, name ) { setFocusPolicy( NoFocus ); connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); } @@ -1162,16 +1171,21 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) int weight; stream >> weight; int italic; stream >> italic; if ( tabs->view(id) ) tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); } + else if ( msg == "setBusyIndicatorType(QString)" ) { + QString type; + stream >> type; + tabs->setBusyIndicatorType(type); + } } void Launcher::storageChanged() { if ( in_lnk_props ) { got_lnk_change = TRUE; lnk_change = QString::null; } else { diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index e3881ea..89bf6f3 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -58,17 +58,17 @@ public: CategoryTabWidget( QWidget* parent ); void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, const QList<FileSystem> &); void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); void updateLink(const QString& linkfile); void setBusy(bool on); QString getAllDocLinkInfo() const; LauncherView *view( const QString &id ); - + void setBusyIndicatorType ( const QString &type ); signals: void selected(const QString&); void clicked(const AppLnk*); void rightPressed(AppLnk*); public slots: void nextTab(); void prevTab(); diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index e15b150..fa46543 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -47,16 +47,21 @@ 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; class LauncherIconView : public QIconView { public: LauncherIconView( QWidget* parent, const char* name=0 ) : QIconView(parent,name), tf(""), cf(0), @@ -77,32 +82,33 @@ public: QListIterator<AppLnk> it(hidden); AppLnk* l; while ((l=it.current())) { ++it; //qDebug("%p: hidden (should remove)",l); } #endif } + + void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; } QIconViewItem* busyItem() const { return bsy; } void setBigIcons( bool bi ) { bigIcns = bi; } void updateCategoriesAndMimeTypes(); void doAutoScroll() { // 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 ) { QIconViewItem *oldbsy = bsy; bsy = c; if ( oldbsy ) oldbsy-> repaint ( ); @@ -131,21 +137,25 @@ 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 [i].convertFromImage( img ); } - busystate = 0; - if ( busytimer ) - killTimer ( busytimer ); - timerEvent ( 0 ); - busytimer = startTimer ( 200 ); + if ( busyType == BIT_Blinking ) { + busystate = 0; + if ( busytimer ) + killTimer ( busytimer ); + busytimer = startTimer ( 200 ); + } + else + busystate = 3; + timerEvent ( 0 ); } else { killTimer ( busytimer ); busytimer = 0; } } } @@ -332,16 +342,17 @@ private: QIconViewItem* bsy; bool ike; bool bigIcns; QPixmap bgPixmap; QPixmap bpm [6]; QColor bgColor; int busytimer; int busystate; + BusyIndicatorType busyType; }; bool LauncherView::bsy=FALSE; void LauncherView::setBusy(bool on) { icons->setBusy(on); @@ -908,8 +919,16 @@ void LauncherView::paletteChange( const QPalette &p ) QVBox::paletteChange( p ); if ( bgType == Ruled ) setBackgroundType( Ruled, QString::null ); QColorGroup cg = icons->colorGroup(); cg.setColor( QColorGroup::Text, textCol ); icons->setPalette( QPalette(cg,cg,cg) ); } + +void LauncherView::setBusyIndicatorType ( const QString &type ) +{ + if ( type. lower ( ) == "blink" ) + icons-> setBusyIndicatorType ( BIT_Blinking ); + else + icons-> setBusyIndicatorType ( BIT_Normal ); +} diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 2fb37b6..194e4a2 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h @@ -60,16 +60,18 @@ public: void setBackgroundType( BackgroundType t, const QString & ); BackgroundType backgroundType() const { return bgType; } void setTextColor( const QColor & ); QColor textColor() const { return textCol; } void setViewFont( const QFont & ); + void setBusyIndicatorType ( const QString &type ); + public slots: void populate( AppLnkSet *folder, const QString& categoryfilter ); signals: void clicked( const AppLnk * ); void rightPressed( AppLnk * ); protected slots: @@ -92,11 +94,12 @@ private: LauncherIconView* icons; QComboBox *typemb; QStringList typelist; CategorySelect *catmb; ViewMode vmode; BackgroundType bgType; QString bgName; QColor textCol; + int busyType; }; #endif // LAUNCHERVIEW_H |