Debian Codegraph @

src/playlist/navigators/RandomTrackNavigator.h

raw
1 /****************************************************************************************
2 * Copyright (c) 2008 Seb Ruiz <[email protected]> *
3 * Copyright (c) 2008 Soren Harward <[email protected]> *
4 * Copyright (c) 2010 Nanno Langstraat <[email protected]> *
5 * *
6 * This program is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU General Public License as published by the Free Software *
8 * Foundation; either version 2 of the License, or (at your option) version 3 or *
9 * any later version accepted by the membership of KDE e.V. (or its successor approved *
10 * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of *
11 * version 3 of the license. *
12 * *
13 * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
15 * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License along with *
18 * this program. If not, see <http://www.gnu.org/licenses/>. *
19 ****************************************************************************************/
20
21 #ifndef AMAROK_RANDOMTRACKNAVIGATOR_H
22 #define AMAROK_RANDOMTRACKNAVIGATOR_H
23
24 #include "NonlinearTrackNavigator.h"
25
26 namespace Playlist
27 {
28 /**
29 * Plays a random track in the playlist
30 */
31 class RandomTrackNavigator : public NonlinearTrackNavigator
32 {
33 Q_OBJECT
34
35 public:
36 RandomTrackNavigator();
37
38 static const int AVOID_RECENTLY_PLAYED_MAX = 512; //!< Try to avoid the 'N' most recently played items.
39
40 private:
41 //! Overrides from 'NonlinearTrackNavigator'
42 void planOne() override;
43 void notifyItemsInserted( const QSet<quint64> &insertedItems ) override { Q_UNUSED( insertedItems ); }
44 void notifyItemsRemoved( const QSet<quint64> &removedItems ) override { Q_UNUSED( removedItems ); }
45
46 QSet<quint64> getRecentHistory( int size );
47 quint64 chooseRandomItem(const QSet<quint64> &avoidSet );
48 };
49 }
50
51 #endif