File indexing completed on 2024-05-05 04:48:30
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Daniel Jones <danielcjones@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) version 3 or * 0007 * any later version accepted by the membership of KDE e.V. (or its successor approved * 0008 * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of * 0009 * version 3 of the license. * 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 AMAROK_DYNAMICPLAYLIST_H 0020 #define AMAROK_DYNAMICPLAYLIST_H 0021 0022 #include "core/meta/forward_declarations.h" 0023 #include "core/collections/QueryMaker.h" 0024 0025 #include "amarok_export.h" // we are exporting it for the tests 0026 0027 namespace Collections { 0028 class Collection; 0029 } 0030 class QXmlStreamReader; 0031 class QXmlStreamWriter; 0032 0033 namespace Dynamic { 0034 0035 /** Provides a basis for dynamic playlists. 0036 The DynamicPlaylist is used by the DynamicTrackNavigator. 0037 Currently the only implementation of this abstract class is the BiasedPlaylist. 0038 */ 0039 class AMAROK_EXPORT DynamicPlaylist : public QObject 0040 { 0041 Q_OBJECT 0042 0043 public: 0044 explicit DynamicPlaylist( QObject *parent = nullptr ); 0045 explicit DynamicPlaylist( QXmlStreamReader *reader, QObject *parent = nullptr ); 0046 ~DynamicPlaylist() override; 0047 0048 virtual void toXml( QXmlStreamWriter *writer ) const = 0; 0049 0050 virtual void requestTracks(int) = 0; 0051 0052 QString title() const; 0053 void setTitle( const QString &); 0054 0055 Q_SIGNALS: 0056 void tracksReady( Meta::TrackList ); 0057 0058 /** Emitted when this playlist has been modified in some way. 0059 The DynamicModel will listen to it to detect if it needs to save it. 0060 */ 0061 void changed( Dynamic::DynamicPlaylist* playlist ); 0062 0063 0064 public Q_SLOTS: 0065 /** Start recalculating all tracks after the currently played track */ 0066 // virtual void repopulate(); 0067 0068 /** Aborts the current playlist generation operation */ 0069 virtual void requestAbort() 0070 {} 0071 0072 protected: 0073 Collections::Collection* m_collection; 0074 QString m_title; 0075 }; 0076 0077 } 0078 0079 #endif 0080