Drupal Development made easier with Qt Assistant - Part 1
If you've followed my blog for even the smallest bit, you'll know I have KDE 4 as my desktop environment. I've also done quite some development (mostly messing around so far, just tContact is published) for Drupal. One of the main tools to help me during development is the Qt Assistant, which comes with Qt 4 and later. It's a fast documentation viewer, with a great index making it easy to look up all those little details about each function that's available in Qt4... or Drupal. Let me show you how I've set things up...
Oh, and if you're not that into all this techy stuff: feel free to stop reading, of course.
Some quick notes
First of all: this guide is focused on getting the Drupal API in the Qt Assistant, but it should work for pretty much any C++/PHP/Java/Python project etc. which Doxygen can handle. See the Doxygen website for details on how to document your code et cetera. Unfortunately I have not been able to get the PHP documentation itself integrated in Qt Assistant yet.
I will also be using some scripts to be run from a terminal or shell. This should not be much of a problem for you Linux or Mac users, for Windows it might be necessary to get CygWin. Unfortunately I haven't tried all of this from Windows, so if someone can jump in and post useful/necessary tips for Windows users in the comments, that would be helpful.
Preparing your system
Well, you're still here. First thing to do is to install Qt4. You get it from QtSoftware.com for pretty much any platform. Get the LGPL/Free version of the Framework or SDK. Note that on Linux it'll very likely come with the repositories of your distribution, you may just need to install the -dev or -devel packages.
Next, get a copy of Drupal from Drupal.org and extract it somewhere on your hard drive. You can of course use your existing Drupal installation full with all the modules you like, or just whichever product you want to use in combination with the Assistant (as long as you have access to the source code). You can do this several times for any version of Drupal, so you can even get separate access to your Drupal 5, 6 and 7 documentation. The choice is yours. No need to actually install it, just make sure the source is available.
For Drupal you'll also want to pull the Developer documentation from CVS. These contain some special help pages like the FAPI Reference and more, as well as documentation about all the hooks (hook_* functions). I won't repeat the exact instructions on how to get the documentation. Just follow the instructions at drupal.org.
Finally, get Doxygen (www.stack.nl/~dimitri/doxygen/). For Linux users: this is probably also in your distribution's repositories. This is the tool that will extract the documentation from your source code, and place it in useful HTML files - and finally in Qt Assistant too.
Qt Assistant - A Quick Look
Now that we have the necessary software installed, you could just take a quick peek at what Qt Assistant does for Qt. You should find it in your launcher/start menu/wherever (Mac: /Developer/Applications/Qt), or just by running "assistant" from the terminal. Go ahead and try it, you should see something similar to this:
Now let's look up the documentation of a function we know (part of) the name of: aboutQt(). Hit the Index tab on the left, enter about and you'll see a list of matching declarations (as well as some more generic topics). Double click aboutQt and Qt Assistant will prompt you to choose in which topic you want to look, QApplication or QMessageBox. I've opted for QApplication in the screenshot below, some actual documentation!
Finally one feature I don't use as often, but which is lightning fast: the Search. You'll find this tab on the right, just above the documentation. Searching for "about" will give you something like below, very useful if you only know the general topic of something you need:
Play around a bit and if you're daring: see if you can already get your Drupal documentation in there. That's what's coming up in the next part - the entire Drupal (and contributed) API, without even mixing it up with the Qt documentation.
Other posts in this series: