File indexing completed on 2024-05-19 04:49:50

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Dan Meltzer <parallelgrapefruit@gmail.com>                        *
0003  * Copyright (c) 2008 Soren Harward <stharward@gmail.com>                               *
0004  * Copyright (c) 2010 Nanno Langstraat <langstr@gmail.com>                              *
0005  *                                                                                      *
0006  * This program is free software; you can redistribute it and/or modify it under        *
0007  * the terms of the GNU General Public License as published by the Free Software        *
0008  * Foundation; either version 2 of the License, or (at your option) any later           *
0009  * version.                                                                             *
0010  *                                                                                      *
0011  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0013  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0014  *                                                                                      *
0015  * You should have received a copy of the GNU General Public License along with         *
0016  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0017  ****************************************************************************************/
0018 
0019 #ifndef REPEATTRACKNAVIGATOR_H
0020 #define REPEATTRACKNAVIGATOR_H
0021 
0022 #include "StandardTrackNavigator.h"
0023 
0024 namespace Playlist
0025 {
0026     /**
0027      * Repeats the selected track over and over, unless the user intervenes
0028      */
0029     class RepeatTrackNavigator : public StandardTrackNavigator
0030     {
0031         Q_OBJECT
0032 
0033         public:
0034             RepeatTrackNavigator();
0035 
0036             quint64 likelyNextTrack() override { return m_trackid ? m_trackid : bestFallbackItem(); }
0037             // likelyLastTrack(): The user explicitly asks for change. Let parent 'StandardTrackNavigator' handle that.
0038             quint64 requestNextTrack() override { return likelyNextTrack(); }
0039             quint64 requestUserNextTrack() override { return StandardTrackNavigator::requestNextTrack(); }  // The user explicitly asks for change. Use the 'next' behaviour of parent 'StandardTrackNavigator'.
0040             // requestLastTrack(): The user explicitly asks for change. Let parent 'StandardTrackNavigator' handle that.
0041 
0042         private Q_SLOTS:
0043             void recvActiveTrackChanged( const quint64 id ) { m_trackid = id; }
0044 
0045         private:
0046             quint64 m_trackid;
0047     };
0048 
0049 }
0050 
0051 #endif