2 // C++ Interface: playlistmodel
4 // Author: Oliver Groß <z.o.gross@gmx.de>, (C) 2008
6 // Copyright: See COPYING file that comes with this distribution
8 #ifndef MUSIQUE_PLAYLISTMODEL_H
9 #define MUSIQUE_PLAYLISTMODEL_H
11 #include <QAbstractItemModel>
12 #include <xmmsclient/xmmsclient-qt4.h>
14 #define MQ_PLAYLIST_STATUS 0
15 #define MQ_PLAYLIST_TITLE 1
16 #define MQ_PLAYLIST_ARTIST 2
17 #define MQ_PLAYLIST_DURATION 3
20 class CPlaylistModel
: public QAbstractItemModel
{
23 CPlaylistModel(XmmsQt::QPlayback
* playback
, XmmsQt::QMedialib
* medialib
, QObject
* parent
= 0);
26 XmmsQt::QPlaylist
* playlist() const { return m_Playlist
; };
28 QVariant
data(const QModelIndex
& index
, int role
) const;
29 Qt::ItemFlags
flags(const QModelIndex
& index
) const;
30 QVariant
headerData(int section
, Qt::Orientation orientation
, int role
= Qt::DisplayRole
) const;
31 QModelIndex
index(int row
, int column
, const QModelIndex
& parent
= QModelIndex()) const;
32 QModelIndex
parent(const QModelIndex
& index
) const;
33 int rowCount(const QModelIndex
& parent
= QModelIndex()) const;
34 int columnCount(const QModelIndex
& parent
= QModelIndex()) const;
36 void setPlaylist(XmmsQt::QPlaylist
* playlist
);
38 XmmsQt::QPlaylist
* m_Playlist
;
39 XmmsQt::QMedialib
* m_Medialib
;
40 XmmsQt::QPlayback
* m_Playback
;
41 quint32 m_OldPosition
;
43 void prepareToInsertEntry(quint32 position
, quint32 id
);
44 void insertEntry(quint32 position
);
45 void prepareToRemoveEntry(quint32 position
, quint32 id
);
46 void removeEntry(quint32 position
);
47 void moveEntry(quint32 from
, quint32 to
);
48 void updateEntry(quint32 position
);
49 void updateEntriesByID(quint32 id
);
50 void reloadMediaInfo();
51 void updatePosition(quint32 position
);