Qmmp
/usr/src/RPM/BUILD/qmmp-0.7-svn/src/qmmpui/playlistmanager.h
00001 /***************************************************************************
00002  *   Copyright (C) 2009-2012 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 "playlistmodel.h"
00025 
00029 class PlayListManager : public QObject
00030 {
00031 Q_OBJECT
00032 public:
00037     PlayListManager(QObject *parent);
00041     ~PlayListManager();
00045     static PlayListManager* instance();
00049     QList <PlayListModel *> playLists() const;
00053     QStringList playListNames() const;
00057     PlayListModel *selectedPlayList() const;
00061     PlayListModel *currentPlayList() const;
00065     int selectedPlayListIndex() const;
00069     int currentPlayListIndex() const;
00073     int count() const;
00077     int indexOf(PlayListModel *model) const;
00082     PlayListModel *playListAt(int i) const;
00086     bool isRepeatableList() const;
00090     bool isShuffle() const;
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();
00125     void repeatableListChanged(bool state);
00130     void shuffleChanged(bool state);
00131 
00132 public slots:
00136     void selectPlayList(PlayListModel *model);
00140     void selectPlayList(int index);
00144     void selectPlayList(const QString &name);
00148     void selectNextPlayList();
00152     void selectPreviousPlayList();
00156     void activatePlayList(PlayListModel *model);
00160     void activatePlayList(int index);
00164     PlayListModel *createPlayList(const QString &name = QString());
00168     void removePlayList(PlayListModel *model);
00172     void removePlayList(int index);
00176     void move(int i, int j);
00181     void setRepeatableList(bool r);
00186     void setShuffle(bool s);
00190     void clear();
00194     void clearSelection();
00198     void removeSelected();
00202     void removeUnselected();
00206     void removeAt (int i);
00210     void removeItem (PlayListItem *item);
00214     void invertSelection();
00218     void selectAll();
00222     void showDetails();
00226     void add(const QStringList &paths);
00230     void randomizeList();
00234     void reverseList();
00238     void sortSelection(int mode);
00242     void sort(int mode);
00246     void addToQueue();
00250     void removeInvalidItems();
00254     void removeDuplicates();
00258     void clearQueue();
00262     void stopAfterSelected();
00263 
00264 private:
00265     void readPlayLists();
00266     void writePlayLists();
00267     static PlayListManager* m_instance;
00268     QList <PlayListModel *> m_models;
00269     PlayListModel *m_current;
00270     PlayListModel *m_selected;
00271     bool m_repeatable, m_shuffle;
00272 };
00273 
00274 #endif // PLAYLISTMANAGER_H
 All Classes Functions Variables Enumerations Enumerator