┌   ┐
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:16:17 +0100
commite73389e2090e05a30f20381e7f229f9bba319672 (patch)
treeac70e0d59e7450e3a6f3c0045ee2fd7cd14c5d23 /src/kitemviews/kfileitemmodelrolesupdater.h
parent662c0e19196238bfd0bec08b653e68dc78103cc7 (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