-
Notifications
You must be signed in to change notification settings - Fork 0
/
playlist.h
45 lines (36 loc) · 1.08 KB
/
playlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef PLAYLIST_H
#define PLAYLIST_H
#include <QObject>
#include <QJsonObject>
#include "qjsonlistmodel.h"
#include "videolistmodel.h"
class QAbstractListModel;
class QJsonListModel;
class VideoListModel;
class Playlist : public QObject
{
Q_OBJECT
friend class YoutubePlayer;
public:
explicit Playlist(QObject *parent = nullptr);
Q_PROPERTY(VideoListModel* model MEMBER m_model)
Q_PROPERTY(int currentTrackIndex MEMBER m_currentTrackIndex NOTIFY currentTrackChanged)
QJsonObject currentTrack();
QJsonObject nextTrack();
QJsonObject prevTrack();
signals:
void mediaAdded(QModelIndexList newMedia);
void mediaReset(); // model changed, propagate
void currentTrackChanged();
public slots:
void addEntry(QJsonObject obj);
void addEntry(const QJsonListModel &model, int index);
void copyEntry(QAbstractListModel *model, int index);
void copyMyEntry(int index);
void resetMedia(); // model changed, handle changes
void playAt(int index);
protected:
VideoListModel *m_model;
int m_currentTrackIndex{-1};
};
#endif // PLAYLIST_H