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

18Sep/112

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<podcastchannel *> channels = m_channelsModel->channels();

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

Technorati Tags: , , , ,

17Aug/115

Updates regarding Podcatcher for N9

Posted by kypeli

Podcatcher for N9 has been submitted to Nokia Store for approval! QA process is still pending. Let's hope it's soon available for download on your MeeGo Harmattan device! In the meantime, enjoy the latest screenshots from Podcatcher for N9. Many thanks to Nikui for help with the layout and UX! :)

 

There's also a nice video preview of a beta version of Podcatcher on the MeeGo Experts site!

And if you have any feature requests regarding Podcatcher for N9, just add them here as comments or email (you'll find the address on the About page). I definitely have some improvements that I want to add to future versions of Podcatcher - the development will go on!

Technorati Tags: , , , ,

11Aug/1126

Introducing Podcatcher for Nokia N9

Posted by kypeli

Your intelligent podcast client.

Get it now!

Podcatcher for N9 is available from Nokia Store now! There is a free, lite, version that is limited to three subscriptions only. If you like Podcatcher for N9, I hope you will purchase the full version that has unlimited subscriptions. Links to Nokia Store are below.

Source code for Podcatcher for N9 is available online too at http://projects.developer.nokia.com/hpodcatcher.

So what is it...?

Podcatcher for Nokia N9 is a new podcast client that I have been working on for the past couple of weeks. Because I am an active podcast listener, I found the lack of a podcast client somewhat of a loss when I received my Nokia N950 developer device. There are great podcast client out there that will definitely hit the Nokia N9 via Nokia Store sooner or later, but I wanted to create a client that would fit my podcast subscription and listening needs and that would run great on the Nokia N9. I took some inspiration from previous podcast clients that I've used on Android handsets and I now want to present the results.

Finally, I wanted to make the performance of my podcast client as good as possible. The backend of Podcatcher for Nokia N9 is written in C++. The UI utilizes native widget thanks to Qt Components and Qt Quick, while the data is cached into a local SQLite database. This all ads up to some great performance.

Please have a look at the screenshots and the video below. I hope you like them!

Technorati Tags: , , , , , ,

30Jul/1113

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: , , ,

5Jul/115

Sneak peek: Integrate your application with the Nokia N9 events view.

Posted by kypeli

I am working on a Qt C++ library that will integrate your application with the Nokia N9 MeeGo Harmattan event feed page. You can add and update items with your icon, text or even a list of images that will be shown on the event feed page. I still want to add some features and polish the code before publishing it, but the library will be open source.

So here's a video demonstrating what the library already can do. Stay tuned!

Update: The library has been published. More information here.

Technorati Tags: , , , , ,