18 #ifndef METADATAMODEL_H
19 #define METADATAMODEL_H
22 #include <QSortFilterProxyModel>
26 class MetadataModel :
public QSortFilterProxyModel
29 Q_ENUMS(MetadataFilter)
30 Q_PROPERTY(MetadataFilter filter READ filter WRITE setFilter NOTIFY filterChanged)
31 Q_PROPERTY(QString search READ search WRITE setSearch NOTIFY searchChanged)
35 NameRole = Qt::UserRole + 1,
55 HiddenMaskBit = 1 << 0,
56 clipOnlyMaskBit = 1 << 1,
57 gpuIncompatibleMaskBit = 1 << 2,
58 gpuAlternativeMaskBit = 1 << 3,
59 needsGPUMaskBit = 1 << 4,
61 trackOnlyMaskBit = 1 << 6,
62 outputOnlyMaskBit = 1 << 7,
63 reverseMaskBit = 1 << 8,
66 explicit MetadataModel(QObject *parent = 0);
68 Q_INVOKABLE
int rowCount(
const QModelIndex &parent = QModelIndex())
const;
69 int sourceRowCount(
const QModelIndex &parent = QModelIndex())
const;
70 void add(QmlMetadata *data);
71 Q_INVOKABLE QmlMetadata *get(
int row)
const;
72 QmlMetadata *getFromSource(
int index)
const;
73 Q_INVOKABLE
void saveFilterSet(
const QString &name);
74 Q_INVOKABLE
void deleteFilterSet(
const QString &name);
75 MetadataFilter filter()
const {
return m_filter; }
76 void setFilter(MetadataFilter);
77 void updateFilterMask(
bool isClipProducer,
80 bool isOutputProducer,
81 bool isReverseSupported);
82 QString search()
const {
return m_search; }
83 void setSearch(
const QString &search);
90 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
93 MetadataFilter m_filter;
94 unsigned m_filterMask;
96 bool m_isClipProducer;
97 bool m_isChainProducer;
98 bool m_isTrackProducer;
99 bool m_isOutputProducer;
100 bool m_isReverseSupported;
103 class InternalMetadataModel :
public QAbstractListModel
106 explicit InternalMetadataModel(QObject *parent = 0)
107 : QAbstractListModel(parent){};
110 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
111 QVariant data(
const QModelIndex &index,
int role)
const;
112 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
113 QHash<int, QByteArray> roleNames()
const;
114 Qt::ItemFlags flags(
const QModelIndex &index)
const;
117 void add(QmlMetadata *data);
118 QmlMetadata *get(
int index)
const;
119 QList<QmlMetadata *> &list() {
return m_list; }
120 void remove(
int index);
123 typedef QList<QmlMetadata *> MetadataList;
126 unsigned computeFilterMask(
const QmlMetadata *meta);