blob: 398e8b7c72314a8d5d9ecb3f3ed60044e79fa97f (
plain)
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
|
#ifndef BANSHEEPLAYLISTMODEL_H
#define BANSHEEPLAYLISTMODEL_H
#include <QHash>
#include <QtSql>
#include "library/trackmodel.h"
#include "library/trackcollection.h"
#include "library/dao/trackdao.h"
#include "library/banshee/bansheedbconnection.h"
#include "library/stardelegate.h"
#include "library/basesqltablemodel.h"
class BansheePlaylistModel : public BaseSqlTableModel {
Q_OBJECT
public:
BansheePlaylistModel(QObject* pParent, TrackCollection* pTrackCollection, BansheeDbConnection* pConnection);
~BansheePlaylistModel() final;
void setTableModel(int playlistId);
TrackPointer getTrack(const QModelIndex& index) const final;
TrackId getTrackId(const QModelIndex& index) const final;
QString getTrackLocation(const QModelIndex& index) const final;
bool isColumnInternal(int column) final;
Qt::ItemFlags flags(const QModelIndex &index) const final;
CapabilitiesFlags getCapabilities() const final;
bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole) final;
protected:
// Use this if you want a model that is read-only.
Qt::ItemFlags readOnlyFlags(const QModelIndex &index) const final;
// Use this if you want a model that can be changed
Qt::ItemFlags readWriteFlags(const QModelIndex &index) const final;
private slots:
void tracksChanged(QSet<TrackId> trackIds);
void trackLoaded(QString group, TrackPointer pTrack);
private:
QString getFieldString(const QModelIndex& index, const QString& fieldName) const;
QVariant getFieldVariant(const QModelIndex& index, const QString& fieldName) const;
void deleteTempTable();
BansheeDbConnection* m_pConnection;
int m_playlistId;
QString m_tempTableName;
};
#endif // BANSHEEPLAYLISTMODEL_H
|