00001 /*************************************************************************** 00002 * Copyright (C) 2009-2010 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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef PLAYLISTMANAGER_H 00021 #define PLAYLISTMANAGER_H 00022 00023 #include <QObject> 00024 #include "playlistmodel.h" 00025 00029 class PlayListManager : public QObject 00030 { 00031 Q_OBJECT 00032 public: 00037 PlayListManager(QObject *parent); 00041 ~PlayListManager(); 00045 QList <PlayListModel *> playLists() const; 00049 QStringList playListNames() const; 00053 PlayListModel *selectedPlayList() const; 00057 PlayListModel *currentPlayList() const; 00061 int count(); 00065 int indexOf(PlayListModel *model); 00070 PlayListModel *playListAt(int i); 00074 bool convertUnderscore(); 00078 bool convertTwenty(); 00082 bool useMetadata(); 00086 const QString format() const; 00091 void setConvertUnderscore(bool enabled); 00096 void setConvertTwenty(bool enabled); 00101 void setUseMetadata(bool enabled); 00106 void setFormat(const QString &format); 00110 bool isRepeatableList() const; 00114 bool isShuffle() const; 00115 00116 signals: 00122 void currentPlayListChanged (PlayListModel *current, PlayListModel *previous); 00128 void selectedPlayListChanged (PlayListModel *selected, PlayListModel *previous); 00132 void playListAdded(int index); 00136 void playListRemoved(int index); 00140 void playListMoved(int i, int j); 00144 void playListsChanged(); 00149 void repeatableListChanged(bool state); 00154 void shuffleChanged(bool state); 00158 void settingsChanged(); 00159 00160 public slots: 00164 void selectPlayList(PlayListModel *model); 00168 void selectPlayList(int index); 00172 void selectNextPlayList(); 00176 void selectPreviousPlayList(); 00180 void activatePlayList(PlayListModel *model); 00184 PlayListModel *createPlayList(const QString &name = QString()); 00188 void removePlayList(PlayListModel *model); 00192 void move(int i, int j); 00197 void setRepeatableList(bool r); 00202 void setShuffle(bool s); 00206 void clear(); 00210 void clearSelection(); 00214 void removeSelected(); 00218 void removeUnselected(); 00222 void removeAt (int i); 00226 void removeItem (PlayListItem *item); 00230 void invertSelection(); 00234 void selectAll(); 00238 void showDetails(); 00242 void addFile(const QString &path); 00246 void addFiles(const QStringList& l); 00250 void addDirectory(const QString& dir); 00254 void randomizeList(); 00258 void reverseList(); 00262 void sortSelection(int mode); 00266 void sort(int mode); 00270 void addToQueue(); 00274 void removeInvalidItems(); 00278 void removeDuplicates(); 00279 00280 00281 private: 00282 void readPlayLists(); 00283 void writePlayLists(); 00284 QList <PlayListModel *> m_models; 00285 PlayListModel *m_current; 00286 PlayListModel *m_selected; 00287 bool m_repeatable, m_shuffle; 00288 }; 00289 00290 #endif // PLAYLISTMANAGER_H
1.5.9