Quantcast
Channel: Maemo Nokia N900 » commodore
Viewing all articles
Browse latest Browse all 3

How quick I got started with Qt Quick

$
0
0

d2e153a0aa51 28.png How quick I got started with Qt QuickA month ago I downloaded the last Qt SDK, plugged my Nokia N9 to it and started writing from scratch a chess game UI. This week Miniature 0.3 Berlin Defence has been released sporting a demo UX running with real Qt Quick code of my own forge. I have learned a lot with the help of many and I can’t describe how happy I am now – even if this is only the beginning!

// Skippable background

This was my debut at programming, preceded only by HTML web pages in 1995-97 and a Basic sketchy game with 3 sprites that never went beyond the Commodore 64 we had at home around 1983. In fact as a teenager my vocation was always split between natural and artificial languages, and only after a close tie I started my studies in Communication Sciences – Journalism branch. Since then I’ve written a lot and I’ve learned to describe, specify and instruct by putting words one after another (still not as good in English as I would wish).

For what is worth I’m not a designer either. At the university I devoured the splendid collection of comic books of my faculty but I didn’t succeed at drawing my own strips. Still, I had the luxury of living surrounded by creative, practical and pragmatical people with a varied range of skills and tastes. Over the years I have developed some sense of how new things could look like and behave. Conscious of the big amount of time it takes me to use Gimps, Adobes and the likes only to come up with mediocre results, most of the times I resort to concepts on paper.

But let’s go back to the chess program.

f0f6a0deba19 001.jpg How quick I got started with Qt Quick// Skippable background about the chess program

Two years ago I had convinced the great Michael Hasselman (mikhas) and a few others to create the Miniature project, being my main tools of persuasion a plan on a wiki page plus a pencil draft. Not being a programmer or a designer, these are the weak arguments you have at reach to get things done. Miniature had a short and unstable life in the Maemo extras-devel repository for adventurous N900 users. You could say we didn’t succeed… yet some of my best moments with the N900 (and I had many) had Miniature running in the foreground. For instance, playing late night with the also great Iván Frade in Meritähti, the cozy and nutritious bar no tourist guide will recommend if you ever visit Helsinki.

After the N9 launch I saw with despair that proper mobile chess was still absent in the Qt catalog. I made a second call, and almost miraculously mikhas answered again, but this time stating clearly that he would focus on the backend and somebody else would need to work on the UI. I looked around. I looked myself in front of the mirror (mentally, I mean). The first Miniature had to deal with Qt 4.6 and QGraphicsView with no cutton or oil. Hardcore stuff. Now the declarative and Javascript friendly Qt Quick was at the forefront, waiving the slogan of Programmers and Designers Unite! I decided to give it a try, getting a tacit permission from my manager to call some of this time “training”.

And yes, this is great training! Sitting in front of tutorials and code examples for the sole purpose of learning is boring – at least for me. Trying out things, copypasting code from somewhere, asking on IRC and forums, building and rebuilding until the damn thing works is überexciting – at least for me.

5839da503ee FICS.png How quick I got started with Qt Quick// Finally some actual stuff

These are some pros and cons found during the first stages of this trip. I hope they are useful for others like me, getting started in Qt Quick and in programming. They are all mixed since frequently a con leads to a pro and vice versa. In some cases it’s not even clear whether the thing is a pro or con, but it’s remarkable anyway:

The Qt SDK is such a beast
And I got my way with relative ease. Accessing documentation while writing code, connecting to the device… The first time I couldn’t believe my dummy rectangle was showing up in the N9, an icon was added to the app grid and a .deb package was sitting in a local folder of my laptop.

But Qt Designer can’t be used yet
I had so much hope in Qt Designer for my first steps. I had played with it and it reminded me the old good Macromedia Fireworks, with the additional advantage of generating actual code. Then I found out that it was basically of no use here and now for MeeGo development.

Neither the Simulator, and even the emulator…
Qt Simulator didn’t digest MeeGo either, here and now. QEMU could but… Good that I had a device because the simu/emu would have required a lot more time for someone new like me, needing to see how things progress every 2 new lines.

Getting started with Qt Quick is really simple
Without Designer I quickly realized that typing directly the code in a proper SDK was simple enough and probably lead me to cleaner and more solid structures. I started to learn how QML thinks, and starting to guess what would and would not work even before pressing the build & deploy button.

c6e9a771f553 40.png How quick I got started with Qt QuickThe documentation is extensive, but still not consolidated
QML and Qt Quick have evolved a lot in a short amount of time, and different audiences with different background are meeting there almost for the first time together. All in all it feels that whatever is different from Qt/C++ is explained in detail (e.g. anchors or pure UI elements) while other parts closer to traditional Qt are mentioned with more brevity. This is surely fine for Qt/C++ developers, but this is also where the less experienced or more web oriented developers might get stuck. In some points I have missed more basic descriptions, wider code examples… oh, and many more screenshots showing how demo apps and components are supposed to look like without having to run them in the SDK.

The community is savvy and very helpful
Whenever you get stuck in something you start looking for help. I didn’t rely (much) on the professional developers sitting few steps away from my desk (except for really embarrassing basic questions). I put my immediate hopes in IRC, but being August and typing from PST got me more silence than expected in #qt-qml. Still I got some great answers from e.g. special and frals. #harmattan was a second resource but the Scratchbox – Python – middleware angle of that group is noticeable. #miniature is obviously useful but I didn’t want to exhaust the patience of mikhas… Then I decided to become a Lab Rat (now a Ant Farmer) in the Qt Developer Network and since then the forum hasn’t disappointed me once. Getting the attention of a troll, a certified specialist or just the right person with the same (solved) problem is just a luxury.

The veterans don’t have always the right advice for you
These days I’ve got many Qt answers to my QML questions… since I was asking to Qt savvy developers. That helped me understanding better my own questions, and finding out where to find the QML centric answers. Like for instance “how to put a link to a web page opened by the device browser?”. Sure, Qt and DBus can do wonders for you – but actually the right answer for me was something a lot simpler: Qt.openUrlExternally(). The feeling was familiar: years ago GNOME desktop developers would answer my questions with “open terminal and type…” when actually the desktop itself offered solutions not involving a console.

Backend and UI can really be developed in parallel
While mikhas has been working hard on a C/C++ backend containing abstract models, internal logics, capacity to talk to the Free Internet Chess Server via telnet and to plug into GNU Chess, I was able to define a UI with all its interactions almost autonomously. I actually started with an own QML project separate from Miniature, until mikhas liked what he saw and decided to integrate it. I just had to leave comments in the code: // FIXME this is a static string, the backend should hook here with a real variable. Now we are basically at the point where mikhas has a backend that play games you can’t see, while I got a nice UX that doesn’t know any chess. Sewing is happening as we speak.

Open source development is just great
If I started with Qt Quick from scratch one morning, on the afternoon I was already learning how to get that code and package out of my system, to be seen and tried by others. I didn’t get much attention at the beginning, but only the fact of writing publicly brought me to structure things as good as I could (still crappy, I know) and to comment a lot more and better that I would comment just for myself. Again the Qt SDK was useful here, generating packages that install and bridging with git nicely. Additional thanks go to the maintainers of paste.debian.net and to the various authors of little but useful code snippets borrowed here and there. Every time I said “I can’t be the first one having to do XYZ” turned out to be true. Someone had gone through that and was sharing the result with the World. Thank you, thank you very much.

// This is getting longer than expected. Again.

CONCLUSION
I feel a lot better, even if these days I’m suffering a lot more. c88b4deb83n wink.gif How quick I got started with Qt Quick Playing with ListModel, GridView, states and animations hasn’t been always funny but after many trials and errors I got exactly the behavior and the effects I was looking for. Now a new Miniature contributor can come willing to implement the logics for e.g. chess by email and I know I will be able to help providing a decent UX. In the meantime Qt5 and myself are getting closer to deeper Javascript support, which looks promising and a sure continuation of the fun!

I’m about to start my second month of Qt Quick programming. Miniature 0.4, here we go!

 How quick I got started with Qt Quick

Tagged: chess, development, Harmattan, MeeGo, miniature, N9, N950, qml, Qt, qtquick  How quick I got started with Qt Quick  How quick I got started with Qt Quick  How quick I got started with Qt Quick  How quick I got started with Qt Quick  How quick I got started with Qt Quick  How quick I got started with Qt Quick  How quick I got started with Qt Quick  How quick I got started with Qt Quick

2011-08-25 22:44 UTC with score 0

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images