KDirModelV2, KDirListerV2 and UDSEntryV2 suggestions

Aaron J. Seigo aseigo at kde.org
Wed Jan 23 14:35:49 UTC 2013


On Monday, January 21, 2013 21:09:59 you wrote:
> - RMB context menu
> - App wide shortcuts
> - Clipboard integration..

these are all being worked on.

> In my DirModel i took a good close look at the current DisplayRole
> stuff. It was a blocking call that could potentially slow the
> interface down. Not anymore! I added a new role called: "MimeOrThumb"
> which will display either a mime image or a thumbnail image:
> http://gitorious.org/porpoise/master/blobs/master/dirmodel.cpp#line204
> That alone won't make it non blocking.

instead of a new role, could this simply be used for DisplayRole?

> I needed the power of the
> Image{} element since that can be set to handle images asynchronous
> http://qt-project.org/doc/qt-4.8/qml-image.html#asynchronous-prop thus
> non blocking. In order to get that done, i added 2 image handlers,
> "image://mime/<icon>" and "image://thumb/<full pretty url> which you
> can find here:
> http://gitorious.org/porpoise/master/blobs/master/mimeimageprovider.h

creative approach; it also reminds me how ugly the API for 
QDeclarativeImageProvider is. btw, while you check the size var before using 
it the first time, you don't do so the second time. a possible crash lurks :) 
and if both size and requestedSize are passed in with valid values, size will 
probably have the wrong value set. (256x256 rather than the actual 
requestedSize that is returned) personally, i'd probably just write it like 
this:

const QSize s = requestedSize.isEmpty() ? QSize(256, 256) : requestedSize;
if (size) {
	*size = s;
}
return icon.pixmap(s);

shorter, no crashes, guarantees size always gets the right value if a ptr is 
passed in. :)

> (mime) and here
> http://gitorious.org/porpoise/master/blobs/master/thumbimageprovider.h
> (thumb). On top of that i added a KImageCache (or actually modified
> where it's being called) since i want to have a single point for the
> KImageCache i made it available through my static class:
> http://gitorious.org/porpoise/master/blobs/master/util.h#line35. That
> part won't be usable in a generic KDirModel with threading.

assuming this one cache is used for multiple things by the application, and 
not just the file listing model for thumbnails, a mutex around it would 
probably be enough. it should also probably live outside the UI thread ...

btw, is there any chance that you might move this to git.kde.org in future?

-- 
Aaron J. Seigo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20130123/b533c731/attachment.sig>


More information about the Kde-frameworks-devel mailing list