KDevelop - Easy Collaboration for KDE

I use at least two IDEs on a regular basis: plain-old Emacs (which can actually be configured to match any of the fancier ones) and the all mighty Eclipse, yet during my years coding I've used many more. When I started trying IDEs I was mainly looking for something that could quickly set me up and running with my project (mainly C++ projects I was doing at that time, as far as I can recall) and I tried KDevelop during that time (2007). It was good but I kept thinking it was best suited for stuff I wasn't concerned about: it mainly focused on integrating C++ and KDE so that you could do a KDE application in minutes. I eventually moved to Eclipse mainly because the list of features I was requiring had grown to include, among other things, the need of a single IDE for any language I wanted to code and source control integration.

I did learn about Qt while using KDevelop the first time, though, but years later when I needed to code Qt projects, QtCreator came along and I was very happy coding Qt there since it had documentation and internationalization tools integrated, plus it quickly started supporting source control.

But recently I started looking around stuff I wanted to implement, fix or modify in KDE. I surfed the web until I got the sources, fetched those and used Emacs to inspect code that could be causing the issues I was investigating. That worked out well for some cases where the code I was inspecting was very localized and didn't span across folders, but that's not the case with most of KDE's code, so I knew I had to use something better than that, something that could quickly get me up and running on KDE this time. So I thought I'd check around KDevelop to see how was it standing today after almost 2 years without using it.

I was very well impressed, I must say. I won't go into a feature-by-feature analysis comparing it to Eclipse, for example since the fact that I want to remark with this post is that KDevelop does an outstanding job on helping you collaborate with KDE in a couple of steps and that, I think, is one of the most important facts a FLOSS community should care about in order to be successful and sustainable.

So that's enough for preambles: I'll be showing some features I liked about KDevelop that should help you code cool stuff for KDE in a couple of minutes. I'll be focusing on Plasma development here but these things should apply to almost any KDE-related stuff you want to do.

I first thought I'd do a post about coding the Getting Started Plasma Tutorial in KDevelop, but it turns out that KDevelop already includes a 3 steps Plasma sample project so you basically don't need to go through any of the steps in the tutorial except, perhaps, for the last couple of them. That's absolutely great, that's something every project should care to do: having a simple and quick sample project to try out in a couple of minutes.

So then I changed my mind and I'll be posting about kdeplasma-addons modifications from KDevelop. The first step would be checking out the sources from KDE's trunk

svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeplasma-addons/

If you are new to KDE you would probably be trying to find a project file to open from KDevelop, but KDE is all about CMake and everything starts at the CMakeLists.txt file. KDevelop will pick up your CMakeLists.txt file directly, load all the targets mentioned in that file and load the files related to the project. If you have ever worked with CMake before, you will understand this is an enormous simplification of the setup process compared to running cmake on the console.

Furthermore, the cryptic commands to enable debugging on the CMake build will already be set up and you can also specify an installation prefix for your project which will be very helpful for testing purposes if /usr/local/lib is not in your default KDE paths. After setting the build folder of your project in the configuration window shown above, you'll have your environment ready for developing. The Project menu at the top of the window has the Configure Selection and the Build Current Selection (F8) menu items which you will use to compile the set up and compile the code.

Then you have the Install Selection option in the main menu too, but generally you want to install to a protected location like /usr or /usr/local and you are developing from a regular account. KDevelop already thought about that: you can right click on the project you are working on, then click Open Configuration on the context menu and you will be able to edit both CMake and Make settings. One of the Make settings is a checkbox where you can choose whether to install as root or not. After setting all of these options,  you're good to go in your developing cycle.

But then you'd need to test the plasmoid you are developing and for that KDevelop let's you specify the Run command by going to the Run menu and then to the Configure Launches menu. You will need to use the plus button to add a launch configuration for the project you are working on. There you will want to set the executable to plasmoidviewer, and adding the name of the plasmoid as an argument to the command you are working on in order to have it displayed with the viewer. You will also need to specify the location of your GDB executable in the Debug section.

And that's about it! You are ready to develop like a Pro for the KDE Project. Be sure to join the development lists of the projects you are interested in and see if you can collaborate with patches and feature implementations. I already got bored of writing posts so I'll be back to my code project. Goodbye!