18 #ifndef PLAYLISTMODEL_H
19 #define PLAYLISTMODEL_H
21 #include <MltPlaylist.h>
22 #include <QAbstractTableModel>
24 #include <QStringList>
26 class PlaylistModel :
public QAbstractTableModel
37 enum MediaType { Video, Image, Audio, Other, Pending };
54 FIELD_INDEX = Qt::UserRole,
62 FIELD_MEDIA_TYPE_ENUM,
67 static const int THUMBNAIL_WIDTH = 80;
68 static const int THUMBNAIL_HEIGHT = 45;
70 explicit PlaylistModel(QObject *parent = 0);
72 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
73 int columnCount(
const QModelIndex &parent = QModelIndex())
const;
74 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const;
75 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const;
76 Qt::DropActions supportedDropActions()
const;
77 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex());
78 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex());
79 bool moveRows(
const QModelIndex &sourceParent,
82 const QModelIndex &destinationParent,
83 int destinationChild);
84 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder);
85 Qt::ItemFlags flags(
const QModelIndex &index)
const;
86 QStringList mimeTypes()
const;
87 QMimeData *mimeData(
const QModelIndexList &indexes)
const;
88 bool dropMimeData(
const QMimeData *data,
89 Qt::DropAction action,
92 const QModelIndex &parent);
93 QModelIndex createIndex(
int row,
int column)
const;
94 void createIfNeeded();
95 void showThumbnail(
int row);
96 void refreshThumbnails();
97 Mlt::Playlist *playlist() {
return m_playlist; }
98 void setPlaylist(Mlt::Playlist &playlist);
99 void setInOut(
int row,
int in,
int out);
101 ViewMode viewMode()
const;
102 void setViewMode(ViewMode mode);
103 void setBin(
int row,
const QString &name);
104 void renameBin(
const QString &bin,
const QString &newName = QString());
112 void dropped(
const QMimeData *data,
int row);
113 void moveClip(
int from,
int to);
114 void inChanged(
int in);
115 void outChanged(
int out);
116 void removing(Mlt::Service *service);
121 void append(Mlt::Producer &,
bool emitModified =
true);
122 void insert(Mlt::Producer &,
int row);
123 void remove(
int row);
124 void update(
int row, Mlt::Producer &producer,
bool copyFilters =
false);
125 void updateThumbnails(
int row);
126 void appendBlank(
int frames);
127 void insertBlank(
int frames,
int row);
129 void move(
int from,
int to);
132 Mlt::Playlist *m_playlist;
135 QList<int> m_rowsRemoved;
138 void onRowsAboutToBeRemoved(
const QModelIndex &parent,
int first,
int last);