From e73389e2090e05a30f20381e7f229f9bba319672 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Mon, 9 Jan 2012 22:10:12 +0100 Subject: Prevent generating previews all the time during downloading a large file When downloading a large file the preview should not be recreated each time a change-notification has been received. Create the preview after getting the first file change, but postpone creating the next previews until no change has been done during a longer period of time. BUG: 290698 FIXED-IN: 4.8.0 --- src/kitemviews/kfileitemmodelrolesupdater.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/kitemviews/kfileitemmodelrolesupdater.h') diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index b7d8ceab0..5ed45a6ec 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -126,6 +126,13 @@ private slots: void resolvePendingRoles(); void resolveNextPendingRoles(); + /** + * Resolves items that have not been resolved yet after the change has been + * notified by slotItemsChanged(). Is invoked if the m_changedItemsTimer + * exceeds. + */ + void resolveChangedItems(); + private: /** * Updates the roles for the given item ranges. The roles for the currently @@ -189,6 +196,14 @@ private: QList m_previewJobs; QTimer* m_resolvePendingRolesTimer; + + // When downloading or copying large files, the slot slotItemsChanged() + // will be called periodically within a quite short delay. To prevent + // a high CPU-load by generating e.g. previews for each notification, the update + // will be postponed until no file change has been done within a longer period + // of time. + QTimer* m_changedItemsTimer; + QSet m_changedItems; }; #endif -- cgit v1.3.1