File indexing completed on 2024-05-19 04:49:50
0001 /**************************************************************************************** 0002 * Copyright (c) 2007 Ian Monroe <ian@monroe.nu> * 0003 * Copyright (c) 2010 Nanno Langstraat <langstr@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) version 3 or * 0008 * any later version accepted by the membership of KDE e.V. (or its successor approved * 0009 * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of * 0010 * version 3 of the license. * 0011 * * 0012 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0013 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0014 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License along with * 0017 * this program. If not, see <http://www.gnu.org/licenses/>. * 0018 ****************************************************************************************/ 0019 0020 #ifndef STANDARDTRACKNAVIGATOR_H 0021 #define STANDARDTRACKNAVIGATOR_H 0022 0023 #include "TrackNavigator.h" 0024 0025 namespace Playlist 0026 { 0027 /** 0028 * Simply plays the next track. 0029 */ 0030 class StandardTrackNavigator : public TrackNavigator 0031 { 0032 public: 0033 StandardTrackNavigator(); 0034 0035 quint64 likelyNextTrack() override { return chooseNextTrack( m_repeatPlaylist ); } 0036 quint64 likelyLastTrack() override { return chooseLastTrack( m_repeatPlaylist ); } 0037 quint64 requestNextTrack() override; 0038 quint64 requestUserNextTrack() override; 0039 quint64 requestLastTrack() override; 0040 0041 private: 0042 /** 0043 * This function does the same job as 'likelyNextTrack()'. It exists as a 0044 * distinct function because 'requestNextTrack()' should not call 0045 * 'likelyNextTrack()': a child class can override that to do something 0046 * unexpected (e.g. child class 'RepeatTrackNavigator'). 0047 */ 0048 quint64 chooseNextTrack( bool repeatPlaylist ); 0049 0050 /** 0051 * This function does the same job as 'likelyLastTrack()'. It exists as a 0052 * distinct function because 'requestLastTrack()' should not call 0053 * 'likelyLastTrack()': a child class can override that to do something 0054 * unexpected (e.g. child class 'RepeatTrackNavigator'). 0055 */ 0056 quint64 chooseLastTrack( bool repeatPlaylist ); 0057 0058 // repeat the entire playlist when we've reached the end 0059 bool m_repeatPlaylist; 0060 // only play items explicitly queued 0061 bool m_onlyQueue; 0062 }; 0063 0064 } 0065 0066 #endif