Created attachment 47727 [details] Mockup Version: unspecified (using KDE 4.4.3) OS: All While looking at my music collection, Dolphin does it job well of showing me previews of the images in all of these folders. However, since all folders correspond to one album each, there is always only 1 image per folder. Yet the folder preview puts that image in the top-left corner of the folder. What would be nice is that more of the surface of the preview should be used by the image, but only when the folder only contains one image. This feature request was originally submitted through KDE Brainstorm, and has been submitted to Bugzilla due to popular demand. Original idea: http://forum.kde.org/brainstorm.php?mode=idea&i=84413 Reproducible: Didn't try
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.