Thursday Night

Paul Betts’s personal website / blog / what-have-you

Porting apps to KDE4 – part 1

After reading all the awesome things about the new cool things in QT4, especially the graphics stuff, I decided to check it out. And what better way to learn a new technology than to contribute something to the community! So after Emailing the original author and making sure he wasn’t working on it himself, I started to work to port Filelight, a handy utility that lets you view your disk usage visually in a way that’s very easy to get useful information out of. The other thing that is exciting about KDE4 is apps “by default” work with Windows too, so in the near future we’ll see a flood of awesome new open source programs for Windows.

The first thing you should do when porting a KDE app is get your environment set up. I did this by going to the building from SVN guide and following the instructions. Some notes:

  • The guide says to create a separate user, but I think that’s overkill and somewhat annoying. What I did instead was create a script called kde_dev.sh that has the entries that they put into your .bashrc
  • Ubuntu Edgy (and most other distros) have a version of D-Bus that’s up to date enough, don’t bother compiling your own (it’ll give you massive headaches trying to get it to cooperate with your system’s D-Bus anyways)
  • Originally, I tried to use the Ubuntu KDE4 stuff that’s in Synaptic but unfortunately something’s glitched with building projects, cmake will always give you weird errors

Next, since Filelight uses Autotools, I could use the handy am2cmake script to create all of the CMakeFiles.txt entries automagically. It’s kind of cheating, but on the other hand, why should I have to look up a bunch of obscure commands unless I have to? I think I can get the Zeitgeist of cmake by reading the generated files. I also had to create a dummy ConfigureChecks.cmake which I’ll have to redo manually using the configure.ac file

After that, I read the Qt 4 Porting Guide and proceeded to cheat even more and use the qt3to4 utility to convert most of the code to Qt 4. However, after I get it to build correctly I’m going to go back and do a proper port, removing all of the old Qt3′isms.

References:

Written by Paul Betts

December 6th, 2006 at 10:47 am

Posted in QT/KDE