make PlaylistModel observe albums for changes to the cover image (needed for services...
[amarok.git] / src / playlist / TrackAdvancer.h
blobc40933ede38a0d62eaa5c961ab86b8fabdbf5e6e
1 /***************************************************************************
2 * copyright : (C) 2007 Ian Monroe <ian@monroe.nu> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License version 2 *
6 * as published by the Free Software Foundation. *
7 ***************************************************************************/
8 #ifndef AMAROK_TRACKADVANCER_H
9 #define AMAROK_TRACKADVANCER_H
11 namespace PlaylistNS {
13 class Model;
15 /**
16 * An abstract class which defines what should be done after a track finishes playing.
17 * The Playlist::Model will have an object of the currently active strategy.
18 * It is the "strategy" pattern from the Design Patterns book. In Amarok 1.x, the Playlist
19 * became very confusing due to random mode and dynamic playlists requiring complicated
20 * nested if statements. This should prevent that.
22 class TrackAdvancer
24 public:
25 TrackAdvancer( Model* model ) : m_playlistModel( model ) { }
26 virtual ~TrackAdvancer() { }
27 /// Performs actions that need to be done after a track has finished playing.
28 virtual void advanceTrack() = 0;
29 protected:
30 ///Convenience function, set the current track in the playlistmodel and play it.
31 ///@param position position in Model of track to start playing
32 void setCurrentTrack( int position );
33 Model* m_playlistModel; //! needed to manipulate the playlist
37 #endif