Make preview loading faster when scrolling
Review Request #112580 - Created Sept. 7, 2013 and submitted
KFileItemListView notifies KFileItemModelRolesUpdater of changes of the visible index range and the icon size with a delay, to prevent that expensive operations are triggered repeatedly. As far as I can tell, the original idea was to have a delay of 300 ms only if something really expensive (like the re-generation of all previews) would be triggered. However, as Christoph found out, this rather long delay is also used while scrolling, see https://git.reviewboard.kde.org/r/112312/. The code was a bit confusing - it used two different timers for "visible index range" changes and "icon size" changes, but both timers were assigned the same interval, which was also updated every time anything interesting happened. I think that it gets much simpler (and preview generation more responsive) if both timers have different intervals, and the "long" interval is really only used if the icon size has changed. Thanks to Christoph for analyzing this problem!
Previews are loaded much faster when scrolling through the view. I could not see any regressions yet.
Works as advertised, merci :) The only thing I would change is either the naming of the "Interval" constants to clarify their purpose, or move the deleted comment about them to the constants' declaration. This way, someone looking at the constants does not have to grep their usage to understand why there are two different intervals declared.