File indexing completed on 2024-05-05 04:48:44
0001 /**************************************************************************************** 0002 * Copyright (c) 2012 Tatjana Gornak <t.gornak@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) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef AMAROK_PLAYLISTRESTORER_H 0018 #define AMAROK_PLAYLISTRESTORER_H 0019 0020 #include "core-impl/playlists/types/file/PlaylistFile.h" 0021 0022 namespace Playlist 0023 { 0024 0025 /** 0026 * Implements loading of default playlist or default track 0027 * in case if no playlist was saved (e.g. first run of Amarok) 0028 */ 0029 class Restorer: public QObject, public Playlists::PlaylistObserver 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 Restorer(); 0035 0036 /** 0037 * Initiate restoring procedure. 0038 * @param path path to the playlist to restore 0039 */ 0040 void restore( const QUrl &path ); 0041 0042 // PlaylistObserver methods: 0043 void tracksLoaded( Playlists::PlaylistPtr) override; 0044 0045 Q_SIGNALS: 0046 void restoreFinished(); 0047 0048 private: 0049 /** 0050 * Runs default tune if there is no playlist to restore 0051 */ 0052 void runJingle(); 0053 0054 /** 0055 * Processes so far loaded tracks. 0056 * If track is a playlist, then its loading is triggered 0057 */ 0058 void processTracks(); 0059 0060 Playlists::PlaylistFilePtr m_playlistToRestore; 0061 Meta::TrackList m_tracks; 0062 /// tracks last processed track position 0063 QMutableListIterator<Meta::TrackPtr> m_position; 0064 }; 0065 } 0066 0067 #endif