author | alwin <alwin> | 2004-11-09 00:44:31 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-09 00:44:31 (UTC) |
commit | 5bfef5f15db1698505405605f6ed50b9d7855a22 (patch) (unidiff) | |
tree | 5199765dbc2a4c4eac0c7aa12dd1e30f6610c9eb /core/launcher/launcherview.cpp | |
parent | 4638c11f127d420818e2356359ae6f2223fb4407 (diff) | |
download | opie-5bfef5f15db1698505405605f6ed50b9d7855a22.zip opie-5bfef5f15db1698505405605f6ed50b9d7855a22.tar.gz opie-5bfef5f15db1698505405605f6ed50b9d7855a22.tar.bz2 |
again some improvements to image icons
Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/launcherview.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 42704ba..72313e3 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -420,65 +420,72 @@ LauncherItem*LauncherIconView::findDocItem(const QString&fname) | |||
420 | if (item->appLnk()->file()==fname) { | 420 | if (item->appLnk()->file()==fname) { |
421 | break; | 421 | break; |
422 | } | 422 | } |
423 | item = (LauncherItem*)item->nextItem(); | 423 | item = (LauncherItem*)item->nextItem(); |
424 | } | 424 | } |
425 | return item; | 425 | return item; |
426 | } | 426 | } |
427 | 427 | ||
428 | void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) | 428 | void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) |
429 | { | 429 | { |
430 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | 430 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); |
431 | if (s!=width) return; | 431 | if (s!=width) return; |
432 | LauncherItem*item = findDocItem(aFile); | 432 | LauncherItem*item = 0; |
433 | QMap<QString,LauncherItem*>::Iterator it; | ||
434 | if ( ( it = m_itemCache.find(aFile))!=m_itemCache.end()) { | ||
435 | item = it.data(); | ||
436 | m_itemCache.remove(it); | ||
437 | } else { | ||
438 | item = findDocItem(aFile); | ||
439 | } | ||
433 | if (!item||!item->isEyeImage()) return; | 440 | if (!item||!item->isEyeImage()) return; |
434 | item->setEyePixmap(aPixmap); | 441 | item->setEyePixmap(aPixmap); |
435 | } | 442 | } |
436 | 443 | ||
437 | void LauncherIconView::checkCallback() | 444 | void LauncherIconView::checkCallback() |
438 | { | 445 | { |
439 | if (m_EyeCallBack) { | 446 | if (!m_EyeCallBack) { |
440 | return; | 447 | m_EyeCallBack = new LauncherThumbReceiver(); |
448 | connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), | ||
449 | this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); | ||
450 | m_eyeTimer.changeInterval(600000); | ||
441 | } | 451 | } |
442 | m_EyeCallBack = new LauncherThumbReceiver(); | ||
443 | connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), | ||
444 | this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); | ||
445 | } | 452 | } |
446 | 453 | ||
447 | void LauncherIconView::addCheckItem(AppLnk* app) | 454 | void LauncherIconView::addCheckItem(AppLnk* app) |
448 | { | 455 | { |
449 | LauncherItem*item = new LauncherItem( this, app, bigIcns ); | 456 | LauncherItem*item = new LauncherItem( this, app, bigIcns ); |
450 | if (item->isEyeImage()) { | 457 | if (item->isEyeImage()) { |
451 | checkCallback(); | 458 | checkCallback(); |
452 | } | 459 | } |
453 | } | 460 | } |
454 | 461 | ||
455 | void LauncherIconView::requestEyePix(const LauncherItem*item) | 462 | void LauncherIconView::requestEyePix(const LauncherItem*item) |
456 | { | 463 | { |
457 | if (!item) return; | 464 | if (!item) return; |
458 | if (item->isEyeImage()) { | 465 | if (item->isEyeImage()) { |
459 | m_eyeTimer.changeInterval(600000); | ||
460 | checkCallback(); | 466 | checkCallback(); |
461 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | 467 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); |
468 | m_itemCache[item->appLnk()->file()]=(LauncherItem*)item; | ||
462 | m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); | 469 | m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); |
463 | } | 470 | } |
464 | } | 471 | } |
465 | 472 | ||
466 | void LauncherIconView::stopEyeTimer() | 473 | void LauncherIconView::stopEyeTimer() |
467 | { | 474 | { |
468 | odebug << "Launcherview: delete opie-eye handle" << oendl; | ||
469 | if (m_EyeCallBack) { | 475 | if (m_EyeCallBack) { |
470 | delete m_EyeCallBack; | 476 | delete m_EyeCallBack; |
471 | m_EyeCallBack=0; | 477 | m_EyeCallBack=0; |
472 | } | 478 | } |
479 | m_itemCache.clear(); | ||
473 | m_eyeTimer.stop(); | 480 | m_eyeTimer.stop(); |
474 | } | 481 | } |
475 | 482 | ||
476 | void LauncherIconView::addItem(AppLnk* app, bool resort) | 483 | void LauncherIconView::addItem(AppLnk* app, bool resort) |
477 | { | 484 | { |
478 | addCatsAndMimes(app); | 485 | addCatsAndMimes(app); |
479 | if ( (tf.isEmpty() || tf.match(app->type()) >= 0) | 486 | if ( (tf.isEmpty() || tf.match(app->type()) >= 0) |
480 | && (cf == 0 || app->categories().contains(cf) | 487 | && (cf == 0 || app->categories().contains(cf) |
481 | || cf == -1 && app->categories().count() == 0 ) ) { | 488 | || cf == -1 && app->categories().count() == 0 ) ) { |
482 | addCheckItem(app); | 489 | addCheckItem(app); |
483 | } else { | 490 | } else { |
484 | hidden.append(app); | 491 | hidden.append(app); |