If you want to pause an application to save battery power when the screen is turned off, you can do this by listening for the locked screen event in Qt for Maemo. However, this is not made easily available through a wrapper function (that I know of), so in this case we’ll need to resort to listening for the right DBus call. (Thanks to Diph from Maemo.org for providing the recipe to make this possible.)
First of all, you’ll need to enable dbus in your project (.pro) file:
CONFIG += qdbus
Next up, in your .h file you should add the following to import the DBus headers:
When you are developing with Qt on Maemo you might want to minimize or detect minimization of your application to the dashboard. Qt lacks clean functions for these use cases, but thankfully it’s still very easy to accomplish them.
Minimizing the application
First of all, to minimize your application you’ll need to add the following CONFIG line to your project file (the .pro file):
CONFIG += qdbus
Then, in your .cpp or .h file, you’ll need to include the QtDBus headers:
You may of course skip the #ifdef statements if you’d like DBus for other systems as well, but here I’d like to make this exception only for Maemo. Now, anywhere in your application you may add the following lines to minimize to Maemo’s dashboard:
Update:The package was pushed to Extras testing on 2nd of October. It was delayed because Maemo’s package repository would not import the new package due to some trouble with the version numbering.
There has been missing a native application to access information from Trafikanten on the Nokia N900. Instead it has been necessary to use the mobile version of their websites or maybe even the full version. Even though this is a pretty quick and workable solution, there are several benefits of having a native application available. One that becomes very obvious is the use of GPS to find all nearest bus stops or train stations.
I decided to give it a try in June this year and started by releasing some early versions of what is now named “Journey Planner for Norway” (which is “Reiseplanlegger” in Norwegian). During the summer of 2010 I have been trying to improve the application over several iterations, and feel that it has now come to a point where it is usable and stable enough to get the infamous “Version 1.0” attached to it.
The application is now finding its way through to the Extras-devel catalogue for Maemo and will be pushed upwards through Extras-testing before it hopefully hits Extras within two or three weeks. In the meantime you might either be a bit careless and enable Extras-devel to use the bleeding edge 1.0 version or head over to Maemo Downloads to fetch the beta which will be automatically updated to 1.0 whenever it is ready.
Below you can check out some more screenshots of the application in action:
The application is developed in C++ using Qt with the Qt Mobility libraries. It should not be too hard to port it to Symbian as well, so I will give that a shot in the future. Symbian users does however already have an option to use the Java application “Trafikanten Sanntid” made by Håvard Tegelsrud.
I just figured that Qt Creator is now packaging every Maemo application whenever you tell it to run one. This might be annoying if packaging fails and will in any case slow down the whole process of debugging. However, if you want to skip the packaging step, this is not an option in Qt Creator 2.0(!).
Luckily the Qt developers over at Nokia are aware of this and have released a fix in the latest builds of Qt Creator. To acquire these, go to Qt’s snapshot homepage or just download the 32-bit or 64-bit versions for Linux directly from the build made on 12th of July.
Now you may select to skip the packaging by editing the build steps in Qt Creator.
Be aware that the snapshot versions are in development and may have bugs causing irrevocable data loss. That’s the risk you’ve got to take these days to avoid those bloated packages.
If you are developing for Nokia N900 using the Nokia Qt SDK, you are most likely following this guide to set up your environment. This is all nice and easy, but if you are connecting using usb you have to open a terminal each time you plug in your N900 and write
ifconfig usb0 192.168.2.14 up
If you, like me, get tired of doing this you may instead let Network Manager in Gnome do the work for you. First of all, connect your N900 via an available USB port. Next, right click the Network Manager icon and hit “Edit Connections…”.