playlist subsystem overhaul

Soren Harward stharward at gmail.com
Mon Oct 6 20:01:25 CEST 2008


As I mentioned on amarok-devel last week, I've been working on an overhaul of 
the playlist subsytem, and it's now ready to commit to the SVN tree.  It fixes 
a bunch of bugs, and (from my perspective) vastly cleans up and simplifies the 
subsystem.  But it's a big (about 16k lines, 6k of which are entirely new code) 
invasive patch, so I'd like to have a couple people look over it before I 
commit it.  The full patch (against r868502) is available at:

http://www.mandy-and-soren.org/misc_files/playlist_overhaul-r868502.patch.gz

And here's what the SVN commit log would be if I were committing it now:

---------
Major overhaul of the playlist subsystem

== Changes for end users ==
Mouse and keyboard event handling, and the selection system have both been 
significantly improved.  The undo/redo commands now work properly in all cases.  
Album grouping works consistently.  Some of the eye candy (like animations) has 
been temporarily removed, but will hopefully return in the future.

== Changes in general Amarok code ==
The PlaylistModel has been split into four different classes:
1) PlaylistActions
2) PlaylistController
3) PlaylistModel
4) PMGroupingProxy

The play, nextTrack, and previousTrack functions are now part of 
PlaylistActions.  Functions that modify the contents of the playlist (insert, 
remove, and move tracks; undo and redo) are now part of PlaylistController.  
If you want to find out about the contents of the playlist, you still use 
PlaylistModel, though you are forbidden from modifying it.  I encourage you to 
take a look at the headers for each of these classes to find out what functions 
are available.

PMGroupingProxy is described in the next section, and should not be used for 
anything other than playlist views.

The signals and slots for the PlaylistModel have changed substantially; 
PlaylistModel now behaves much more like a QAbstractItem model when it is 
modified.  I have also added a position-independent accessing system for 
situations where you care what is in the playlist, but not what order the 
playlist is in (eg, Random Track mode).

The Model::trackNumberLessThan() function has moved to Meta::Track::lessThan()

== Changes in the playlist subsystem ==

The src/playlist/ directory has been rearranged.

Along with the PlaylistModel changes, the PlaylistGraphicsView has been 
deprecated, though it has not yet removed from the source tree and will 
probably still work with all the other changes I've made.  Its replacement is a 
new PrettyListView, which is a subclass of QListView.  The reworking of 
PlaylistModel to behave more like QAbstractItemModel should vastly simplify 
writing new playlist views.  Even the base QListView adequately displays the 
content of the playlist and responds to model changes.

The grouping functionality which used to be in PlaylistModel has now be pulled 
out into PMGroupingProxy, and the grouping algorithm has been rewritten so that 
it stays properly synchronized with the playlist contents.  PrettyListView and 
PlaylitGraphicsView both use this proxy model.

--------

If you have any feedback before I commit the patch, please feel free to email 
me.  If there aren't any major objections, I'll commit this in a day or two, 
and then we can start bug hunting.

-- 
Soren Harward
stharward at gmail.com


More information about the Amarok-devel mailing list