┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/iconmanager.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-03-23 01:56:18 +0000
committerPeter Penz <[email protected]>2008-03-23 01:56:18 +0000
commit8c6e717eadc966196f72b7552012c12f46c720ce (patch)
treef3f686feef0e43923ed8ba778e3504ed70574f4f /src/iconmanager.h
parent4d1a74b7459e7ede2d20e8d6ea3e4555e36b90a9 (diff)
Performance boost for previews that are already available in the cache: apply the previews in larger blocks instead of applying them immediately after getting the signal 'gotPreview' from the PreviewJob. Now the previews in Konqueror and Dolphin are as fast as in the good old KDE 3 days :-)
svn path=/trunk/KDE/kdebase/apps/; revision=789009
Diffstat (limited to 'src/iconmanager.h')
-rw-r--r--src/iconmanager.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/iconmanager.h b/src/iconmanager.h
index 888fb42ee..ed74946e6 100644
--- a/src/iconmanager.h
+++ b/src/iconmanager.h
@@ -59,10 +59,11 @@ private slots:
void updateIcons(const KFileItemList& items);
/**
- * Replaces the icon of the item \a item by the preview pixmap
- * \a pixmap.
+ * Adds the preview \a pixmap for the item \a item to the preview
+ * queue and starts a timer which will dispatch the preview queue
+ * later.
*/
- void replaceIcon(const KFileItem& item, const QPixmap& pixmap);
+ void addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap);
/**
* Is invoked when the preview job has been finished and
@@ -73,10 +74,22 @@ private slots:
/** Synchronizes the item icon with the clipboard of cut items. */
void updateCutItems();
+ /**
+ * Dispatches the preview queue m_previews block by block within
+ * time slices.
+ */
+ void dispatchPreviewQueue();
+
private:
void generatePreviews(const KFileItemList &items);
/**
+ * Replaces the icon of the item \a item by the preview pixmap
+ * \a pixmap.
+ */
+ void replaceIcon(const KFileItem& item, const QPixmap& pixmap);
+
+ /**
* Returns true, if the item \a item has been cut into
* the clipboard.
*/
@@ -112,14 +125,25 @@ private:
QPixmap pixmap;
};
+ /**
+ * Remembers the received preview pixmap for an item.
+ */
+ struct Preview
+ {
+ KFileItem item;
+ QPixmap pixmap;
+ };
+
bool m_showPreview;
QAbstractItemView* m_view;
+ QTimer* m_previewTimer;
QList<KJob*> m_previewJobs;
DolphinModel* m_dolphinModel;
DolphinSortFilterProxyModel* m_proxyModel;
QList<CutItem> m_cutItemsCache;
+ QList<Preview> m_previews;
};
inline bool IconManager::showPreview() const