Category Archives: Qt

The end of the Symbian era

Heavy clouds seem to have been hanging over the Symbian platform since February 11 this year, when the new CEO Stephen Elop announced that Nokia has chosen Windows Phone for its devices as the main operating system in the future. It was obvious for some that Symbian’s, as well as Qt’s end have been called. Although, Nokia still claimed that it’s formerly dominant platform will still be evolving and the Qt platform will be there.

I’ve lost my job as a Symbian developer at the beginning of the year, and I was wondering if there’s a place for a Symbian/Qt developer in the market yet. I’ve trusted Nokia’s promises. I’ve decided to continue with the Qt framework for development. I’ve been attending events that gathered people interested in that technology (starting in 2009 with the Meego long weekend Barcelona, followed by the Symbian Exchange and Exposition in 2009 and 2010, volunteered at Symbian stand at MWC in 2010, attended Nokia Dev Day at MWC 2011, Qt labs in Madrid in April this year, Intel AppUp labs for Meego in February and June), I’ve been observing trends in freelance projects (www.elance.com) and yet trying to search for opportunities locally. Unfortunately all of these intents (robotic laugh here) were unsuccessful. Some of the clients I’ve talked to were very interested in Qt development at the beginning (March-June) but soon they all changed their decisions to go away from native development towards HTML5 or simply drop the Symbian project as not worth the investment. By the end of August there were virtually no signs of interest in Symbian/Qt development.

In the meantime I was still working on my own projects for the Ovi Store (BiCitizen , Siberdrome, Solitarius) so I didn’t just lose my time thinking of the wasted opportunities. Although, it was obvious that at some point I will have to move elsewhere as the promises of Qt for the next billion were too vague. Having in mind previous Nokia’s promises about Qt, I guess it was not worth wasting the time to wait for another market opportunity. Now, that even Intel moved away from the Qt platform with Tizen, please raise your hands up, who are still planning the mobile Qt project soon.

I must say I’ve achieved something more than decent in the Ovi Store. “Solitarius” game has been downloaded more than 350.000 times in over 200 countries and other game, “Siberdrome” (only Symbian^3) almost 30.000 in last 3 months. But If I see similar games on the Android Market, (i.e. this Solitaire game) which achieved over 10 million downloads, it’s just hard to compare the range of success.

Nokia World event is approaching so we can expect the appearance of the Nokia Windows Phone, but is the Windows Phone the best direction for the Symbian/Qt developers?

I’ve worked with Symbian C++ since 2006. At first using the Visual Studio but then the Carbide/Eclipse environment since it was enough stable to be usable (which dates back to 2007) and finally accustomed myself to it’s flexibility and extensibility. Qt SDK came with the custom IDE that couldn’t be compared to any other IDE with which I’ve worked with so far. Although fast and well designed, it was sometimes inconvenient. Qt APIs are great on the other hand so I couldn’t complain too much about developing with the formerly-Trolltech’s SDK. It was a huge step forward from the obsolete Symbian C++ environment.

Having all this baggage I’ve brought with me from Nokia, I’ve decided to step away from it and started the Android development. This is probably obvious for those who did the same, but what a relief it was to come back to this great open-source Eclipse IDE. How nice to see many APIs and classes resemble those from Qt, and have those XML layouts which are not so far from Qt layouts and Qt-Quick. Already at the beginning I felt like I’m one leg in the Android ecosystem. Being able to quickly compile and package multi-language application with support for multiple resolutions and well-defined backwards compatibility, I was so happy I almost peed in my pants*… I wonder if heads of Nokia thought about this convenience for a while, while deciding to make a change of environment for the developers. Maybe the biggest enemy was actually a close friend here.

I’ve never taken Nokia’s decisions personally and was never angry at the changes in their plans and shifts of strategy. While living in Spain, I’ve watched how Spanish government had to make serious cuts in the public sector recently to save the country’s economy. Having seen the movement of “Indignados”, protesting against decisions of the government, sometimes in a very inappropriate way, I’ve decided it’s just a wrong to outrage. Showing that you can live well to someone who put you in a very difficult situation is much healthier response than revenge.

At the moment, that’s for sure, none of my friends wants a Symbian smartphone anymore. One of them who went to a few stores to get advices on smartphones recently, heard from sellers to get out of Symbian (not to mention allusions to the human waste). Those I know still choose other brands in spite of the reasonable effort I put to tell them something good about Nokias. My girlfriend is a great example here. She got two of her pictures into the www.nokiacreative.com contest for August. People are impressed with the quality of the N8’s pictures, but they get put off when they hear the “S” word.

This way I’ve joined the club of the green mushroom-like avatars, waving my hand to the new world. I don’t say goodbye to Nokia forever. Maybe we will cross our paths in the future. Maybe I will actually use one of the technologies they develop. But even now, eight months after the February 11 announcement I’m still confused which development platform they try to focus on. Is it Windows Phone? Is it Qt? Is it S40 with J2ME?

*Not for warmth

Learning Qt Quick(ly)


Again?

The new programming framework QtQuick (or QML when referring to a language) developed and supported by Nokia is as much of a challenge as an opportunity for the mobile phone programmers.

Learning new programming languages might be as difficult as learning the language spoken by the tongue. To the contrary, learning the spoken language might be also easy and pleasant, so there’s no reason to approach this challenge as an obstacle.

Been here before.

Having learnt a few programming languages in the past (C, C++, MFC, Symbian C++, Matlab, Bash scripting, etc.) and now working with Qt, but also a few spoken languages (Polish, English, Spanish, and bits of German, Russian and Catalan) I try to remember where the learning was difficult and where it went like a charm. Let me tell you a story how it went with a few spoken languages.

Hello (World)!

The first foreign language I got in touch with was obviously English, as the political switch Poland experienced at the end of the 80’s and the beginning of the 90’s turned the pop culture upside-down. I guess many public schools were not prepared to this new situation, and the teachers were going the very obsolete path read-conjugate-memorize. That was a very painful road to learning the language, and if there was no Nirvana, Jim Carrey, The Simpsons and at last (but not least) Jerry Seinfeld, I’d probably never become fluent in this language.

Hier kommt die Sonne.

Then at some later stage I started learning German. Because living close to the west border of Poland has always been marked by the strong international connections (and remembering the words of grandfathers to “know the language of your enemy” 😉 ). Hopefully the pop-culture was helpful too. The chart-buster Rammstein music or movies like “Run Lola, Run” or “Goodbye Lenin” were always a good training field, and gave an emotional boost. So after a year of learning in a private school I went for holidays to a “Bizarre” music festival in the west of Germany and discovered I can already communicate! Even the basic set of language skills could be an effective tool for communication.

Excuse Señor, no speaking Inglese

Then one day I decided to go to Spain, Almeria for the student exchange and apparently I had no knowledge of Spanish. This was again a different family of languages, so it was not only about learning few irregular verbs and communicating in a funny manner but with almost no initial effort. I had to learn everything from the “Hola”. So the first approaches were not very easy. I went to a quick course of the language at the university, but left with a sensation of a lost time, as I almost didn’t pick up anything from it. But I started learning something about the place where I will go and that caught my attention. Getting to know something about the history of southern Spain (Andalucia) woke up my imagination of the place. Then I started a self-learning course for listening, where I had to repeat phrases from a quasi-real situations a few times during each lesson. This role-playing worked quite well, as after only 1 month of this course I was able to deal with random situations like i.e. to buy a ticket at the bus from the airport in Almeria. Then everything started to play in sync, when I was chatting or being chatted up at a nearby coffee place, park, etc… After 5 months spent there I was an effective communicator with a good writing and speaking skills.

How do you say “Hello” in this new language?

So how does it match learning Qt Quick, you may ask. Where’s the connection?

Learning programming language is in general easier task than learning the spoken language. If you know one, especially C-like language, you will find yourself easily around others. Those relations can be similar to a family of languages. It’s like learning Spanish for Italians, Dutch for Germans, Russian for Poles (or British English for Americans)… Qt Quick is more than that. Besides the Qt environment that is very much like C++, there’s also a UI layer defined in QML. I can assume every programmer had some experience with either XML or HTML and maybe knows a bit of JavaScript.

It might be difficult if you don’t know what to do with the new environment. Where to start, where to pick up, which way to go? Very important parts of learning this new environment are similar to the ones that make learning spoken languages successful. But Qt Quick is settled on some very strong pillars, which will be helpful for a programmer during all the development journey.

Four riders of the apocalypse Qt revolution.

Who are they? Where do they come from? There’s no problem figuring out where Qt started. It’s a company called Trolltech being a part of Nokia now. Why is it so good for developers? Here are the reasons.

One is to know what has been done with it already.  Qt has a 15-year long history of successful appliances in technology, entertainment and everyday-use devices. Big money and fame has already proved to have the Qt frameworks planted back in the garden. Nokia has already over 75million Qt-capable devices in the field and will continue to support the Qt development. Intel will continue developing MeeGo and will also support the Qt technology with their fantastic tools.

The next is what can you do with it as a programmer? Browse one of the open-source Nokia Projects, or Qt-Labs repositories, download them, play with them, modify them, do something new based on them! That’s so easy when you can see the real and functional app that’s open source. Then publish the app in the Ovi Store, or Intel AppUp store. If that’s not enough, see where else you could go with Qt. That gives myriads of opportunities.

Further one is the community here. You won’t be lost between examples, videos and download links. There’s an active and supporting community forum.nokia.com which is always available for you to help. I’ve been a part of that community for over 4 years now, and I have been very content with how it works. It’s like being in that coffee place or a park where people start talking to you, so the foreign land becomes your own.

And finally when you already know what to do, reach out for books. The recently announced book “Beginning Nokia Apps Development: Qt and HTML5…” is a perfect companion for the day-to-day development. And the F1 key should never be undervalued when working with the Qt Creator.

“Punk is (not) dead” was also a big hit since the early 1980’s.

Now one last word. I’ve seen many blog and twitter entries about “Symbian is dead” (or will be soon) and “Qt has no future” (because Microsoft tools are the future target). As I’ve been living in Barcelona, it reminds me of the case of the Catalan language. Many discuss the viability of this language vs. Spanish which is dominating globally. While we are a part of the global environment, we live in the local environment. The local environment will always have the advantage, because that’s how people are. Analogically, Qt and Symbian are “here and now”. They are very strong and growing. So global marketing of other platforms cannot change this. We will speak QML here.

Quick first steps – qtbubblelevel 2D

Recently updated QML projects showcase encouraged me to start learning more about QML. Two examples gathered my attention especially. The first of them is the Bubble Level application which uses the accelerometer reading to provide a leveling tool, and another a really cool game called Quick Hit.

As the latter has rather complicated structure with animations, multiple windows and plugins, I’ve left it for ‘dinner’ and started looking into the leveling app. I first looked into the “BubbleLevel.qml” file which was indicated as the UI starting point. The structure of the UI is very simple and I’ve found myself quickly around the controls’ definitions. Most of them have the typical height/width/anchors/margins attributes for quick UI creation. Additional features include function call on the event like:

onClicked: bubbleLevel.minimizeApplication()

where “minimizeApplication()” is the public SLOT in the app definition, so binding the QML UI with CPP functionality is extremely easy.

One of the puzzling elements was the definition of some UI elements. Some of them like “Image”, “MouseArea” or “Flipable” are already defined in the framework, others are defined in a separate file provided by the application like “Tube” and “Button”. It seems that the name of the control is taken directly from the qml file name so the Tube is defined in the Tube.xml file and Button in the Button.xml file respectively.

While there’s a lot more to learn about the UI in this app, I thought to extend it’s functionality to ^2, by adding the second dimension to the bubble movement. So in the first place I created/modified the graphic resources to support the second dimension. These include:

  • air bubble (is more or less round now)
  • tube (now became something like a football pitch)
  • vertical shadow
  • vertical scale

Notice that new files need to be added to the .qrc resource file.

To support the new dimension I had to look into the C++ code where the accelerometers readings are fetched. The function provides already 3 readings, so I didn’t have to modify it, just add the “y” dimension to the rotationChanged signal (now watch out, in case of Maemo the “y” axis has to be inverted to work in the same manner as the “x” axis; for Symbian it’s yet to be checked, as I couldn’t install the Qt 4.7.1 on my test phone yet). This started a chain of inconsistencies, as the SLOT connected to this signal needs to be changed. These connections are defined in the main.cpp file so tracking them down didn’t cause much trouble. There were also two functions from the settings.h which needed another argument, and these are saveCorrectionAngle and correctionAngle.

When the application was already compiling I launched it and of course didn’t work yet, because the necessary QML bindings were not defined for the second dimension. Moreover the bubble stopped moving as the functions were not compatible anymore. Luckily running the application in the Qt Simulator or from the Shell Console on Nokia N900 you can see the debugging messages. In this case they helped to localize the mistaken bindings.

// Signaled when correction angle is saved
signal saveCorrectionAngle(variant angleX, variant angleY)

// These functions are used as Qt slots
function handleRotation(degX, degY) {
horTube.rawangleX = degX
horTube.rawangleY = degY
}

function setCorrectionAngle(degX, degY) {
horTube.angleconstantX = degX
horTube.angleconstantY = degY
}

Now a bit more (but still not too much) work was needed to modify the Tube behavior. When the new readings are set to the tube, only the item’s property rawangleX/Y change and the position is updated automatically. With the new dimension, we had to add the new function to calculate the variation of the bubble from the center of the tube. The original behavior was to reach the limit of the tube every 20 degrees horizontally (this was defined in a bit obscure way; the order of “/” and “*” operations was hard to guess), so we I did the same for the vertical axis.

The final refinements included changing buttons anchors

top: parent.top
 //verticalCenter: horTube.verticalCenter

and changing the tube’s height to the actual proportions occupied on the background image

width: parent.width * 0.775; height: parent.height * 275/480

There was a problem running the example on Symbian phone due to unavailability of the qt libraries (also qt_installer.sis from the SDK failed for some security reason) but let’s hope this get fixed in the nearby future.

Here is the modified source as well as the installation packages:
QtBubbleLevel.sis (Symbian^1)

QtBubbleLevel_installer.sis (Symbian^1 with smart installer)

qtbubblelevel_1.3.0_armel.deb (Maemo)

qtbubblelevel-1.3.0-1.i586.rpm (MeeGo)

qtbubblelevel_2D-src.zip (source code)
As you can see, there’s also an extra package for MeeGo device. It’s neither compliant with the Intel AppUp specification nor fully functional (the bubble doesn’t move but it’s hard to say why at this stage). But the package can be installed properly, the icon is available on the desktop, and all the QML is rendered as expected.

So these were the only changes needed to have the working 2D example. I must say that’s much cooler to show to a friend in a pub and to test his/hers ability to level properly after a pint 😉
But also imagine you can now apply this example to the game for steering.