| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2007 Ian Monroe <[email protected]> * |
| 3 |
* Copyright (c) 2010 Nanno Langstraat <[email protected]> * |
| 4 |
* * |
| 5 |
* This program is free software; you can redistribute it and/or modify it under * |
| 6 |
* the terms of the GNU General Public License as published by the Free Software * |
| 7 |
* Foundation; either version 2 of the License, or (at your option) version 3 or * |
| 8 |
* any later version accepted by the membership of KDE e.V. (or its successor approved * |
| 9 |
* by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of * |
| 10 |
* version 3 of the license. * |
| 11 |
* * |
| 12 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 13 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 14 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU General Public License along with * |
| 17 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 18 |
****************************************************************************************/ |
| 19 |
|
| 20 |
#ifndef STANDARDTRACKNAVIGATOR_H |
| 21 |
#define STANDARDTRACKNAVIGATOR_H |
| 22 |
|
| 23 |
#include "TrackNavigator.h" |
| 24 |
|
| 25 |
namespace Playlist |
| 26 |
{ |
| 27 |
/** |
| 28 |
* Simply plays the next track. |
| 29 |
*/ |
| 30 |
class StandardTrackNavigator : public TrackNavigator |
| 31 |
{ |
| 32 |
public: |
| 33 |
StandardTrackNavigator(); |
| 34 |
|
| 35 |
quint64 likelyNextTrack() override { return chooseNextTrack( m_repeatPlaylist ); } |
| 36 |
quint64 likelyLastTrack() override { return chooseLastTrack( m_repeatPlaylist ); } |
| 37 |
quint64 requestNextTrack() override; |
| 38 |
quint64 requestUserNextTrack() override; |
| 39 |
quint64 requestLastTrack() override; |
| 40 |
|
| 41 |
private: |
| 42 |
/** |
| 43 |
* This function does the same job as 'likelyNextTrack()'. It exists as a |
| 44 |
* distinct function because 'requestNextTrack()' should not call |
| 45 |
* 'likelyNextTrack()': a child class can override that to do something |
| 46 |
* unexpected (e.g. child class 'RepeatTrackNavigator'). |
| 47 |
*/ |
| 48 |
quint64 chooseNextTrack( bool repeatPlaylist ); |
| 49 |
|
| 50 |
/** |
| 51 |
* This function does the same job as 'likelyLastTrack()'. It exists as a |
| 52 |
* distinct function because 'requestLastTrack()' should not call |
| 53 |
* 'likelyLastTrack()': a child class can override that to do something |
| 54 |
* unexpected (e.g. child class 'RepeatTrackNavigator'). |
| 55 |
*/ |
| 56 |
quint64 chooseLastTrack( bool repeatPlaylist ); |
| 57 |
|
| 58 |
// repeat the entire playlist when we've reached the end |
| 59 |
bool m_repeatPlaylist; |
| 60 |
// only play items explicitly queued |
| 61 |
bool m_onlyQueue; |
| 62 |
}; |
| 63 |
|
| 64 |
} |
| 65 |
|
| 66 |
#endif |