Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2009-2015 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 #ifndef PLAYLISTMANAGER_H 00021 #define PLAYLISTMANAGER_H 00022 00023 #include <QObject> 00024 #include "playlistheadermodel.h" 00025 #include "playlistmodel.h" 00026 00027 class QTimer; 00028 class QmmpUiSettings; 00029 00033 class PlayListManager : public QObject 00034 { 00035 Q_OBJECT 00036 public: 00041 PlayListManager(QObject *parent); 00045 ~PlayListManager(); 00049 static PlayListManager* instance(); 00053 QList <PlayListModel *> playLists() const; 00057 QStringList playListNames() const; 00061 PlayListModel *selectedPlayList() const; 00065 PlayListModel *currentPlayList() const; 00069 int selectedPlayListIndex() const; 00073 int currentPlayListIndex() const; 00077 int count() const; 00081 int indexOf(PlayListModel *model) const; 00086 PlayListModel *playListAt(int i) const; 00090 PlayListHeaderModel *headerModel(); 00091 00092 signals: 00098 void currentPlayListChanged (PlayListModel *current, PlayListModel *previous); 00104 void selectedPlayListChanged (PlayListModel *selected, PlayListModel *previous); 00108 void playListAdded(int index); 00112 void playListRemoved(int index); 00116 void playListMoved(int i, int j); 00120 void playListsChanged(); 00121 00122 public slots: 00126 void selectPlayList(PlayListModel *model); 00130 void selectPlayList(int index); 00134 void selectPlayList(const QString &name); 00138 void selectNextPlayList(); 00142 void selectPreviousPlayList(); 00146 void activatePlayList(PlayListModel *model); 00150 void activatePlayList(int index); 00154 PlayListModel *createPlayList(const QString &name = QString()); 00158 void removePlayList(PlayListModel *model); 00162 void removePlayList(int index); 00166 void move(int i, int j); 00170 void clear(); 00174 void clearSelection(); 00178 void removeSelected(); 00182 void removeUnselected(); 00186 void removeTrack (int i); 00190 void removeTrack (PlayListTrack *item); 00194 void invertSelection(); 00198 void selectAll(); 00202 void showDetails(); 00206 void add(const QStringList &paths); 00210 void randomizeList(); 00214 void reverseList(); 00218 void sortSelection(int mode); 00222 void sort(int mode); 00226 void addToQueue(); 00230 void removeInvalidTracks(); 00234 void removeDuplicates(); 00238 void refresh(); 00242 void clearQueue(); 00246 void stopAfterSelected(); 00247 00248 private slots: 00249 void writePlayLists(); 00250 void onListChanged(int flags); 00251 00252 private: 00253 void readPlayLists(); 00254 static PlayListManager* m_instance; 00255 QList <PlayListModel *> m_models; 00256 PlayListModel *m_current; 00257 PlayListModel *m_selected; 00258 QTimer *m_timer; 00259 PlayListHeaderModel *m_header; 00260 QmmpUiSettings *m_ui_settings; 00261 }; 00262 00263 #endif // PLAYLISTMANAGER_H