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

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Edward Toroshchin <edward.hades@gmail.com>                        *
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 FAVOREDRANDOMTRACKNAVIGATOR_H
0021 #define FAVOREDRANDOMTRACKNAVIGATOR_H
0022 
0023 #include "NonlinearTrackNavigator.h"
0024 
0025 namespace Playlist
0026 {
0027 
0028     class FavoredRandomTrackNavigator : public NonlinearTrackNavigator
0029     {
0030         public:
0031             FavoredRandomTrackNavigator();
0032 
0033             static const int AVOID_RECENTLY_PLAYED_MAX = 512;    //!< Try to avoid the 'N' most recently played items.
0034 
0035         private:
0036             //! Override from 'NonlinearTrackNavigator'
0037             void planOne() override;
0038             void notifyItemsInserted( const QSet<quint64> &insertedItems ) override { Q_UNUSED( insertedItems ); }
0039             void notifyItemsRemoved( const QSet<quint64> &removedItems ) override { Q_UNUSED( removedItems ); }
0040 
0041             QList<qreal> rowWeights( const QSet<quint64> &avoidSet );
0042             QSet<quint64> getRecentHistory( int size );
0043     };
0044 
0045 }
0046 
0047 #endif