Qmmp
/usr/src/RPM/BUILD/qmmp-0.8-svn/src/qmmpui/playlistmanager.h
00001 /***************************************************************************
00002  *   Copyright (C) 2009-2013 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 
00026 class QTimer;
00027 class QmmpUiSettings;
00028 
00032 class PlayListManager : public QObject
00033 {
00034 Q_OBJECT
00035 public:
00040     PlayListManager(QObject *parent);
00044     ~PlayListManager();
00048     static PlayListManager* instance();
00052     QList <PlayListModel *> playLists() const;
00056     QStringList playListNames() const;
00060     PlayListModel *selectedPlayList() const;
00064     PlayListModel *currentPlayList() const;
00068     int selectedPlayListIndex() const;
00072     int currentPlayListIndex() const;
00076     int count() const;
00080     int indexOf(PlayListModel *model) const;
00085     PlayListModel *playListAt(int i) const;
00086 
00087 signals:
00093     void currentPlayListChanged (PlayListModel *current, PlayListModel *previous);
00099     void selectedPlayListChanged (PlayListModel *selected, PlayListModel *previous);
00103     void playListAdded(int index);
00107     void playListRemoved(int index);
00111     void playListMoved(int i, int j);
00115     void playListsChanged();
00116 
00117 
00118 public slots:
00122     void selectPlayList(PlayListModel *model);
00126     void selectPlayList(int index);
00130     void selectPlayList(const QString &name);
00134     void selectNextPlayList();
00138     void selectPreviousPlayList();
00142     void activatePlayList(PlayListModel *model);
00146     void activatePlayList(int index);
00150     PlayListModel *createPlayList(const QString &name = QString());
00154     void removePlayList(PlayListModel *model);
00158     void removePlayList(int index);
00162     void move(int i, int j);
00166     void clear();
00170     void clearSelection();
00174     void removeSelected();
00178     void removeUnselected();
00182     void removeTrack (int i);
00186     void removeTrack (PlayListTrack *item);
00190     void invertSelection();
00194     void selectAll();
00198     void showDetails();
00202     void add(const QStringList &paths);
00206     void randomizeList();
00210     void reverseList();
00214     void sortSelection(int mode);
00218     void sort(int mode);
00222     void addToQueue();
00226     void removeInvalidTracks();
00230     void removeDuplicates();
00234     void clearQueue();
00238     void stopAfterSelected();
00239 
00240 private slots:
00241     void writePlayLists();
00242     void onCountChanged();
00243 
00244 private:
00245     void readPlayLists();
00246     static PlayListManager* m_instance;
00247     QList <PlayListModel *> m_models;
00248     PlayListModel *m_current;
00249     PlayListModel *m_selected;
00250     QTimer *m_timer;
00251     QmmpUiSettings *m_ui_settings;
00252 };
00253 
00254 #endif // PLAYLISTMANAGER_H
 All Classes Functions Variables Enumerations Enumerator