-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 | |||
@@ -226,48 +226,51 @@ void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | ++it; | 228 | ++it; |
229 | } | 229 | } |
230 | rootFolder->detachChildren(); | 230 | rootFolder->detachChildren(); |
231 | for (int i=0; i<tabs; i++) | 231 | for (int i=0; i<tabs; i++) |
232 | ((LauncherView*)stack->widget(i))->sort(); | 232 | ((LauncherView*)stack->widget(i))->sort(); |
233 | 233 | ||
234 | // all documents | 234 | // all documents |
235 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 235 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
236 | QPixmap pm; | 236 | QPixmap pm; |
237 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 237 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
238 | docview = newView( "Documents", // No tr | 238 | docview = newView( "Documents", // No tr |
239 | pm, tr("Documents")); | 239 | pm, tr("Documents")); |
240 | docview->populate( docFolder, QString::null ); | 240 | docview->populate( docFolder, QString::null ); |
241 | docFolder->detachChildren(); | 241 | docFolder->detachChildren(); |
242 | docview->setFileSystems(fs); | 242 | docview->setFileSystems(fs); |
243 | docview->setToolsEnabled(TRUE); | 243 | docview->setToolsEnabled(TRUE); |
244 | setTabAppearance( "Documents", cfg ); // No tr | 244 | setTabAppearance( "Documents", cfg ); // No tr |
245 | 245 | ||
246 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 246 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
247 | 247 | ||
248 | ((LauncherView*)stack->widget(0))->setFocus(); | 248 | ((LauncherView*)stack->widget(0))->setFocus(); |
249 | 249 | ||
250 | cfg. setGroup ( "GUI" ); | ||
251 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); | ||
252 | |||
250 | categoryBar->show(); | 253 | categoryBar->show(); |
251 | stack->show(); | 254 | stack->show(); |
252 | } | 255 | } |
253 | 256 | ||
254 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 257 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
255 | { | 258 | { |
256 | QString grp( "Tab %1" ); // No tr | 259 | QString grp( "Tab %1" ); // No tr |
257 | cfg.setGroup( grp.arg(id) ); | 260 | cfg.setGroup( grp.arg(id) ); |
258 | LauncherView *v = view( id ); | 261 | LauncherView *v = view( id ); |
259 | int idx = ids.findIndex( id ); | 262 | int idx = ids.findIndex( id ); |
260 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); | 263 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); |
261 | 264 | ||
262 | // View | 265 | // View |
263 | QString view = cfg.readEntry( "View", "Icon" ); | 266 | QString view = cfg.readEntry( "View", "Icon" ); |
264 | if ( view == "List" ) // No tr | 267 | if ( view == "List" ) // No tr |
265 | v->setViewMode( LauncherView::List ); | 268 | v->setViewMode( LauncherView::List ); |
266 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 269 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
267 | if ( bgType == "Image" ) { // No tr | 270 | if ( bgType == "Image" ) { // No tr |
268 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 271 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
269 | v->setBackgroundType( LauncherView::Image, pm ); | 272 | v->setBackgroundType( LauncherView::Image, pm ); |
270 | } else if ( bgType == "SolidColor" ) { | 273 | } else if ( bgType == "SolidColor" ) { |
271 | QString c = cfg.readEntry( "BackgroundColor" ); | 274 | QString c = cfg.readEntry( "BackgroundColor" ); |
272 | v->setBackgroundType( LauncherView::SolidColor, c ); | 275 | v->setBackgroundType( LauncherView::SolidColor, c ); |
273 | } | 276 | } |
@@ -350,48 +353,54 @@ void CategoryTabWidget::paletteChange( const QPalette &p ) | |||
350 | { | 353 | { |
351 | QVBox::paletteChange( p ); | 354 | QVBox::paletteChange( p ); |
352 | QPalette pal = palette(); | 355 | QPalette pal = palette(); |
353 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 356 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
354 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 357 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
355 | categoryBar->setPalette( pal ); | 358 | categoryBar->setPalette( pal ); |
356 | categoryBar->update(); | 359 | categoryBar->update(); |
357 | } | 360 | } |
358 | 361 | ||
359 | void CategoryTabWidget::setBusy(bool on) | 362 | void CategoryTabWidget::setBusy(bool on) |
360 | { | 363 | { |
361 | if ( on ) | 364 | if ( on ) |
362 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 365 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
363 | else | 366 | else |
364 | for (int i=0; i<tabs; i++) | 367 | for (int i=0; i<tabs; i++) |
365 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 368 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
366 | } | 369 | } |
367 | 370 | ||
368 | LauncherView *CategoryTabWidget::view( const QString &id ) | 371 | LauncherView *CategoryTabWidget::view( const QString &id ) |
369 | { | 372 | { |
370 | int idx = ids.findIndex( id ); | 373 | int idx = ids.findIndex( id ); |
371 | return (LauncherView *)stack->widget(idx); | 374 | return (LauncherView *)stack->widget(idx); |
372 | } | 375 | } |
373 | 376 | ||
377 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) | ||
378 | { | ||
379 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) | ||
380 | view ( *it )-> setBusyIndicatorType ( type ); | ||
381 | } | ||
382 | |||
374 | //=========================================================================== | 383 | //=========================================================================== |
375 | 384 | ||
376 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) | 385 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) |
377 | : QTabBar( parent, name ) | 386 | : QTabBar( parent, name ) |
378 | { | 387 | { |
379 | setFocusPolicy( NoFocus ); | 388 | setFocusPolicy( NoFocus ); |
380 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); | 389 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); |
381 | } | 390 | } |
382 | 391 | ||
383 | CategoryTabBar::~CategoryTabBar() | 392 | CategoryTabBar::~CategoryTabBar() |
384 | { | 393 | { |
385 | } | 394 | } |
386 | 395 | ||
387 | void CategoryTabBar::layoutTabs() | 396 | void CategoryTabBar::layoutTabs() |
388 | { | 397 | { |
389 | if ( !count() ) | 398 | if ( !count() ) |
390 | return; | 399 | return; |
391 | 400 | ||
392 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; | 401 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; |
393 | int available = width()-1; | 402 | int available = width()-1; |
394 | QFontMetrics fm = fontMetrics(); | 403 | QFontMetrics fm = fontMetrics(); |
395 | int hiddenTabWidth = -7; | 404 | int hiddenTabWidth = -7; |
396 | int middleTab = currentTab(); | 405 | int middleTab = currentTab(); |
397 | int hframe, vframe, overlap; | 406 | int hframe, vframe, overlap; |
@@ -1146,48 +1155,53 @@ void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) | |||
1146 | if ( tabs->view(id) ) | 1155 | if ( tabs->view(id) ) |
1147 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 1156 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
1148 | } else if ( msg == "setTextColor(QString,QString)" ) { | 1157 | } else if ( msg == "setTextColor(QString,QString)" ) { |
1149 | QString id; | 1158 | QString id; |
1150 | stream >> id; | 1159 | stream >> id; |
1151 | QString color; | 1160 | QString color; |
1152 | stream >> color; | 1161 | stream >> color; |
1153 | if ( tabs->view(id) ) | 1162 | if ( tabs->view(id) ) |
1154 | tabs->view(id)->setTextColor( QColor(color) ); | 1163 | tabs->view(id)->setTextColor( QColor(color) ); |
1155 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 1164 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
1156 | QString id; | 1165 | QString id; |
1157 | stream >> id; | 1166 | stream >> id; |
1158 | QString fam; | 1167 | QString fam; |
1159 | stream >> fam; | 1168 | stream >> fam; |
1160 | int size; | 1169 | int size; |
1161 | stream >> size; | 1170 | stream >> size; |
1162 | int weight; | 1171 | int weight; |
1163 | stream >> weight; | 1172 | stream >> weight; |
1164 | int italic; | 1173 | int italic; |
1165 | stream >> italic; | 1174 | stream >> italic; |
1166 | if ( tabs->view(id) ) | 1175 | if ( tabs->view(id) ) |
1167 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 1176 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
1168 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 1177 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
1169 | } | 1178 | } |
1179 | else if ( msg == "setBusyIndicatorType(QString)" ) { | ||
1180 | QString type; | ||
1181 | stream >> type; | ||
1182 | tabs->setBusyIndicatorType(type); | ||
1183 | } | ||
1170 | } | 1184 | } |
1171 | 1185 | ||
1172 | void Launcher::storageChanged() | 1186 | void Launcher::storageChanged() |
1173 | { | 1187 | { |
1174 | if ( in_lnk_props ) { | 1188 | if ( in_lnk_props ) { |
1175 | got_lnk_change = TRUE; | 1189 | got_lnk_change = TRUE; |
1176 | lnk_change = QString::null; | 1190 | lnk_change = QString::null; |
1177 | } else { | 1191 | } else { |
1178 | updateLink( QString::null ); | 1192 | updateLink( QString::null ); |
1179 | } | 1193 | } |
1180 | } | 1194 | } |
1181 | 1195 | ||
1182 | 1196 | ||
1183 | bool Launcher::mkdir(const QString &localPath) | 1197 | bool Launcher::mkdir(const QString &localPath) |
1184 | { | 1198 | { |
1185 | QDir fullDir(localPath); | 1199 | QDir fullDir(localPath); |
1186 | if (fullDir.exists()) | 1200 | if (fullDir.exists()) |
1187 | return true; | 1201 | return true; |
1188 | 1202 | ||
1189 | // at this point the directory doesn't exist | 1203 | // at this point the directory doesn't exist |
1190 | // go through the directory tree and start creating the direcotories | 1204 | // go through the directory tree and start creating the direcotories |
1191 | // that don't exist; if we can't create the directories, return false | 1205 | // that don't exist; if we can't create the directories, return false |
1192 | 1206 | ||
1193 | QString dirSeps = "/"; | 1207 | QString dirSeps = "/"; |
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 | |||
@@ -42,49 +42,49 @@ class CategoryTabBar : public QTabBar | |||
42 | public: | 42 | public: |
43 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); | 43 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); |
44 | ~CategoryTabBar(); | 44 | ~CategoryTabBar(); |
45 | 45 | ||
46 | protected slots: | 46 | protected slots: |
47 | virtual void layoutTabs(); | 47 | virtual void layoutTabs(); |
48 | 48 | ||
49 | protected: | 49 | protected: |
50 | void paint ( QPainter *p, QTab *t, bool f ) const; | 50 | void paint ( QPainter *p, QTab *t, bool f ) const; |
51 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; | 51 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | class CategoryTabWidget : public QVBox { | 54 | class CategoryTabWidget : public QVBox { |
55 | // can't use a QTabWidget, since it won't let us set the frame style. | 55 | // can't use a QTabWidget, since it won't let us set the frame style. |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | CategoryTabWidget( QWidget* parent ); | 58 | CategoryTabWidget( QWidget* parent ); |
59 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, | 59 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, |
60 | const QList<FileSystem> &); | 60 | const QList<FileSystem> &); |
61 | void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); | 61 | void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); |
62 | void updateLink(const QString& linkfile); | 62 | void updateLink(const QString& linkfile); |
63 | void setBusy(bool on); | 63 | void setBusy(bool on); |
64 | QString getAllDocLinkInfo() const; | 64 | QString getAllDocLinkInfo() const; |
65 | LauncherView *view( const QString &id ); | 65 | LauncherView *view( const QString &id ); |
66 | 66 | void setBusyIndicatorType ( const QString &type ); | |
67 | signals: | 67 | signals: |
68 | void selected(const QString&); | 68 | void selected(const QString&); |
69 | void clicked(const AppLnk*); | 69 | void clicked(const AppLnk*); |
70 | void rightPressed(AppLnk*); | 70 | void rightPressed(AppLnk*); |
71 | 71 | ||
72 | public slots: | 72 | public slots: |
73 | void nextTab(); | 73 | void nextTab(); |
74 | void prevTab(); | 74 | void prevTab(); |
75 | 75 | ||
76 | protected slots: | 76 | protected slots: |
77 | void tabProperties(); | 77 | void tabProperties(); |
78 | 78 | ||
79 | protected: | 79 | protected: |
80 | void setTabAppearance( const QString &id, Config &cfg ); | 80 | void setTabAppearance( const QString &id, Config &cfg ); |
81 | void paletteChange( const QPalette &p ); | 81 | void paletteChange( const QPalette &p ); |
82 | 82 | ||
83 | private: | 83 | private: |
84 | CategoryTabBar* categoryBar; | 84 | CategoryTabBar* categoryBar; |
85 | QWidgetStack* stack; | 85 | QWidgetStack* stack; |
86 | LauncherView* docview; | 86 | LauncherView* docview; |
87 | QStringList ids; | 87 | QStringList ids; |
88 | int tabs; | 88 | int tabs; |
89 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); | 89 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); |
90 | void addItem( const QString& ); | 90 | void addItem( const QString& ); |
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 | |||
@@ -31,137 +31,147 @@ | |||
31 | #include <qpe/qpetoolbar.h> | 31 | #include <qpe/qpetoolbar.h> |
32 | //#include <qtopia/private/palmtoprecord.h> | 32 | //#include <qtopia/private/palmtoprecord.h> |
33 | 33 | ||
34 | #include <qtimer.h> | 34 | #include <qtimer.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qdict.h> | 36 | #include <qdict.h> |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | #include <qfileinfo.h> | 38 | #include <qfileinfo.h> |
39 | #include <qhbox.h> | 39 | #include <qhbox.h> |
40 | #include <qiconview.h> | 40 | #include <qiconview.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qtoolbutton.h> | 43 | #include <qtoolbutton.h> |
44 | #include <qimage.h> | 44 | #include <qimage.h> |
45 | 45 | ||
46 | 46 | ||
47 | class BgPixmap | 47 | class BgPixmap |
48 | { | 48 | { |
49 | public: | 49 | public: |
50 | BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} | 50 | BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} |
51 | QPixmap pm; | 51 | QPixmap pm; |
52 | int ref; | 52 | int ref; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | enum BusyIndicatorType { | ||
56 | BIT_Normal = 0, | ||
57 | BIT_Blinking | ||
58 | }; | ||
59 | |||
55 | static QMap<QString,BgPixmap*> *bgCache = 0; | 60 | static QMap<QString,BgPixmap*> *bgCache = 0; |
56 | 61 | ||
57 | class LauncherIconView : public QIconView { | 62 | class LauncherIconView : public QIconView { |
58 | public: | 63 | public: |
59 | LauncherIconView( QWidget* parent, const char* name=0 ) : | 64 | LauncherIconView( QWidget* parent, const char* name=0 ) : |
60 | QIconView(parent,name), | 65 | QIconView(parent,name), |
61 | tf(""), | 66 | tf(""), |
62 | cf(0), | 67 | cf(0), |
63 | bsy(0), | 68 | bsy(0), |
64 | bigIcns(TRUE), | 69 | bigIcns(TRUE), |
65 | bgColor(white) | 70 | bgColor(white) |
66 | { | 71 | { |
67 | sortmeth = Name; | 72 | sortmeth = Name; |
68 | hidden.setAutoDelete(TRUE); | 73 | hidden.setAutoDelete(TRUE); |
69 | ike = FALSE; | 74 | ike = FALSE; |
70 | busytimer = 0; | 75 | busytimer = 0; |
71 | calculateGrid( Bottom ); | 76 | calculateGrid( Bottom ); |
72 | } | 77 | } |
73 | 78 | ||
74 | ~LauncherIconView() | 79 | ~LauncherIconView() |
75 | { | 80 | { |
76 | #if 0 // debuggery | 81 | #if 0 // debuggery |
77 | QListIterator<AppLnk> it(hidden); | 82 | QListIterator<AppLnk> it(hidden); |
78 | AppLnk* l; | 83 | AppLnk* l; |
79 | while ((l=it.current())) { | 84 | while ((l=it.current())) { |
80 | ++it; | 85 | ++it; |
81 | //qDebug("%p: hidden (should remove)",l); | 86 | //qDebug("%p: hidden (should remove)",l); |
82 | } | 87 | } |
83 | #endif | 88 | #endif |
84 | } | 89 | } |
90 | |||
91 | void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } | ||
85 | 92 | ||
86 | QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; } | 93 | QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; } |
87 | QIconViewItem* busyItem() const { return bsy; } | 94 | QIconViewItem* busyItem() const { return bsy; } |
88 | void setBigIcons( bool bi ) { bigIcns = bi; } | 95 | void setBigIcons( bool bi ) { bigIcns = bi; } |
89 | 96 | ||
90 | void updateCategoriesAndMimeTypes(); | 97 | void updateCategoriesAndMimeTypes(); |
91 | 98 | ||
92 | void doAutoScroll() | 99 | void doAutoScroll() |
93 | { | 100 | { |
94 | // We don't want rubberbanding (yet) | 101 | // We don't want rubberbanding (yet) |
95 | } | 102 | } |
96 | 103 | ||
97 | void setBusy(bool on) | 104 | void setBusy(bool on) |
98 | { | 105 | { |
99 | QIconViewItem *c = on ? currentItem() : 0; | 106 | QIconViewItem *c = on ? currentItem() : 0; |
100 | qDebug ( "set busy %d -> %s", on, c ? c-> text ().latin1() : "(null)" ); | ||
101 | 107 | ||
102 | if ( bsy != c ) { | 108 | if ( bsy != c ) { |
103 | QIconViewItem *oldbsy = bsy; | 109 | QIconViewItem *oldbsy = bsy; |
104 | bsy = c; | 110 | bsy = c; |
105 | 111 | ||
106 | if ( oldbsy ) | 112 | if ( oldbsy ) |
107 | oldbsy-> repaint ( ); | 113 | oldbsy-> repaint ( ); |
108 | 114 | ||
109 | if ( bsy ) { | 115 | if ( bsy ) { |
110 | QPixmap *src = bsy-> QIconViewItem::pixmap(); | 116 | QPixmap *src = bsy-> QIconViewItem::pixmap(); |
111 | for ( int i = 0; i <= 5; i++ ) { | 117 | for ( int i = 0; i <= 5; i++ ) { |
112 | QImage img = src->convertToImage(); | 118 | QImage img = src->convertToImage(); |
113 | QRgb* rgb; | 119 | QRgb* rgb; |
114 | int count; | 120 | int count; |
115 | if ( img.depth() == 32 ) { | 121 | if ( img.depth() == 32 ) { |
116 | rgb = (QRgb*)img.bits(); | 122 | rgb = (QRgb*)img.bits(); |
117 | count = img.bytesPerLine()/sizeof(QRgb)*img.height(); | 123 | count = img.bytesPerLine()/sizeof(QRgb)*img.height(); |
118 | } else { | 124 | } else { |
119 | rgb = img.colorTable(); | 125 | rgb = img.colorTable(); |
120 | count = img.numColors(); | 126 | count = img.numColors(); |
121 | } | 127 | } |
122 | int rc, gc, bc; | 128 | int rc, gc, bc; |
123 | int bs = ::abs ( i * 10 ) + 25; | 129 | int bs = ::abs ( i * 10 ) + 25; |
124 | colorGroup().highlight().rgb( &rc, &gc, &bc ); | 130 | colorGroup().highlight().rgb( &rc, &gc, &bc ); |
125 | rc = rc * bs / 100; | 131 | rc = rc * bs / 100; |
126 | gc = gc * bs / 100; | 132 | gc = gc * bs / 100; |
127 | bc = bc * bs / 100; | 133 | bc = bc * bs / 100; |
128 | 134 | ||
129 | for ( int r = 0; r < count; r++, rgb++ ) { | 135 | for ( int r = 0; r < count; r++, rgb++ ) { |
130 | int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; | 136 | int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; |
131 | int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; | 137 | int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; |
132 | int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; | 138 | int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; |
133 | int ai = qAlpha ( *rgb ); | 139 | int ai = qAlpha ( *rgb ); |
134 | *rgb = qRgba ( ri, gi, bi, ai ); | 140 | *rgb = qRgba ( ri, gi, bi, ai ); |
135 | } | 141 | } |
136 | 142 | ||
137 | bpm [i].convertFromImage( img ); | 143 | bpm [i].convertFromImage( img ); |
138 | } | 144 | } |
139 | busystate = 0; | 145 | if ( busyType == BIT_Blinking ) { |
140 | if ( busytimer ) | 146 | busystate = 0; |
141 | killTimer ( busytimer ); | 147 | if ( busytimer ) |
142 | timerEvent ( 0 ); | 148 | killTimer ( busytimer ); |
143 | busytimer = startTimer ( 200 ); | 149 | busytimer = startTimer ( 200 ); |
150 | } | ||
151 | else | ||
152 | busystate = 3; | ||
153 | timerEvent ( 0 ); | ||
144 | } | 154 | } |
145 | else { | 155 | else { |
146 | killTimer ( busytimer ); | 156 | killTimer ( busytimer ); |
147 | busytimer = 0; | 157 | busytimer = 0; |
148 | } | 158 | } |
149 | } | 159 | } |
150 | } | 160 | } |
151 | 161 | ||
152 | virtual void timerEvent ( QTimerEvent *te ) | 162 | virtual void timerEvent ( QTimerEvent *te ) |
153 | { | 163 | { |
154 | if ( !te || ( te-> timerId ( ) == busytimer )) { | 164 | if ( !te || ( te-> timerId ( ) == busytimer )) { |
155 | if ( bsy ) { | 165 | if ( bsy ) { |
156 | busystate++; | 166 | busystate++; |
157 | if ( busystate > 5 ) | 167 | if ( busystate > 5 ) |
158 | busystate = -4; | 168 | busystate = -4; |
159 | 169 | ||
160 | QScrollView::updateContents ( bsy-> pixmapRect ( false )); | 170 | QScrollView::updateContents ( bsy-> pixmapRect ( false )); |
161 | } | 171 | } |
162 | } | 172 | } |
163 | } | 173 | } |
164 | 174 | ||
165 | bool inKeyEvent() const { return ike; } | 175 | bool inKeyEvent() const { return ike; } |
166 | void keyPressEvent(QKeyEvent* e) | 176 | void keyPressEvent(QKeyEvent* e) |
167 | { | 177 | { |
@@ -316,48 +326,49 @@ protected: | |||
316 | cols = 1; | 326 | cols = 1; |
317 | else if ( viewerWidth >= 400 ) | 327 | else if ( viewerWidth >= 400 ) |
318 | cols = viewerWidth/150; | 328 | cols = viewerWidth/150; |
319 | setSpacing( 2 ); | 329 | setSpacing( 2 ); |
320 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); | 330 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); |
321 | setGridY( fontMetrics().height()+2 ); | 331 | setGridY( fontMetrics().height()+2 ); |
322 | } | 332 | } |
323 | } | 333 | } |
324 | 334 | ||
325 | private: | 335 | private: |
326 | QList<AppLnk> hidden; | 336 | QList<AppLnk> hidden; |
327 | QDict<void> mimes; | 337 | QDict<void> mimes; |
328 | QDict<void> cats; | 338 | QDict<void> cats; |
329 | SortMethod sortmeth; | 339 | SortMethod sortmeth; |
330 | QRegExp tf; | 340 | QRegExp tf; |
331 | int cf; | 341 | int cf; |
332 | QIconViewItem* bsy; | 342 | QIconViewItem* bsy; |
333 | bool ike; | 343 | bool ike; |
334 | bool bigIcns; | 344 | bool bigIcns; |
335 | QPixmap bgPixmap; | 345 | QPixmap bgPixmap; |
336 | QPixmap bpm [6]; | 346 | QPixmap bpm [6]; |
337 | QColor bgColor; | 347 | QColor bgColor; |
338 | int busytimer; | 348 | int busytimer; |
339 | int busystate; | 349 | int busystate; |
350 | BusyIndicatorType busyType; | ||
340 | }; | 351 | }; |
341 | 352 | ||
342 | 353 | ||
343 | bool LauncherView::bsy=FALSE; | 354 | bool LauncherView::bsy=FALSE; |
344 | 355 | ||
345 | void LauncherView::setBusy(bool on) | 356 | void LauncherView::setBusy(bool on) |
346 | { | 357 | { |
347 | icons->setBusy(on); | 358 | icons->setBusy(on); |
348 | } | 359 | } |
349 | 360 | ||
350 | class LauncherItem : public QIconViewItem | 361 | class LauncherItem : public QIconViewItem |
351 | { | 362 | { |
352 | public: | 363 | public: |
353 | LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); | 364 | LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); |
354 | ~LauncherItem() | 365 | ~LauncherItem() |
355 | { | 366 | { |
356 | LauncherIconView* liv = (LauncherIconView*)iconView(); | 367 | LauncherIconView* liv = (LauncherIconView*)iconView(); |
357 | if ( liv->busyItem() == this ) | 368 | if ( liv->busyItem() == this ) |
358 | liv->setBusy(FALSE); | 369 | liv->setBusy(FALSE); |
359 | delete app; | 370 | delete app; |
360 | } | 371 | } |
361 | 372 | ||
362 | AppLnk* appLnk() const { return app; } | 373 | AppLnk* appLnk() const { return app; } |
363 | AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; } | 374 | AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; } |
@@ -892,24 +903,32 @@ void LauncherView::sort() | |||
892 | icons->sort(); | 903 | icons->sort(); |
893 | } | 904 | } |
894 | 905 | ||
895 | void LauncherView::addItem(AppLnk* app, bool resort) | 906 | void LauncherView::addItem(AppLnk* app, bool resort) |
896 | { | 907 | { |
897 | icons->addItem(app,resort); | 908 | icons->addItem(app,resort); |
898 | } | 909 | } |
899 | 910 | ||
900 | void LauncherView::setFileSystems(const QList<FileSystem> &) | 911 | void LauncherView::setFileSystems(const QList<FileSystem> &) |
901 | { | 912 | { |
902 | // ### does nothing now... | 913 | // ### does nothing now... |
903 | } | 914 | } |
904 | 915 | ||
905 | void LauncherView::paletteChange( const QPalette &p ) | 916 | void LauncherView::paletteChange( const QPalette &p ) |
906 | { | 917 | { |
907 | icons->unsetPalette(); | 918 | icons->unsetPalette(); |
908 | QVBox::paletteChange( p ); | 919 | QVBox::paletteChange( p ); |
909 | if ( bgType == Ruled ) | 920 | if ( bgType == Ruled ) |
910 | setBackgroundType( Ruled, QString::null ); | 921 | setBackgroundType( Ruled, QString::null ); |
911 | QColorGroup cg = icons->colorGroup(); | 922 | QColorGroup cg = icons->colorGroup(); |
912 | cg.setColor( QColorGroup::Text, textCol ); | 923 | cg.setColor( QColorGroup::Text, textCol ); |
913 | icons->setPalette( QPalette(cg,cg,cg) ); | 924 | icons->setPalette( QPalette(cg,cg,cg) ); |
914 | } | 925 | } |
915 | 926 | ||
927 | |||
928 | void LauncherView::setBusyIndicatorType ( const QString &type ) | ||
929 | { | ||
930 | if ( type. lower ( ) == "blink" ) | ||
931 | icons-> setBusyIndicatorType ( BIT_Blinking ); | ||
932 | else | ||
933 | icons-> setBusyIndicatorType ( BIT_Normal ); | ||
934 | } | ||
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 | |||
@@ -44,59 +44,62 @@ public: | |||
44 | bool removeLink(const QString& linkfile); | 44 | bool removeLink(const QString& linkfile); |
45 | void addItem(AppLnk* app, bool resort=TRUE); | 45 | void addItem(AppLnk* app, bool resort=TRUE); |
46 | void sort(); | 46 | void sort(); |
47 | 47 | ||
48 | void setFileSystems(const QList<FileSystem> &); | 48 | void setFileSystems(const QList<FileSystem> &); |
49 | void setToolsEnabled(bool); | 49 | void setToolsEnabled(bool); |
50 | void updateTools(); | 50 | void updateTools(); |
51 | 51 | ||
52 | void setBusy(bool); | 52 | void setBusy(bool); |
53 | 53 | ||
54 | QString getAllDocLinkInfo() const; | 54 | QString getAllDocLinkInfo() const; |
55 | enum ViewMode { Icon, List }; | 55 | enum ViewMode { Icon, List }; |
56 | void setViewMode( ViewMode m ); | 56 | void setViewMode( ViewMode m ); |
57 | ViewMode viewMode() const { return vmode; } | 57 | ViewMode viewMode() const { return vmode; } |
58 | 58 | ||
59 | enum BackgroundType { Ruled, SolidColor, Image }; | 59 | enum BackgroundType { Ruled, SolidColor, Image }; |
60 | void setBackgroundType( BackgroundType t, const QString & ); | 60 | void setBackgroundType( BackgroundType t, const QString & ); |
61 | BackgroundType backgroundType() const { return bgType; } | 61 | BackgroundType backgroundType() const { return bgType; } |
62 | 62 | ||
63 | void setTextColor( const QColor & ); | 63 | void setTextColor( const QColor & ); |
64 | QColor textColor() const { return textCol; } | 64 | QColor textColor() const { return textCol; } |
65 | 65 | ||
66 | void setViewFont( const QFont & ); | 66 | void setViewFont( const QFont & ); |
67 | 67 | ||
68 | void setBusyIndicatorType ( const QString &type ); | ||
69 | |||
68 | public slots: | 70 | public slots: |
69 | void populate( AppLnkSet *folder, const QString& categoryfilter ); | 71 | void populate( AppLnkSet *folder, const QString& categoryfilter ); |
70 | 72 | ||
71 | signals: | 73 | signals: |
72 | void clicked( const AppLnk * ); | 74 | void clicked( const AppLnk * ); |
73 | void rightPressed( AppLnk * ); | 75 | void rightPressed( AppLnk * ); |
74 | 76 | ||
75 | protected slots: | 77 | protected slots: |
76 | void selectionChanged(); | 78 | void selectionChanged(); |
77 | void returnPressed( QIconViewItem *item ); | 79 | void returnPressed( QIconViewItem *item ); |
78 | void itemClicked( int, QIconViewItem * ); | 80 | void itemClicked( int, QIconViewItem * ); |
79 | void itemPressed( int, QIconViewItem * ); | 81 | void itemPressed( int, QIconViewItem * ); |
80 | void sortBy(int); | 82 | void sortBy(int); |
81 | void showType(int); | 83 | void showType(int); |
82 | void showCategory( int ); | 84 | void showCategory( int ); |
83 | void resizeEvent(QResizeEvent *); | 85 | void resizeEvent(QResizeEvent *); |
84 | 86 | ||
85 | protected: | 87 | protected: |
86 | void internalPopulate( AppLnkSet *, const QString& categoryfilter ); | 88 | void internalPopulate( AppLnkSet *, const QString& categoryfilter ); |
87 | void paletteChange( const QPalette & ); | 89 | void paletteChange( const QPalette & ); |
88 | 90 | ||
89 | private: | 91 | private: |
90 | static bool bsy; | 92 | static bool bsy; |
91 | QWidget* tools; | 93 | QWidget* tools; |
92 | LauncherIconView* icons; | 94 | LauncherIconView* icons; |
93 | QComboBox *typemb; | 95 | QComboBox *typemb; |
94 | QStringList typelist; | 96 | QStringList typelist; |
95 | CategorySelect *catmb; | 97 | CategorySelect *catmb; |
96 | ViewMode vmode; | 98 | ViewMode vmode; |
97 | BackgroundType bgType; | 99 | BackgroundType bgType; |
98 | QString bgName; | 100 | QString bgName; |
99 | QColor textCol; | 101 | QColor textCol; |
102 | int busyType; | ||
100 | }; | 103 | }; |
101 | 104 | ||
102 | #endif // LAUNCHERVIEW_H | 105 | #endif // LAUNCHERVIEW_H |