Comments, Code and Qt. Some words about the wonderful world of software engineering

23Jan/121

Sunday evening fun: Windows Phone 7 styled progress indicator in QML

Posted by kypeli

I started a new coding hobby project today. But instead of actually getting very far with the productive part of the project I got side tracked on something fun I wanted to try out (don't you just love when that happens :) That's not possible when coding at work...). I wanted to share this day's outcome with you.

Let me introduce this humble video show casing a Windows Phone 7 styled loading indicator in QML :)

You can get the source code for this small thing (GPL licensed) from here: https://gitorious.org/qtquicktests/qtquicktests/trees/master/wp7-loading.

Technorati Tags: , , ,

12Dec/117

Porting MeeGo Qt Components apps to Symbian

Posted by kypeli

Of course I don't have all the answers to what needs to be done for any given MeeGo Qt Component based application to have it running on Symbian, but I think I have three general actions that need to be done when porting an app from MeeGo to Symbian; have it run with the resources, make the code compile and tweak the UI.

Thanks to Symbian Annan both MeeGo and Symbian run Qt 4.7.4 with Qt Quick and Qt Components which is of course the reason why this kind of porting is even possible with a reasonable effort. As I wrote in my earlier blog post, even though both Symbian and MeeGo run Qt and Qt Components, it's not perfect. I think too much manual work still has to be done, but it's a reasonable effort and when you read through my hints, I think the tasks ahead become clearer.

Technorati Tags: , , , , ,

6Dec/117

A MeeGo developer’s endeavors to the Symbian Qt world

Posted by kypeli

I've been working with Qt for a while already and we all know what a great cross-platform framework it is. When Nokia bought Trolltech in 2008 it was clear that Nokia wanted to make Symbian development easier. However, the QWidget based toolkit would not fly on Symbian, or any other mobile platform for that matter, so Nokia built some mobile UI frameworks on Qt (and oh boy Nokia is good at building frameworks for everything. Everyone should have at least one framework, if not two. I could write another blog post about that...). But while people in Europe were fighting over their frameworks, it was not until the guys and gals in Brisbane came up with QML when everything changed. Qt could finally be cross platform again and in an elegant way!

Symbian just isn't my cup of tea. But that doesn't prevent me from wanting to write something for Symbian if for nothing else other than being able to say I've done it. But just thinking of Symbian C++ or Avkon makes me feel sick. This has changed thanks to QML and especially Qt Components. Also Nokia has finally been able to put out a single SDK that I can just install, write Qt with, deploy the same code on any Qt-based Nokia mobile, publish in the Nokia Store and... Profit! Right? Well, my opportunity to find out came now thanks to my podcast application, Podcatcher for N9, that I've written for the Nokia N9 smartphone. It's has a MeeGo Harmattan Qt Components based UI with a Qt C++ middleware. These are my comments as a former MeeGo developer on the journey to the Qt world of Symbian.

Technorati Tags: , , , ,

18Sep/115

Easy threading with QtConcurrent::run()

Posted by kypeli

The following scenario is probably familiar to you: you are doing some heavy computing or IO intensive things in your app, like accessing a database, the filesystem or reading data from the Internet, that blocks your UI thread which leads to that the UI freezes. If you are writing a Qt app then probably the first thing that comes to your mind is to subclass QThread and implement the run() method (although you should not do that). But before you do that, you should take a look at Qt Concurrent and what it can offer. There is a good chance that what you need is already provided by the Qt Concurrent framework.

How I added threads to my app in 20 minutes

In this post I want to show you how I added threaded database access to my small podcast application for MeeGo, Podcatcher for N9. The use case I had at hands was that I added automatic cleanup of podcast episodes to Podcatcher for N9, which required some heavy database and filesystem access. This is the (naive) code (in short) that I originally had when cleaning up podcast episodes:

QList channels = m_channelsModel->channels();

foreach(PodcastChannel *channel, channels) {
PodcastEpisodesModel *episodesModel = m_episodeModelFactory->episodesModel(channel->channelDbId());
episodesModel->cleanOldEpisodes(m_keepNumEpisodesSettings, m_autoDelUnplayedSettings);
}

Technorati Tags: , , , ,

30Jul/1119

Why QNetworkAccessManager should not have the finished(QNetworkReply *) signal

Posted by kypeli

I was recently writing some network code in Qt using QNetworkAccessManager and again I did the mistake I've already done a few times. The reason for my mistake was that QNetworkAccessManager provides the finished(QNetworkReply *) signal.

There are essentially two ways to request some data from the net using QNetworkAccessManager. In the first approach you have the QNetworkAccessManager as an instance variable in your class and you connect the finished(QNetworkReply *) signal from the instance variable to your slot. This is a tempting solution as it provides a quick and easy solution to fetch some data from the net.

Technorati Tags: , , ,