2 This file is part of Jerboa.
3 Jerboa is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option), version 3 of the license.
8 Jerboa is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with Jerboa. If not, see <http://www.gnu.org/licenses/>.
16 #ifndef _JERBOA_PLAYLIST_MODEL_H
17 #define _JERBOA_PLAYLIST_MODEL_H
20 #include "TrackData.h"
23 #include <QAbstractItemModel>
26 #include <QModelIndex>
28 #include <QSqlDatabase>
30 #include <QStringList>
35 class TrackDataLoader
;
36 class PlaylistModel
: public QAbstractItemModel
40 PlaylistModel(const QString
& dbConnectionName
, QObject
* parent
= 0);
42 QVariant
data(const QModelIndex
&index
, int role
) const;
43 Qt::ItemFlags
flags(const QModelIndex
& index
) const;
44 QVariant
headerData(int section
, Qt::Orientation orientation
,
45 int role
= Qt::DisplayRole
) const;
46 QModelIndex
index(int row
, int column
, const QModelIndex
& parent
= QModelIndex()) const;
47 QModelIndex
parent(const QModelIndex
& index
) const;
48 int rowCount(const QModelIndex
&parent
= QModelIndex()) const;
49 int columnCount(const QModelIndex
&parent
= QModelIndex()) const;
50 virtual bool removeRows(int row
, int count
, const QModelIndex
& parent
= QModelIndex());
52 QStringList
mimeTypes() const;
53 virtual QMimeData
* mimeData(const QModelIndexList
& indexes
) const;
54 bool dropMimeData(const QMimeData
* data
, Qt::DropAction action
, int row
, int column
, const QModelIndex
& parent
);
55 Qt::DropActions
supportedDropActions() const;
57 void setCurrentItem(const QModelIndex
&);
58 QModelIndex
currentItem() const;
59 QModelIndex
peekNext() const;
60 QModelIndex
moveNext();
61 QModelIndex
peekPrevious() const;
62 QModelIndex
movePrevious();
64 TrackData
trackData(const QModelIndex
& index
) const;
66 LoopMode
loopMode() const;
67 void setLoopMode(LoopMode
);
69 ShuffleMode
shuffleMode() const;
70 void setShuffleMode(ShuffleMode
);
72 static bool skipFile(const QString
& file
);
76 void gotTrackData(const QUrl
& file
, const TrackData
& data
);
86 ShuffleMode mShuffleMode
;
87 TrackDataLoader
* mTrackLoader
;
88 QList
<QPair
<QUrl
, quint32
> > mUrlsToAdd
;