-
Notifications
You must be signed in to change notification settings - Fork 0
/
XMPPlaylistModel.hpp
70 lines (56 loc) · 1.95 KB
/
XMPPlaylistModel.hpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*\
|*| Copyright 2016-2017 Sonu Lohani <[email protected]>
|*|
|*| This file is part of the XMPMusicPlayer program.
|*|
|*| XplicitMusicPlayer is free software: you can redistribute it and/or modify
|*| it under the terms of the GNU Lesser General Public License version 3
|*| as published by the Free Software Foundation.
|*|
|*| XplicitMusicPlayer is distributed in the hope that it will be useful,
|*| but WITHOUT ANY WARRANTY; without even the implied warranty of
|*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|*| GNU Lesser General Public License for more details.
|*|
|*| You should have received a copy of the GNU Lesser General Public License
|*| along with XplicitMusicPlayer. If not, see <http://www.gnu.org/licenses/>.
\*/
#ifndef XMPPLAYLISTMODEL_H
#define XMPPLAYLISTMODEL_H
#include <QAbstractItemModel>
QT_BEGIN_NAMESPACE
class QMediaPlaylist;
QT_END_NAMESPACE
namespace xmp {
namespace model {
class XMPPlaylistModel : public QAbstractItemModel
{
Q_OBJECT
public:
enum Column
{
Title = 0,
ColumnCount
};
XMPPlaylistModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QMediaPlaylist *playlist() const;
void setPlaylist(QMediaPlaylist *playlist);
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole);
private slots:
void beginInsertItems(int start, int end);
void endInsertItems();
void beginRemoveItems(int start, int end);
void endRemoveItems();
void changeItems(int start, int end);
private:
QMediaPlaylist *m_playlist;
QMap<QModelIndex, QVariant> m_data;
};
}
}
#endif // XMPPLAYLISTMODEL_H