Hello again. In my introductory post I declared that I would post regular status updates about my Summer of Code work on Amarok’s playlist – and of course I’m already slacking off.
I started researching and coding towards the end of april so I have almost a month of work to report now. Unfortunately there are no pretty pictures this time because all the work has been under the hood so far.
As Amarok’s playlist uses a model-view paradigm, I have added a new proxy model between the filter proxy and the grouping proxy, so at the moment Amarok’s playlist view displays data that passes through a stack of four models (1 source model + 3 proxy models). GUI work will begin a bit later, at the moment the interface is just a combo box and a button that says “Sort!” which I use for testing. So what does it actually do right now? The good news is that multilevel sorting of the playlist kind of works: the user just has to hardcode a multilevel sorting scheme or select one of the available schemes from the combo box, click “Sort!” and the magic happens. Basically, the sorting scheme gets translated into a QList that maps all the source indexes to an ordered n-tuple, this QList is then used as a lookup table. The bad news is that sometimes the magic spell goes terribly wrong, as I still have to handle the consistency of the map when the playlist is already sorted and the user adds, moves or removes some tracks. All the time I put into studying algorithms at the university has finally paid off big time, and I’m being very careful about the efficiency of the code – in the present state the sort proxy stuff might crash Amarok from time to time, but at least when it works it’s quite fast 😀
All this and hopefully much more should land in trunk some time after Amarok 2.1.1 gets released.