- // a blocking, we only pass items with known mime type to the preview job
- // (if the icon has already been determined for an item in startUpdating()
- // or resolveNextPendingRoles(), the type is known).
- // This also prevents that repeated expensive mime type determinations are
- // triggered here if a huge folder is loaded, and startUpdating() is called
- // repeatedly.
- //
- // Note that we always pass at least one item to the preview job to prevent
- // that we get an endless startPreviewJob()/slotPreviewJobFinished() loop
- // if there are no items with known mime types yet for some reason.
- const int count = items.count();
- int previewJobItemCount = 1;
-
- // TODO: This will start a job with one item only if this function is
- // called from slotPreviewJobFinished(), and resolveNextPendingRoles()
- // has not reached the items yet. This can happen if the previous preview
- // job has finished very fast because generating previews failed for all
- // items.
- //
- // Idea to improve this: if the mime type of the first item is unknown,
- // determine mime types synchronously for a while.
- while (previewJobItemCount < qMin(count, m_maximumVisibleItems) &&
- items.at(previewJobItemCount).isMimeTypeKnown()) {
- ++previewJobItemCount;
- }
-