How to make a quick hack photo picker for Harmattan

A while ago I got a N950 (the MeeGo/Harmattan developer device) from Nokia (thank you very much). I’ve been playing around with it a bit and preparing for porting a Symbian/QML app. Porting the actual QML application is easy. Just adjust the layouts here and there, produce higher resolution variants of bitmap graphics, etc. The nastier part is finding out how to do some things that are not provided by Qt. In my case I would’ve wanted to use the native “camera roll” component that the native apps use for picking an image taken with the device camera.

I asked around IRC and Twitter, Googled, tried to find documentation and after an hour gave up. Despite of this kind of thing being so fundamental service, it looks like it’s not available. Ok, there’s probably some good reason rooted in the messy history of the Harmattan UI and such service would’ve been provided for developers if original plans had held, so let’s not get into that…

Anyway making your own picker isn’t really that hard. QtMobility has QML bindings for the Gallery module, which provides you a data model filled with whatever images, videos, music or files on the device you ask for. Great. The only question left is where to get the thumbnails for the images? I looked around, asked around, googled around if you can ask the DocumentGalleryModel for them (an URI to the thumbnail just like to the actual file), but I couldn’t find the answer.

The actual engine providing the data for DocumentGalleryModel in Harmattan is a component called Tracker. After a little digging I found out (well actually Sami Rosendahl pointed out) that the Tracker stores the thumbnails to ~/.thumbnails//.jpeg. A quick ssh session to the device (I think it’s awesome that you can do this) and I knew that the little square thumbnail size is called “grid”.

So without any further blabbering here’s the QML for a minimal flickable photo grid. In a real app you probably want to add some filters to the model to avoid pulling every photo to the same list, but to divide them up to months or something instead but I’ll leave that to you. (And yes you can probably get that thumbnail URI from the tracker, but this is just my cunning plan to get a person in the know to come and spill the beans in the comment section ;) )

This entry was posted in Programming and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to How to make a quick hack photo picker for Harmattan

  1. Petru says:

    A hack-less alternative is now available @ https://gitorious.org/n9-qml-photo-picker

    The N9 QML Photo Picker enable users to browse and select photos straight from your N9 app.

    Simply embed the N9 QML Photo Picker into your app and you will get a QML photo grid page similar to that of the N9 Gallery application.

    The N9 QML Photo Picker depends on Quill for loading the photo thumbnails.

  2. friv says:

    I’m a homeschooling mom. The girl needs to call the school she wants to attend, and ask them what they require. She then needs to work to fulfill the requirements. They may even suggest where she should go (community college, etc.) to get the courses she needs. Our local nursing school (ranked in the top 100 in the country) actually offers the students the remedial courses they need. If the girl is serious, she’ll follow through. I’m sure if the girl had known during high school that she wanted to attend nursing school, her mom would have helped her get the courses she needed then. I know I would have.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>