-rw-r--r-- | core/launcher/launcher.cpp | 8 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 28 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 3 |
3 files changed, 29 insertions, 10 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 4255b44..4ec5f4c 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -435,48 +435,56 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray & | |||
435 | stream >> italic; | 435 | stream >> italic; |
436 | if ( view(id) ) { | 436 | if ( view(id) ) { |
437 | if ( !fam.isEmpty() ) { | 437 | if ( !fam.isEmpty() ) { |
438 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 438 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
439 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; | 439 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; |
440 | } else { | 440 | } else { |
441 | view(id)->clearViewFont(); | 441 | view(id)->clearViewFont(); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | }else if ( msg == "setBusyIndicatorType(QString)" ) { | 444 | }else if ( msg == "setBusyIndicatorType(QString)" ) { |
445 | QString type; | 445 | QString type; |
446 | stream >> type; | 446 | stream >> type; |
447 | setBusyIndicatorType( type ); | 447 | setBusyIndicatorType( type ); |
448 | }else if ( msg == "home()" ) { | 448 | }else if ( msg == "home()" ) { |
449 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { | 449 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { |
450 | if (categoryBar) | 450 | if (categoryBar) |
451 | categoryBar->nextTab(); | 451 | categoryBar->nextTab(); |
452 | }else { | 452 | }else { |
453 | static_cast<QWidget*>(parent())->raise(); | 453 | static_cast<QWidget*>(parent())->raise(); |
454 | } | 454 | } |
455 | } else if (msg=="doctabEnabled(int)") { | 455 | } else if (msg=="doctabEnabled(int)") { |
456 | int id; stream >> id; | 456 | int id; stream >> id; |
457 | odebug << "Doctab enabled " << id << oendl; | 457 | odebug << "Doctab enabled " << id << oendl; |
458 | reCheckDoctab(id); | 458 | reCheckDoctab(id); |
459 | } else if ( msg == "setStaticBackground(bool)" ) { | ||
460 | int set; stream >> set; | ||
461 | odebug << "setStaticBackground " << set << oendl; | ||
462 | for (int i = 0; i < categoryBar->count(); i++ ) | ||
463 | { | ||
464 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; | ||
465 | view->iconView()->setStaticBackgroundPicture( set ); | ||
466 | } | ||
459 | } | 467 | } |
460 | } | 468 | } |
461 | 469 | ||
462 | void LauncherTabWidget::reCheckDoctab(int how) | 470 | void LauncherTabWidget::reCheckDoctab(int how) |
463 | { | 471 | { |
464 | if ((bool)how == docTabEnabled) { | 472 | if ((bool)how == docTabEnabled) { |
465 | /* nothing to do */ | 473 | /* nothing to do */ |
466 | return; | 474 | return; |
467 | } | 475 | } |
468 | if (docLoadingWidget) { | 476 | if (docLoadingWidget) { |
469 | stack->removeWidget(docLoadingWidget); | 477 | stack->removeWidget(docLoadingWidget); |
470 | delete docLoadingWidget; | 478 | delete docLoadingWidget; |
471 | docLoadingWidget = 0; | 479 | docLoadingWidget = 0; |
472 | } | 480 | } |
473 | createDocLoadingWidget(); | 481 | createDocLoadingWidget(); |
474 | { | 482 | { |
475 | QCopEnvelope( "QPE/System", "reforceDocuments()" ); | 483 | QCopEnvelope( "QPE/System", "reforceDocuments()" ); |
476 | odebug << "Sending doc rescan" << oendl; | 484 | odebug << "Sending doc rescan" << oendl; |
477 | } | 485 | } |
478 | } | 486 | } |
479 | 487 | ||
480 | //--------------------------------------------------------------------------- | 488 | //--------------------------------------------------------------------------- |
481 | 489 | ||
482 | Launcher::Launcher() | 490 | Launcher::Launcher() |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index e7229ee..a4c7561 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -273,69 +273,79 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon) | |||
273 | { | 273 | { |
274 | if (!isEyeImage()) return; | 274 | if (!isEyeImage()) return; |
275 | setPixmap(aIcon); | 275 | setPixmap(aIcon); |
276 | m_EyeImageSet = EYE_ICON; | 276 | m_EyeImageSet = EYE_ICON; |
277 | } | 277 | } |
278 | 278 | ||
279 | //=========================================================================== | 279 | //=========================================================================== |
280 | // Implemantation of LauncherIconview start | 280 | // Implemantation of LauncherIconview start |
281 | //=========================================================================== | 281 | //=========================================================================== |
282 | 282 | ||
283 | QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; | 283 | QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; |
284 | 284 | ||
285 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) | 285 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) |
286 | : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0) | 286 | : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0) |
287 | { | 287 | { |
288 | m_EyeCallBack = 0; | 288 | m_EyeCallBack = 0; |
289 | if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); | 289 | if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); |
290 | sortmeth = Name; | 290 | sortmeth = Name; |
291 | hidden.setAutoDelete(TRUE); | 291 | hidden.setAutoDelete(TRUE); |
292 | ike = FALSE; | 292 | ike = FALSE; |
293 | calculateGrid( Bottom ); | 293 | calculateGrid( Bottom ); |
294 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); | 294 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); |
295 | Config config( "Launcher" ); | 295 | Config config( "Launcher" ); |
296 | config.setGroup( "GUI" ); | 296 | config.setGroup( "GUI" ); |
297 | staticBackground = config.readEntry( "StaticBackground", false ); | 297 | setStaticBackgroundPicture( config.readBoolEntry( "StaticBackground", true ) ); |
298 | if ( staticBackground ) | ||
299 | { | ||
300 | setStaticBackground( true ); | ||
301 | verticalScrollBar()->setTracking( false ); | ||
302 | } | ||
303 | } | 298 | } |
304 | 299 | ||
305 | LauncherIconView::~LauncherIconView() | 300 | LauncherIconView::~LauncherIconView() |
306 | { | 301 | { |
307 | odebug << "LauncherIconView::~LauncherIconView()" << oendl; | 302 | odebug << "LauncherIconView::~LauncherIconView()" << oendl; |
308 | #if 0 // debuggery | 303 | #if 0 // debuggery |
309 | QListIterator<AppLnk> it(hidden); | 304 | QListIterator<AppLnk> it(hidden); |
310 | AppLnk* l; | 305 | AppLnk* l; |
311 | while ((l=it.current())) { | 306 | while ((l=it.current())) { |
312 | ++it; | 307 | ++it; |
313 | //odebug << "" << l << ": hidden (should remove)" << oendl; | 308 | //odebug << "" << l << ": hidden (should remove)" << oendl; |
314 | } | 309 | } |
315 | #endif | 310 | #endif |
316 | } | 311 | } |
317 | 312 | ||
313 | void LauncherIconView::setStaticBackgroundPicture( bool enable ) | ||
314 | { | ||
315 | staticBackground = enable; | ||
316 | if ( staticBackground ) | ||
317 | { | ||
318 | setStaticBackground( true ); | ||
319 | verticalScrollBar()->setTracking( false ); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | setStaticBackground( false ); | ||
324 | verticalScrollBar()->setTracking( true ); | ||
325 | } | ||
326 | } | ||
327 | |||
318 | int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) | 328 | int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) |
319 | { | 329 | { |
320 | switch (sortmeth) { | 330 | switch (sortmeth) { |
321 | case Name: | 331 | case Name: |
322 | return a->name().lower().compare(b->name().lower()); | 332 | return a->name().lower().compare(b->name().lower()); |
323 | case Date: { | 333 | case Date: { |
324 | QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); | 334 | QFileInfo fa(a->linkFileKnown() ? a->linkFile() : a->file()); |
325 | QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); | 335 | QFileInfo fb(b->linkFileKnown() ? b->linkFile() : b->file()); |
326 | return fa.lastModified().secsTo(fb.lastModified()); | 336 | return fa.lastModified().secsTo(fb.lastModified()); |
327 | } | 337 | } |
328 | case Type: | 338 | case Type: |
329 | return a->type().compare(b->type()); | 339 | return a->type().compare(b->type()); |
330 | } | 340 | } |
331 | return 0; | 341 | return 0; |
332 | } | 342 | } |
333 | 343 | ||
334 | void LauncherIconView::setSortMethod( SortMethod m ) | 344 | void LauncherIconView::setSortMethod( SortMethod m ) |
335 | { | 345 | { |
336 | if ( sortmeth != m ) { | 346 | if ( sortmeth != m ) { |
337 | sortmeth = m; | 347 | sortmeth = m; |
338 | sort(); | 348 | sort(); |
339 | } | 349 | } |
340 | } | 350 | } |
341 | 351 | ||
@@ -349,54 +359,54 @@ void LauncherIconView::setCategoryFilter( int catfilter, bool resort ) | |||
349 | } | 359 | } |
350 | 360 | ||
351 | void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort) | 361 | void LauncherIconView::setTypeFilter(const QString& typefilter, bool resort) |
352 | { | 362 | { |
353 | tf = QRegExp(typefilter,FALSE,TRUE); | 363 | tf = QRegExp(typefilter,FALSE,TRUE); |
354 | hideOrShowItems(resort); | 364 | hideOrShowItems(resort); |
355 | } | 365 | } |
356 | 366 | ||
357 | void LauncherIconView::setItemTextPos( ItemTextPos pos ) | 367 | void LauncherIconView::setItemTextPos( ItemTextPos pos ) |
358 | { | 368 | { |
359 | calculateGrid( pos ); | 369 | calculateGrid( pos ); |
360 | QIconView::setItemTextPos( pos ); | 370 | QIconView::setItemTextPos( pos ); |
361 | } | 371 | } |
362 | 372 | ||
363 | void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) | 373 | void LauncherIconView::drawBackground( QPainter *p, const QRect &r ) |
364 | { | 374 | { |
365 | if ( bgPixmap.isNull() ) | 375 | if ( bgPixmap.isNull() ) |
366 | { | 376 | { |
367 | p->fillRect( r, bgColor ); | 377 | p->fillRect( r, bgColor ); |
368 | } | 378 | } |
369 | else | 379 | else |
370 | { | 380 | { |
371 | if ( staticBackground ) | 381 | if ( staticBackground ) |
372 | { | 382 | { |
373 | p->drawPixmap( r.x(), r.y(), bgPixmap, r.x(), r.y(), r.width(), r.height() ); | 383 | p->drawTiledPixmap( r, bgPixmap, QPoint( r.x() % bgPixmap.width(), r.y() % bgPixmap.height() ) ); |
374 | } | 384 | } |
375 | else | 385 | else |
376 | { | 386 | { |
377 | p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(), | 387 | p->drawTiledPixmap( r, bgPixmap, QPoint( (r.x() + contentsX()) % bgPixmap.width(), |
378 | (r.y() + contentsY()) % bgPixmap.height() ) ); | 388 | (r.y() + contentsY()) % bgPixmap.height() ) ); |
379 | } | 389 | } |
380 | } | 390 | } |
381 | } | 391 | } |
382 | 392 | ||
383 | void LauncherIconView::addCatsAndMimes(AppLnk* app) | 393 | void LauncherIconView::addCatsAndMimes(AppLnk* app) |
384 | { | 394 | { |
385 | // QStringList c = app->categories(); | 395 | // QStringList c = app->categories(); |
386 | // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { | 396 | // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { |
387 | // cats.replace(*cit,(void*)1); | 397 | // cats.replace(*cit,(void*)1); |
388 | // } | 398 | // } |
389 | QString maj=app->type(); | 399 | QString maj=app->type(); |
390 | int sl=maj.find('/'); | 400 | int sl=maj.find('/'); |
391 | if (sl>=0) { | 401 | if (sl>=0) { |
392 | QString k; | 402 | QString k; |
393 | k = maj.left(12) == "application/" ? maj : maj.left(sl); | 403 | k = maj.left(12) == "application/" ? maj : maj.left(sl); |
394 | mimes.replace(k,(void*)1); | 404 | mimes.replace(k,(void*)1); |
395 | } | 405 | } |
396 | } | 406 | } |
397 | 407 | ||
398 | void LauncherIconView::setBusy(bool on) | 408 | void LauncherIconView::setBusy(bool on) |
399 | { | 409 | { |
400 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 410 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
401 | if ( busyPix.isNull() ) { | 411 | if ( busyPix.isNull() ) { |
402 | int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | 412 | int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); |
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 97b1dea..6a2d197 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h | |||
@@ -61,50 +61,50 @@ public: | |||
61 | void setUpdatesEnabled(bool); | 61 | void setUpdatesEnabled(bool); |
62 | void sort(); | 62 | void sort(); |
63 | 63 | ||
64 | void setToolsEnabled(bool); | 64 | void setToolsEnabled(bool); |
65 | void updateTools(); | 65 | void updateTools(); |
66 | 66 | ||
67 | void setBusy(bool); | 67 | void setBusy(bool); |
68 | void setBusyIndicatorType( const QString& ); | 68 | void setBusyIndicatorType( const QString& ); |
69 | 69 | ||
70 | enum ViewMode { Icon, List }; | 70 | enum ViewMode { Icon, List }; |
71 | void setViewMode( ViewMode m ); | 71 | void setViewMode( ViewMode m ); |
72 | ViewMode viewMode() const { return vmode; } | 72 | ViewMode viewMode() const { return vmode; } |
73 | 73 | ||
74 | enum BackgroundType { Ruled, SolidColor, Image }; | 74 | enum BackgroundType { Ruled, SolidColor, Image }; |
75 | void setBackgroundType( BackgroundType t, const QString & ); | 75 | void setBackgroundType( BackgroundType t, const QString & ); |
76 | BackgroundType backgroundType() const { return bgType; } | 76 | BackgroundType backgroundType() const { return bgType; } |
77 | 77 | ||
78 | void setTextColor( const QColor & ); | 78 | void setTextColor( const QColor & ); |
79 | QColor textColor() const { return textCol; } | 79 | QColor textColor() const { return textCol; } |
80 | 80 | ||
81 | void setViewFont( const QFont & ); | 81 | void setViewFont( const QFont & ); |
82 | void clearViewFont(); | 82 | void clearViewFont(); |
83 | 83 | ||
84 | void setColNumber( int ); | 84 | void setColNumber( int ); |
85 | |||
86 | void relayout(void); | 85 | void relayout(void); |
86 | LauncherIconView* iconView() { return icons; }; | ||
87 | 87 | ||
88 | signals: | 88 | signals: |
89 | void clicked( const AppLnk * ); | 89 | void clicked( const AppLnk * ); |
90 | void rightPressed( AppLnk * ); | 90 | void rightPressed( AppLnk * ); |
91 | 91 | ||
92 | protected slots: | 92 | protected slots: |
93 | void selectionChanged(); | 93 | void selectionChanged(); |
94 | void returnPressed( QIconViewItem *item ); | 94 | void returnPressed( QIconViewItem *item ); |
95 | void itemClicked( int, QIconViewItem * ); | 95 | void itemClicked( int, QIconViewItem * ); |
96 | void itemPressed( int, QIconViewItem * ); | 96 | void itemPressed( int, QIconViewItem * ); |
97 | void sortBy(int); | 97 | void sortBy(int); |
98 | void showType(int); | 98 | void showType(int); |
99 | void showCategory( int ); | 99 | void showCategory( int ); |
100 | void resizeEvent(QResizeEvent *); | 100 | void resizeEvent(QResizeEvent *); |
101 | void flushBgCache(); | 101 | void flushBgCache(); |
102 | 102 | ||
103 | protected: | 103 | protected: |
104 | void paletteChange( const QPalette & ); | 104 | void paletteChange( const QPalette & ); |
105 | 105 | ||
106 | void fontChanged(const QFont &); | 106 | void fontChanged(const QFont &); |
107 | 107 | ||
108 | private: | 108 | private: |
109 | static bool bsy; | 109 | static bool bsy; |
110 | QWidget* tools; | 110 | QWidget* tools; |
@@ -148,48 +148,49 @@ public slots: | |||
148 | void recieve( const QCString&, const QByteArray& ); | 148 | void recieve( const QCString&, const QByteArray& ); |
149 | protected slots: | 149 | protected slots: |
150 | virtual void sendRequest(); | 150 | virtual void sendRequest(); |
151 | 151 | ||
152 | signals: | 152 | signals: |
153 | void sig_Thumbnail(const QPixmap&,const QString&,int); | 153 | void sig_Thumbnail(const QPixmap&,const QString&,int); |
154 | 154 | ||
155 | protected: | 155 | protected: |
156 | PixmapInfos m_inThumbNail; | 156 | PixmapInfos m_inThumbNail; |
157 | }; | 157 | }; |
158 | 158 | ||
159 | class LauncherIconView : public QIconView { | 159 | class LauncherIconView : public QIconView { |
160 | Q_OBJECT | 160 | Q_OBJECT |
161 | public: | 161 | public: |
162 | LauncherIconView( QWidget* parent, const char* name=0 ); | 162 | LauncherIconView( QWidget* parent, const char* name=0 ); |
163 | ~LauncherIconView(); | 163 | ~LauncherIconView(); |
164 | QIconViewItem* busyItem() const; | 164 | QIconViewItem* busyItem() const; |
165 | 165 | ||
166 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 166 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
167 | QPixmap busyPixmap() const { return busyPix; } | 167 | QPixmap busyPixmap() const { return busyPix; } |
168 | #endif | 168 | #endif |
169 | void setBigIcons( bool bi ); | 169 | void setBigIcons( bool bi ); |
170 | void updateCategoriesAndMimeTypes(); | 170 | void updateCategoriesAndMimeTypes(); |
171 | void setBusyIndicatorType ( BusyIndicatorType t ); | 171 | void setBusyIndicatorType ( BusyIndicatorType t ); |
172 | void setStaticBackgroundPicture( bool enable ); | ||
172 | void doAutoScroll() | 173 | void doAutoScroll() |
173 | { | 174 | { |
174 | // We don't want rubberbanding (yet) | 175 | // We don't want rubberbanding (yet) |
175 | } | 176 | } |
176 | 177 | ||
177 | void setBusy(bool on); | 178 | void setBusy(bool on); |
178 | bool inKeyEvent() const { return ike; } | 179 | bool inKeyEvent() const { return ike; } |
179 | 180 | ||
180 | void addItem(AppLnk* app, bool resort=TRUE); | 181 | void addItem(AppLnk* app, bool resort=TRUE); |
181 | bool removeLink(const QString& linkfile,bool removeCache = true); | 182 | bool removeLink(const QString& linkfile,bool removeCache = true); |
182 | void changeItem(const AppLnk&old,AppLnk*nlink); | 183 | void changeItem(const AppLnk&old,AppLnk*nlink); |
183 | 184 | ||
184 | QStringList mimeTypes() const; | 185 | QStringList mimeTypes() const; |
185 | QStringList categories() const; | 186 | QStringList categories() const; |
186 | void clear(); | 187 | void clear(); |
187 | void addCatsAndMimes(AppLnk* app); | 188 | void addCatsAndMimes(AppLnk* app); |
188 | 189 | ||
189 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} | 190 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} |
190 | 191 | ||
191 | void setBackgroundPixmap( const QPixmap &pm ) { | 192 | void setBackgroundPixmap( const QPixmap &pm ) { |
192 | bgPixmap = pm; | 193 | bgPixmap = pm; |
193 | } | 194 | } |
194 | 195 | ||
195 | void setBackgroundColor( const QColor &c ) { | 196 | void setBackgroundColor( const QColor &c ) { |