┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodelrolesupdater.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-01-09 22:10:12 +0100
committerPeter Penz <[email protected]>2012-01-09 22:18:24 +0100
commit69f68a2349a6a8ef568ecb0a72f4f0e3f1903144 (patch)
tree1a61c470e3466a48bcd3c4bde9ab5e64ce007ffe /src/kitemviews/kfileitemmodelrolesupdater.h
parentfc600ed2554fb767865b297039a94e5fc653f6b9 (diff)
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
Diffstat (limited to 'src/kitemviews/kfileitemmodelrolesupdater.h')
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.h15
1 files changed, 15 insertions, 0 deletions
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<KJob*> 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<KFileItem> m_changedItems;
};
#endif