Posts Tagged ‘KDE’

CMake Library Tutorial

16th August 2015

Interested in writing or maintaining a KDE Framework? Getting the build system right for a Framework, or indeed any other library, is not trivial. I’ve just finished writing a tutorial to help you do just that, though. It can be found at the CMake tutorials page on TechBase, and guides you through (an idealised version of) the KArchive buildsystem.

Comments, feedback and questions on the tutorial are welcome – here, by email or on the discussion page of the tutorial.

Akademy 2015

30th July 2015

I’m just finishing up a week spend at Akademy, the annual conference of the KDE community.

AGM lunch break

We started last Friday with the AGM of the KDE e.V., the legal entity that deals with the financial and other legal aspects of KDE.

Working 1

After that, we had two days of talks, and then from Monday onwards we’ve had “birds of a feather”, or “BoF”, sessions where people working on or interested in similar things get together to discuss things face-to-face.

I have visions, should I go see a doctor?

It’s been great fun, and I’ve really enjoyed seeing people I’ve met before again and meeting people I’ve only known through IRC and blog posts or have never even come across.

Question time

The organising team have done a fantastic job: we’ve had free busses running from our accommodation to the venue, video recording of talks (which I’m sure someone will post about soon), easy to access food, two parties and people always on-hand to provide information.

Smart Tech and Sensible Tech

There have been announcements of new technologies, talks about community things like how to write a vision statement or what artists are doing with Krita, technical talks about things like how to optimise your program, talks about development methodologies and more.

Akademy Award winners

Personally, I’ve taken the opportunity to start improving our CMake documentation, including writing and planning new tutorials. I’ve also been working on some Extra CMake Modules things at the request of David Faure, looking at accessibility things with Frederik Gladhorn and trying out the upcoming release of Plasma.

Photographer

I’ve had great fun taking lots of photographs this Akademy, and have been uploading them all to Flickr.

Wall sitting

I’m not the only one, either – you can find other photo sets linked from the Akademy wiki.

Find a rock, climb it

I’m about to catch a flight home, but I very much hope I can make next year’s Akademy as well.

View from the Torre de Hércules

Buildsystem BoF at Akademy

8th July 2015

I’ve just booked a room for Tuesday afternoon at Akademy for a couple of CMake / extra-cmake-modules BoF sessions.

The first part is for people who want support hacking the buildsystem of their own projects. Not sure of the best way to migrate to extra-cmake-modules as part of your shift to KF5? Getting “deprecated” or other CMake warnings you want to resolve? Can you think of something really useful the buildsystem could do in your project, but you don’t know how to do it? Come along, and I (and hopefully others) will be there to give you a hand. Likewise, if you feel comfortable writing stuff in CMake, and you want to help other developers, come along to lend a hand – you don’t need to be an expert!

The second part is for people who want to contribute to extra-cmake-modules. If you have some CMake code in your project you think other projects will find useful, or you have ideas for improvements in the existing modules, come along and pitch in.

Help wanted: Photoshop

1st March 2015

As part of KDE Frameworks, we have a collection of QImage plugins that allow Qt applications to read various types of image files not natively supported by Qt. I’ve recently overhauled the one that reads Photoshop images (PSD files) but, without access to Photoshop, I have no way to create images that test the code. The one test image I have, I created using the Gimp, which is less than ideal when I want to test compatibility with Photoshop itself.

So, if you have access to Photoshop (Photoshop Elements might be sufficient, I’m not sure) and would be willing to make some test images (in pairs – one PSD, one PNG) of various specific configurations and in various save formats, please do get in touch (alex dot merry at kde dot org, alexmerry on IRC, or just post a comment here).

To the extent that the simple images I require would be copyrightable, you would need to be willing to license them under the LGPLv2+ or a permissive license (CC-BY-SA would be fine, for example).

New installation variables

13th January 2015

I noticed a while ago that the CMake installation variable names used by KDE projects (defined either in kdelibs or KDEInstallDirs in extra-cmake-modules) are inconsistent with what GNUInstallDirs, for example, uses. The traditional variable names are things like BIN_INSTALL_DIR and CMAKECONFIG_INSTALL_PREFIX, while GNUInstallDirs defines things like CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_DOCDIR.

In an effort to make the installation variables more consistent and compatible with GNUInstallDirs (for the ease of packagers and developers alike), I introduced GNUInstallDirs-style variables to KDEInstallDirs – this included the variables defined by GNUInstallDirs and other ones beginning CMAKE_INSTALL_. These were kept in sync with the old-style variable names.

Both of these styles of variables have namespacing problems: the ones starting CMAKE_ tread on CMake’s namespace (so CMake could potentially define one of those variables that doesn’t appear in GNUInstallDirs to have a different meaning), and the old-style variables are very generic and could conflict with another CMake module. Neither of these are likely to be an issue in reality, but it is good practice to respect namespaces in third-party modules.

KDEInstallDirs now primarily defines variables starting with KDE_INSTALL_ (which corresponds with the module name). The old-style names and all the CMAKE_INSTALL_ names that do not also exist in GNUInstallDirs are deprecated, and can be disabled entirely (see the documentation). It is possible to disable the variables that appear in GNUInstallDirs as well.

This appeared in extra-cmake-modules 1.6.0, but that version had some flaws (for example, it would break if you used both GNUInstallDirs and KDEInstallDirs in the same project, which was a major oversight), so you should use 1.6.1 instead.

There is a script in the kf5 directory of the kde-dev-scripts.git repository to port your CMakeLists.txt files to the new variables: cmakelists_install_vars.pl. Just run it in a directory with a CMakeLists.txt file.

return EBUSY;

8th September 2014

I just want to apologise to those of you who are waiting on me for Review Requests, etc. Last month was quite busy for me, and this month is even more so – all good things, such as friends getting married, but all time-consuming. On top of that, Akonadi and the server I use for KDE-related email have decided they aren’t talking to one another, which makes it that bit harder to deal with (due to having to log into, and then deal with the interface of, webmail).

I’m expecting life to calm down considerably in October, so hopefully normal server should resume then.

Qt5 Pretty Printers for GDB

4th June 2014

If you’ve ever debugged a Qt program in GDB and been frustrated when attempting to print a QString gives you an unhelpful result like

$1 = {d = 0x6e7c40}

then kde-dev-scripts has some useful tools for you. For some time now, there has been the kde-devel-gdb script, which you can include in your ~/.gdbinit. This gives you commands like “printq4string” and “printq5string” which will dump the actual string contents of a QString.

However, GDB 7 has the ability to add pretty-printers written in Python. This means that you can control how a value is output when you use “print” and when backtraces are printed. So “print someQString” will actually write out the string for you.

The gdb directory of kde-dev-scripts now has some of these pretty-printers for Qt5. Currently, it covers most of the main value classes and collection classes in QtCore (QByteArray, QString, QStringList, QList, QMap, etc). QHash and QSet are the most notable ones that are missing.

To use these pretty-printers, you either need to source the “load-qt5printers.py” file in your GDB session, or use the “create-qt5-autoloaders.py” script to generate files that will allow GDB to auto-load the printers when it loads the Qt5 libraries.

I plan to eventually submit these to Qt, so that pretty-printing of Qt value classes will work out of the box. For now, do let me know if you run into any issues with them (don’t forget to compile your application with debugging symbols!), and feel free to extend what’s there, or use it as a template for some Qt4 pretty-printers.

CMake Conditionals

16th May 2014

[edited 17/04/14]

CMake has many wonderful features. However, CMake’s if() command handles variables in a way that can often trip people up. In particular, comparison operators like STREQUAL try to interpret their arguments as variable names, and only treat them as actual strings if there is no matching variable. Combined with the fact that basically any string you can write in a CMake file is a valid variable name, this can lead to some subtle bugs.

This script highlights all the potential pitfalls I could think of. The “FATAL_ERROR” branches are the ones that will not be taken, but many of them are ones you might expect to be taken if you either didn’t have a solid grasp of how if() parses its arguments or if you weren’t aware of what variables had been defined.

(more…)

KF5 Sprint in Barcelona

6th May 2014

Two weeks ago, I landed back in my home country after spending a long weekend in Barcelona for the KDE Frameworks 5 sprint. It was a tiring weekend, but fun and productive.

I arrived in the early evening of the first day, happening to reach the door of the Blue Systems office at about the same time as Kai Uwe Broulik. This was after the discussion about what tasks needed completing had happened, so we both were greeted with a board full of post-it notes. I snuck a few more onto the board when Kévin Ottens wasn’t looking, as there were some failing autotests that needed fixing before another release happened, and I felt we needed to have a proper discussion about where we were installing things (having seen that Kubuntu were patching the KDEInstallDirs module of Extra CMake Modules).

That first evening, I mostly committed some changes that I’d been waiting for approval on, and either finished or delegated the last few parts of the “removing references to KDE4” task that I’d been working on. We went out for a very nice dinner, and sometime after midnight, Kai, Mark Gaiser and I headed to the apartment we were sharing to sleep.

The next day, Kai set off early to see his old school choir, who happened to be on tour to Barcelona, and beat Mark and I to the office (we rocked up around 11am, having been breakfast-shopping before going back to the apartment to eat). I pinned people down for approval on several things I’d had sitting on my hard drive or on Review Board for a while, clearing out my backlog of “completed but not yet committed” tasks. This included a lot of improvements and clean-ups for Extra CMake Modules.

Most of Friday afternoon and evening, however, was spent trying to understand the KItemModels unit tests and figure out why one of the tests was failing. I eventually determined that the pattern of signal emission when moving rows around had probably changed between Qt4 and Qt5, and the fix was fairly simple. I also found time to apply at least a temporary fix to a KImageFormats unit test that was failing on i386, and take part in discussions on install paths (with David Faure and Aleix Pol) and the Framework metadata files (with Kévin, Aurélien Gâteau, and Aleix). I didn’t have the energy to join in the release cycle discussion, although I subsequently decided that Extra CMake Modules would tend to release in sync with Frameworks (largely because David Faure has kindly agreed to deal with the ECM release process if it does), but won’t necessarily have a new release for every Frameworks release.

The install paths discussion resulted in the decision that “kf5” (or, indeed, “kde5”) shouldn’t appear in paths that we expect applications to use (such as where applications install plugins for their own use) – application versions are not necessarily related in any way to KDE Frameworks versions. As a result, we altered a bunch of paths in KDEInstallDirs, and added some KF5-specific variables for the use of the frameworks themselves, as well as making sure some other framework-releated directories were properly versioned. Aleix and I worked through the resulting tasks throughout Saturday. One nice outcome of these changes was that we moved a step closer to deprecating KPluginLoader: it is no longer needed to find plugins installed using the variables in KDEInstallDirs, and other than that it mostly provides plugin versioning (as in a version number for the plugin or plugin interface), which could be upstreamed to QPluginLoader.

In the metadata file discussion, we decided to rename the metadata files from <framework>.yaml (eg: kconfig.yaml) to the more consistent metadata.yaml (which is easier for scripts to find). We also decided that these files would be the canonical location for information such as the maintainer, tier (an indication of a framework’s dependencies) and lifecycle (yet-to-be-released, actively developed, deprecated, no-longer-released), and so set out a list of fields they needed to contain. Kévin and Aurélien did most of the work of implementing these changes, I believe.

As well as dealing with install paths and other coinstallability issues, I spent part of Saturday adding a section to the KDE git manual called Advanced Git. This details how to merge history between repositories, including use of git-filter-branch. I’ve ended up doing a lot of these merges for KDE Frameworks as we’ve realised files have ended up in the wrong repository, and had to pick it up as I went along, learning from my mistakes. Hopefully this will make it easier for other people.

Having been noticably short of sleep on Saturday (getting into the office late doesn’t mean waking up late, and I’d only left the office at 2am on Friday night), I got an early night in, so I would be refreshed for Sunday, which mostly involved similar tasks to Saturday. We got all the coinstallability tasks done by early Sunday afternoon, and I spent the rest of the day working on the failing unit tests for the SoftImage PIC format plugin in KImageFormats. In the end, I completely rewrote the plugin using QDataStream, ensuring it would handle endianness correctly (which the old code emphatically did not), and that wasn’t finished until last Friday.

All in all, it was a successful sprint, and it was great to meet the people I’d been working with over the last several months. Bring on KDE Frameworks 5.0!

MPRIS2 and the Music Player Daemon

17th May 2012

If you tend to want to keep your music running when you log out, or control your music playing on a desktop machine from a laptop, for example, you may well use the Music Player Daemon (MPD).  If you use Ubuntu’s Unity desktop or KDE’s Plasma desktop, you may well wonder how to get the Ubuntu sound menu or Plasma’s Now Playing widget to talk to it.

Both of these use MPRIS2 to communicate with media players.  MPD, however, does not have an MPRIS2 interface.  Even if it did, it would take a bit of work to be able to use it from another computer.  What you need, then, is a “bridge” of some sort to translate.  One such possibility is mpDris2 (which, I hasten to point out, I haven’t tested).

You would run such a bridge on the computer you want to control MPD from, and point it to your MPD instance.  And voilà!  Every MPRIS2 client application that you run can talk to MPD, without knowing anything about the MPD protocol.

If you just want a headless music player on your local machine, though, you can always use Raven, which talks MPRIS2 natively.


Follow

Get every new post delivered to your Inbox.