Summary: | Enlarge image in folder preview when there's only one image | ||
---|---|---|---|
Product: | [Applications] dolphin | Reporter: | KDE Brainstorm Submissions <brainstorm> |
Component: | general | Assignee: | Peter Penz <peter.penz19> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | deblauwetom, j.maceachern, kde-bugtracker, murphi.oss |
Priority: | NOR | Keywords: | junior-jobs |
Version: | 16.12.2 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | All | ||
Latest Commit: | Version Fixed In: | 4.7.0 | |
Sentry Crash Report: | |||
Attachments: |
Mockup
Example of the "easy part" Proposal for the "hard part". 2nd proposal to enlarge a single thumb of a file |
Description
KDE Brainstorm Submissions
2010-06-06 07:46:17 UTC
Please see below for a mockup. is this bug still to be done? Any pointers in what file the directory preview is generated? really having a hard time finding it :) The code for this is in http://websvn.kde.org/trunk/KDE/kdebase/runtime/kioslave/thumbnail/thumbnail.cpp (method ThumbnailProtocol::thumbForDirectory()) I think it should not be too tricky to solve... I took a look at this, and it's easy enough to change the behaviour based on the number of files; the harder part is changing the behaviour based on the number of *thumbnailable* files. i.e. I have it set to enlarge a single image, but if it's, say, a single image and a bunch of $foo files that don't have thumbnailers, then it falls back on the old behaviour. I'll see what I can do later. Created attachment 53424 [details]
Example of the "easy part"
This provides the behaviour I mentioned above. Some reworking of other code will be necessary to do it properly, though.
Created attachment 55834 [details]
Proposal for the "hard part".
The number of tiles is set based on the result of the new function hasMultipleThumbnailableFiles. It checks for each file in the directory if it is thumbnailable using the function pluginForMimeType. The code is mostly copid from other functions of the class.
There could be one perfomance issue:
Until at least two thumbnailable files are found, pluginForMimeType is called for each file. This function contains two nested loops to find the correct plugin. With a large number of plugins and/or a large number of not thumbnailable files _could_ influence the performace. This has not been tested yet.
@Martin: That's more or less what I was thinking of as well (although I haven't tested your patch yet). Maybe post this on ReviewBoard to get more feedback? I had hoped there would be a nicer way to do this, but I doubt there is. (Also, one note: you spelled the function name wrong) @Martin: Thanks for the patch! However as you said already the performance is a problem here: QDir::entryList() and pluginForMimeType() are very expensive operations and now we invoked them 2 times more often than with the old approach... Probably a trick might be that the first generated image should get scaled twice (one with the current size and one with the double-size). If the main-loop is exited after one item we can apply the double-sized image afterwards. Just a suggestion ;-) Created attachment 56029 [details]
2nd proposal to enlarge a single thumb of a file
In this patch there are two previews generated for the folder. The first one (img) is generated with up to 4 thumbnails, the second one (oneTileImg) only with one thumbnail. The second preview won't be touched after the thumb is generated for the first thumbnail-able file.
The bool variable hasThumbnail is substituted by the int variable validThumbnails. This holds the number of successful generated thumbs. If only one thumbnail-able file has been found oneTilImg is returned, otherwise img.
Posted to reviewboard: http://svn.reviewboard.kde.org/r/6332/ Pushed to git. Peter and Jeffery: Thanks for your support and the reviews. -- Git commit 33dc8a5de3dc3e8f9f64c3d1df6dee5a05b4c36d by Martin Engelmann. Committed on 07/02/11 at 19:58. Pushed by mengelmann into branch 'master'. Enlarge image in folder preview when there's only one image BUG: 240861 M +52 -24 kioslave/thumbnail/thumbnail.cpp M +5 -0 kioslave/thumbnail/thumbnail.h http://commits.kde.org/kde-runtime/33dc8a5de3dc3e8f9f64c3d1df6dee5a05b4c36d Thank you KDE team for implementing this idea! Your work is greatly appreciated. |