Qmmp
Loading...
Searching...
No Matches
playlistmanager.h
1/***************************************************************************
2 * Copyright (C) 2009-2022 by Ilya Kotov *
3 * forkotov02@ya.ru *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20#ifndef PLAYLISTMANAGER_H
21#define PLAYLISTMANAGER_H
22
23#include <QObject>
24#include <QHash>
25#include <qmmp/qmmp.h>
26#include "playlistheadermodel.h"
27#include "playlistmodel.h"
28#include "qmmpui_export.h"
29
30class QTimer;
31class QmmpUiSettings;
32
36class QMMPUI_EXPORT PlayListManager : public QObject
37{
38Q_OBJECT
39public:
44 explicit PlayListManager(QObject *parent);
56 QList <PlayListModel *> playLists() const;
60 QStringList playListNames() const;
80 int count() const;
84 int indexOf(PlayListModel *model) const;
94
95signals:
111 void playListAdded(int index);
115 void playListRemoved(int index);
119 void playListMoved(int i, int j);
124
125public slots:
133 void selectPlayList(int index);
137 void selectPlayList(const QString &name);
153 void activatePlayList(int index);
161 PlayListModel *createPlayList(const QString &name = QString());
169 void removePlayList(int index);
173 void move(int i, int j);
177 void clear();
193 void removeTrack (int i);
205 void selectAll();
213 void add(const QList<PlayListTrack *> &tracks);
217 void add(const QString &path);
221 void add(const QStringList &paths);
253 void refresh();
262
263private slots:
264 void writePlayLists();
265 void onListChanged(int flags);
266
267private:
268 void readPlayLists();
269
270 static PlayListManager* m_instance;
271 static const QHash<QString, Qmmp::MetaData> m_metaKeys;
272 static const QHash<QString, Qmmp::TrackProperty> m_propKeys;
273 QList <PlayListModel *> m_models;
274 PlayListModel *m_current = nullptr;
275 PlayListModel *m_selected = nullptr;
276 QTimer *m_timer;
277 PlayListHeaderModel *m_header;
278 QmmpUiSettings *m_ui_settings;
279};
280
281#endif // PLAYLISTMANAGER_H
Helper class that provides access to playlist column configuration.
Definition playlistheadermodel.h:39
The PlayListManager class is used to handle multiple playlists.
Definition playlistmanager.h:37
int count() const
void selectPlayList(PlayListModel *model)
void playListAdded(int index)
void removeUnselected()
void removeDuplicates()
void sortSelection(PlayListModel::SortMode mode)
void add(const QString &path)
void playListMoved(int i, int j)
QList< PlayListModel * > playLists() const
void currentPlayListChanged(PlayListModel *current, PlayListModel *previous)
void sort(PlayListModel::SortMode mode)
PlayListModel * currentPlayList() const
PlayListModel * createPlayList(const QString &name=QString())
void move(int i, int j)
void activatePlayList(PlayListModel *model)
void selectNextPlayList()
void removeInvalidTracks()
PlayListManager(QObject *parent)
void selectPlayList(const QString &name)
QStringList playListNames() const
PlayListModel * selectedPlayList() const
PlayListHeaderModel * headerModel()
void randomizeList()
void removePlayList(int index)
void removeTrack(int i)
void add(const QStringList &paths)
PlayListModel * playListAt(int i) const
void removeTrack(PlayListTrack *item)
int selectedPlayListIndex() const
int currentPlayListIndex() const
void playListRemoved(int index)
void selectPlayList(int index)
void playListsChanged()
void clearSelection()
void activatePlayList(int index)
int indexOf(PlayListModel *model) const
void stopAfterSelected()
void invertSelection()
void selectedPlayListChanged(PlayListModel *selected, PlayListModel *previous)
static PlayListManager * instance()
void add(const QList< PlayListTrack * > &tracks)
void activateSelectedPlayList()
void selectPreviousPlayList()
void removeSelected()
void removePlayList(PlayListModel *model)
The PlayListModel class provides a data model for the playlist.
Definition playlistmodel.h:97
SortMode
Definition playlistmodel.h:309
The PlayListTrack class provides a track for use with the PlayListModel class.
Definition playlisttrack.h:37
The QmmpUiSettings class provides access to global libqmmpui library settings.
Definition qmmpuisettings.h:37