Qt SDK Updates, now with better Qt Component support

September 30, 2011 at 12:03 pm | Posted in Information, Software Development | Leave a comment
Tags:

For those of you in the know, the Qt SDK has just been released on developer.nokia.com. However, as itt might not have grasped your attention, there is also an online update that adds better support for MeeGo 1.2 Harmattan to the SDK.

One very useful thing that has been added is support for the Harmattan Qt Components in the Qt Simulator, so now you can do more without the need to access a device. Here is a screenshot of the template Qt Quick component application running on a Windows 7 environment.

Qt Components running inside the Qt Simulator

Qt Components running inside the Qt Simulator

I have been reliably informed that the Qt Components now also work on the desktop. So what are you waiting for? Start updating your Qt SDK now.

Advertisements

Simple morse player for the N950

September 26, 2011 at 9:56 am | Posted in Software Development, Uncategorized | Leave a comment

Remember the old fashioned movies with spies and sailors going dit-dit-dah to each other. Well now you can relive that nostalgia with the “Morse Code Player (source code available below).

This application was supposed to be a quickie that just does a few simple things, but in the end it turned out to be a headache due to my limited understanding of the threading behaviour of QML and Qt C++. The core of the application consists of two C++ classes the MorsePlayer that converts text to morse, and the ToneEngine that creates a audio tone.

The MorsePlayer class is relatively straightforward QML binding class that has a bit of logic for converting text to morse, and then for call the ToneEngine to play the necessary tone. The ToneEngine class is a bit more complicated; it copies logic from the AudioOutput example for generating a simple tone. The tricky bit (that took several half days to solve) was working out that the audio handling code (ToneGenerator, QAudioOutput) needs to run in its own thread, with its own event handler othwerwise the audio output blocks. Additionally. MorsePlayer needs to send signals to the ToneEnginer otherwise the audio blocks. Another tricky bit is the use of resume and suspend to start/stop the audio output, this is simply because QAudioOutput start/stop takes too long to create the initial buffers etc.

The current code is not perfect, it still occasionally has buffer underflows (any help here would be appreciated). As an application, it needs some extra features like a way to set the morse code rate, and tone frequency. Additionally, it could do with more features like haptic feedback and other clever ideas. I could also clean up the code more (add more comments, play with the design, make it a QML plugin) so I am just releasing it “as-is” as a simple example of tone generation from QML.

A simple wiki page with historical source code.

A direct link to the source tarball.

Enjoy!

Create a free website or blog at WordPress.com.
Entries and comments feeds.