Added preview for text documents in calligra active

The idea started of when Shantanu implemented the preview for presentation slides in active. I had never worked or created a model in C++( to be honest in my life :P). But for this task, I had to write a model for the text document. Because this is expected by our QML. Hence wrote a code to override the QAbstractListModel’s rowCount and the data methods. The rowCount returned pageCount ( from the KWPageManager). And for the data method, I re-used the thumbnail method from the KWPage.  Registering the QML created for the center overlay was required. Once these changes were done, in the CATextDocumentHandler I tried to return the shapemanager and the document to the model. This was the key to access the KWPage and KWPageManager. And then after some qml beautification’s, the feature is ready. Sounds simple? Yes it is simple. But it wasn’t when I started of. The only thing that motivated me was to learn something new. And I got it :)  Here is the screenshot of what I had implemented:

I give a big thank you to Shantanu for sharing the idea and giving me a big helping hand. Thanks a lot. Feel free to post the suggestion for the work. Oh by the way this was the longest patch I had ever pushed to KDE :)

Comments (4)

salim khanOctober 6th, 2012 at 2:42 pm

Oh ! its a great job. Your posting is really true as well as helpful for all. These key factors must need to in consideration to sale our home. Thank you for sharing with us.keep it up.

akreuzkampOctober 7th, 2012 at 2:00 am

It looks great so far, but the pages are hardly distinguishable. Please consider using an interpolation-filter for downscaling, like Lanczos or bilinear filtering. I don’t know what you use for downscaling, but at least QImage and QPixmap provide bilinear filtering for scaling. That should increase the thumbnail-quality drastically.

Thank you for your work.

sujithOctober 7th, 2012 at 4:44 am

Noted down. Will take up as my next task. Every time I take up a task, I always think its “UNDOABLE” for me. But once I finish, I feel like it was an easy one to do. Thanks for the valuable comment.

sujithOctober 7th, 2012 at 10:40 pm

@akreuzkamp I hope that with this patch, http://quickgit.kde.org/index.php?p=calligra.git&a=commit&h=70ecce35fb1da3b0a13ed84e9dba659beec10428 , we can distinguish the pages.

Leave a comment

Your comment

(Spamcheck Enabled)