Qmmp
Loading...
Searching...
No Matches
playlistmanager.h
1/***************************************************************************
2 * Copyright (C) 2009-2025 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 <QMap>
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);
128
129public slots:
137 void selectPlayListIndex(int index);
141 void selectPlayListName(const QString &name);
157 void activatePlayListIndex(int index);
165 PlayListModel *createPlayList(const QString &name = QString());
173 void removePlayListIndex(int index);
177 void move(int i, int j);
181 void clear();
197 void removeTrack(int i);
209 void selectAll();
217 void addTracks(const QList<PlayListTrack *> &tracks);
221 void addPath(const QString &path);
225 void addPaths(const QStringList &paths);
257 void refresh();
270
271private slots:
272 void writePlayLists();
273 void onListChanged(int flags);
274 void onCurrentTrackRemoved();
275
276private:
277 void readPlayLists();
278
279 static PlayListManager* m_instance;
280 static const QMap<QString, Qmmp::MetaData> m_metaKeys;
281 static const QMap<QString, Qmmp::TrackProperty> m_propKeys;
282 QList<PlayListModel *> m_models;
283 PlayListModel *m_current = nullptr;
284 PlayListModel *m_selected = nullptr;
285 QTimer *m_timer;
286 PlayListHeaderModel *m_header;
287 QmmpUiSettings *m_ui_settings;
288};
289
290#endif // PLAYLISTMANAGER_H
Helper class that provides access to playlist column configuration.
Definition playlistheadermodel.h:39
int count() const
void selectPlayList(PlayListModel *model)
void playListAdded(int index)
void removeUnselected()
void addTracks(const QList< PlayListTrack * > &tracks)
void removeDuplicates()
void sortSelection(PlayListModel::SortMode mode)
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 selectPlayListName(const QString &name)
void selectNextPlayList()
void removeInvalidTracks()
void currentTrackRemoved()
PlayListManager(QObject *parent)
QStringList playListNames() const
PlayListModel * selectedPlayList() const
PlayListHeaderModel * headerModel()
void randomizeList()
void removeTrack(int i)
PlayListModel * playListAt(int i) const
void activatePlayListIndex(int index)
void removeTrack(PlayListTrack *item)
int selectedPlayListIndex() const
int currentPlayListIndex() const
void playListRemoved(int index)
void addPath(const QString &path)
void removePlayListIndex(int index)
void playListsChanged()
void clearSelection()
void addPaths(const QStringList &paths)
int indexOf(PlayListModel *model) const
void rebuildGroups()
void stopAfterSelected()
void invertSelection()
void selectedPlayListChanged(PlayListModel *selected, PlayListModel *previous)
static PlayListManager * instance()
void activateSelectedPlayList()
void selectPreviousPlayList()
void removeSelected()
void selectPlayListIndex(int index)
void removePlayList(PlayListModel *model)
The PlayListModel class provides a data model for the playlist.
Definition playlistmodel.h:88
SortMode
Definition playlistmodel.h:323
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:36