-rw-r--r-- | core/launcher/launcherview.cpp | 19 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 2 |
2 files changed, 15 insertions, 6 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) if (item->appLnk()->file()==fname) { break; } item = (LauncherItem*)item->nextItem(); } return item; } void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) { int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); if (s!=width) return; - LauncherItem*item = findDocItem(aFile); + LauncherItem*item = 0; + QMap<QString,LauncherItem*>::Iterator it; + if ( ( it = m_itemCache.find(aFile))!=m_itemCache.end()) { + item = it.data(); + m_itemCache.remove(it); + } else { + item = findDocItem(aFile); + } if (!item||!item->isEyeImage()) return; item->setEyePixmap(aPixmap); } void LauncherIconView::checkCallback() { - if (m_EyeCallBack) { - return; - } + if (!m_EyeCallBack) { m_EyeCallBack = new LauncherThumbReceiver(); connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); + m_eyeTimer.changeInterval(600000); + } } void LauncherIconView::addCheckItem(AppLnk* app) { LauncherItem*item = new LauncherItem( this, app, bigIcns ); if (item->isEyeImage()) { checkCallback(); } } void LauncherIconView::requestEyePix(const LauncherItem*item) { if (!item) return; if (item->isEyeImage()) { - m_eyeTimer.changeInterval(600000); checkCallback(); int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); + m_itemCache[item->appLnk()->file()]=(LauncherItem*)item; m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); } } void LauncherIconView::stopEyeTimer() { - odebug << "Launcherview: delete opie-eye handle" << oendl; if (m_EyeCallBack) { delete m_EyeCallBack; m_EyeCallBack=0; } + m_itemCache.clear(); m_eyeTimer.stop(); } void LauncherIconView::addItem(AppLnk* app, bool resort) { addCatsAndMimes(app); if ( (tf.isEmpty() || tf.match(app->type()) >= 0) && (cf == 0 || app->categories().contains(cf) || cf == -1 && app->categories().count() == 0 ) ) { addCheckItem(app); } else { hidden.append(app); diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index ebb1362..94c367c 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h @@ -17,24 +17,25 @@ ** not clear to you. ** **********************************************************************/ #ifndef LAUNCHERVIEW_H #define LAUNCHERVIEW_H #include <qtopia/storage.h> #include <qtopia/applnk.h> #include <qvbox.h> #include <qiconview.h> #include <qtimer.h> +#include <qmap.h> class CategorySelect; class LauncherIconView; class LauncherItem; class QIconViewItem; class QLabel; class QWidgetStack; class MenuButton; class QComboBox; @@ -230,15 +231,16 @@ private: LauncherItem* bsy; int busyTimer; bool ike; bool bigIcns; QPixmap bgPixmap; QColor bgColor; LauncherThumbReceiver*m_EyeCallBack; #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY QPixmap busyPix; #endif BusyIndicatorType busyType; QTimer m_eyeTimer; + QMap<QString,LauncherItem*> m_itemCache; }; #endif // LAUNCHERVIEW_H |