Tales of software craftsmanship

Tales of software craftsmanship

Social Desktop integration in KAboutDialog


A few years ago when I still wasn’t an Amarok developer, the development team appeared to me like a bunch of uber-l33t geeks with mad sk1lls locked up in some ivory tower, performing their arcane incantations. Obviously it’s not the developers’ fault, the issue was that no matter how hard you try to reach out to the wider community, there is always a not so blurred line between users and developers, and this social distinction raised the barrier to entry for me probably even more than my lack of coding skills did.

I’m trying to change this, by bringing the Social Desktop to one of the most prominent places where users learn about the development team of a program: the About dialog. By tying some openDesktop.org profile data into a modified KAboutBox, it’s much easier to convey the message that the project is developed by real people, with a new potential channel of user-developer interaction right inside the app. For users, the advantage is that developers are now easier to reach, and I also hope that this might increase the quality of the communication by making some potential trolls realize that they are not talking to nameless nicks on IRC. For contributors, this might also be a nice recognition of their accomplishments: many of us do this unpaid, for fun and for love, and it’s nice if at the end of the day one can at least get a pretty dialog with a picture and a few rows of credit.

But what does “integrating Social Desktop features” really mean? Well, it can mean everything and nothing, in this case it means a new dialog called ExtendedAboutDialog for lack of a better name. Contributors have additional extended entries with data downloaded from openDesktop.org that can be viewed if the user has internet access and an openDesktop.org account. The About dialog becomes a small social desktop client.

The implementation is currently based on Amarok, but I’m keeping it as generic as possible. It uses the OpenCollaboration Services API, through the Attica library. Attica is a library, not yet independent, as I understand originally developed for the OCS dataengine and currently in kdeplasma-addons. Though the dataengine with Attica is already in 4.3, the Attica library may land into KDE 4.4. Until then, I have crudely copied over libAttica into Amarok’s source tree.

This dialog is already integrated in Amarok’s master branch on Gitorious, and my work on this about dialog can be tracked on my Gitorious page http://gitorious.org/~teo.

What follows is a screenshot of the dialog on startup. We can’t try to download data right away because the user has to sign into openDesktop first. So we just show the old style credits, with a button on top.


When the user clicks on “Connect to openDesktop…”, a login dialog appears and the data is fetched from openDesktop.org. Meanwhile, authors who don’t wish to use openDesktop.org are already added to the list.


Finally, when the data has been downloaded, the list is completely populated.


This works for contributors without author status too, with the profiles being shown in a thinner format to save space.

Social Desktop integration in KAboutDialog

This dialog is still a moving target, and I’m posting quite regular updates and screenshots on its openDesktop.org entry.

GSoC final report: Amarok’s playlist, hacked into submission

When I started working on my proposal for what would eventually become my Google Summer of Code 2009 project, I was a much less skilled coder with no experience on something as large as this project turned out to be. I’m not bragging about becoming so insanely wiser now, but I have certainly gained tons of valuable experience, learned a lot about software development, and had a great time doing it!

So what exactly have I accomplished this summer?

Those who have been following my updates might remember the first part.

Well, the initial idea was to implement multilevel sorting in Amarok’s playlist, with a nice GUI, and throw in configurable grouping if there’s time. However right from the start it was clear that much more invasive changes were needed. As I already mentioned, Amarok’s playlist uses Qt’s Model/View design pattern. When I began working on my project the playlist had a source model (a class which feeds the rows), a filter proxy model (which filters out some rows that don’t need to be shown when a filter is active), a grouping proxy model (which decides which tracks should be grouped together because they belong to the same album) and finally, the view. Ideally, each model should talk only to the model right below it (if any), and the view should only talk to the “topmost” model to avoid any screw-ups in row presence and order. Failure to enforce this results in spaghetti code, which is exactly what was going on in the playlist code at the time.

So most of my first GSoC month I spent despaghettifying these Model/View classes, so that the Playlist::Model feeds data only to the FilterProxy, which feeds data only to the GroupingProxy, which feeds data only to the view. During this despaghettification, I also added a new proxy model: SortProxy, which is the class that actually implements the multilevel sorting backend. A month or so later I also added another proxy, SearchProxy, by decoupling searching from filtering. So the final result, as I already mentioned, is Playlist::Model->Filter->Sort->Search->Grouping->View: 5 models and one view. Doing all this without Qt’s Model/View classes would have been *a lot* harder and much more chaotic. So by the end of the second month the playlist code was refactored and made much clearer, the right auxiliary classes had been associated with the right model or proxy (mostly the topmost one, GroupingProxy) and a simple testing GUI was in place for multilevel sorting.

For the GUI, I chose to adapt a familiar paradigm to a new use case, so I used a breadcrumb path based widget. A sort scheme is a progression of levels, which represent sorting criteria, and those are applied to the playlist in real time. What’s even better, sorting is not an action but a state, which means that the original sort order can be recalled at any time. One of the sorting levels is also “Random”, so almost for free this interface also implements configurable multilevel shuffle!

Multilevel playlist sorting interface

In the last weeks, which were quite busy, I implemented configurable grouping, so the user is no longer forced just to group by album or not group at all. Finally, as a bonus, I took advantage of the existing Amarok URL infrastructure to implement playlist view bookmarks. These bookmarks define a URL for each playlist configuration, which aggregates a sorting scheme, a grouping category, a playlist layout and a filtering expression, and store it in the bookmark manager. The user can then instantly apply these bookmarked states and avoid having to rebuild a sorting scheme, a grouping category, select a layout and enter a filter string manually.

Playlist view bookmarks!

Playlist view bookmarks make it much easier to control this mighty playlist, which will be landing on a GNU/Linux distribution near you with Amarok 2.2 some time this fall!

I’d like to take this chance to thank my GSoC mentor Nikolaj Hald Nielsen and the whole Amarok team for their patience, dedication and help.

GSoC update – The playlist sorting breadcrumb

The last time I wrote about multilevel playlist sorting in Amarok a few weeks ago, the backend work was mostly completed but the (temporary) GUI was fugly, just a bunch of comboboxes.

Not any more.

For Amarok 2.2, among other things, we are working on improving the consistency of the user experience by adding horizontal symmetry, so both the browsers pane (default left) and the playlist (default right) will look and feel similar. Those two areas already had very similar filter bars, and since a few days ago they also both have breadcrumbs.

Until recently, breadcrumb bars have been used almost exclusively in file managers, but there’s no reason why they couldn’t be used to express any sort of sequence of objects in a hierarchy. In Amarok 2.2, we are introducing this common and well understood GUI metaphor and using it to express new and complex operations. More than a month ago, Amarok developer Nikolaj Hald Nielsen implemented the breadcrumb concept in the browsers pane, where it’s used to easily navigate through the ever increasing list of Amarok’s music sources. We like to say that with Amarok 2 the world is your playlist, and the browsers breadcrumb bar is an ingenious way to bring the world’s music to the user’s playlist through our Internet services framework.

A few days ago I pushed to Amarok’s git repository a first version of a new breadcrumb interface, this one is used in the playlist. Every item in the breadcrumb represents a sorting level, or category. It doesn’t implement any kind of navigation (like usual breadcrumb bars), but so far we have found that it works remarkably well for expressing sorting schemes, which are nothing more than selections of nested objects of some kind. To express “sort by artist, and if the tracks have the same artist then by album, and if the tracks belong to the same album then by track number”, the user just has to “navigate” to “Artist > Album > Track number” in the breadcrumb bar, and the playlist view changes accordingly in real time. But what’s even better, and unlike usual “spreadsheet” sorting interfaces, this sorting method is technically a state and not an action, which means that the original track order is preserved and can easily be restored by clearing the contents of the breadcrumb bar.

The new Amarok playlist sorting interface

A few features are still missing before I can call this GSoC project “done” and I’m currently working on them, mostly sort order inversion and sort scheme bookmarking.