aboutsummaryrefslogtreecommitdiffstats
path: root/CollectionModel.h
blob: d3423424408d17451f682bbe133d0ff009cd88f1 (plain) (blame)
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
/*
 * Copyright 2008 Jason A. Donenfeld <Jason@zx2c4.com>
 */

#ifndef COLLECTIONMODEL_H
#define COLLECTIONMODEL_H

#include <QAbstractItemModel>
#include <QModelIndex>
#include <QList>

class Song;

class CollectionModel : public QAbstractItemModel
{
	Q_OBJECT;
public:
	CollectionModel(QList<Song*> songs, QObject* parent = 0);
	QVariant data(const QModelIndex &index, int role) const;
	int rowCount(const QModelIndex &parent = QModelIndex()) const;
	int columnCount(const QModelIndex &parent = QModelIndex()) const;
	QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
	QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
	QModelIndex parent(const QModelIndex& index) const;
	Qt::ItemFlags flags(const QModelIndex&) const;
	QStringList mimeTypes() const;
	virtual QMimeData* mimeData(const QModelIndexList& indexes) const;
	Song* song(const QModelIndex& index) const;
	int position() const { return m_position; }
	void setPosition(int position) { m_position = position; }
	void setFakeBoldState(bool state) { m_fakeBoldState = state; }
private:
	QList<Song*> m_songs;
	int m_position;
	bool m_fakeBoldState;
};
#endif //COLLECTIONMODEL_H