18#ifndef METADATAMODEL_H
19#define METADATAMODEL_H
21#include <QSortFilterProxyModel>
26class 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)
36 NameRole = Qt::UserRole + 1,
56 HiddenMaskBit = 1 << 0,
57 clipOnlyMaskBit = 1 << 1,
58 gpuIncompatibleMaskBit = 1 << 2,
59 gpuAlternativeMaskBit = 1 << 3,
60 needsGPUMaskBit = 1 << 4,
62 trackOnlyMaskBit = 1 << 6,
63 outputOnlyMaskBit = 1 << 7,
64 reverseMaskBit = 1 << 8,
67 explicit MetadataModel(QObject *parent = 0);
69 Q_INVOKABLE
int rowCount(
const QModelIndex &parent = QModelIndex())
const;
70 int sourceRowCount(
const QModelIndex &parent = QModelIndex())
const;
71 void add(QmlMetadata *data);
72 Q_INVOKABLE QmlMetadata *get(
int row)
const;
73 QmlMetadata *getFromSource(
int index)
const;
74 Q_INVOKABLE
void saveFilterSet(
const QString &name);
75 Q_INVOKABLE
void deleteFilterSet(
const QString &name);
76 MetadataFilter filter()
const
80 void setFilter(MetadataFilter);
81 void updateFilterMask(
bool isClipProducer,
bool isChainProducer,
bool isTrackProducer,
82 bool isOutputProducer,
bool isReverseSupported);
83 QString search()
const
87 void setSearch(
const QString &search);
94 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent)
const;
97 MetadataFilter m_filter;
98 unsigned m_filterMask;
100 bool m_isClipProducer;
101 bool m_isChainProducer;
102 bool m_isTrackProducer;
103 bool m_isOutputProducer;
104 bool m_isReverseSupported;
107class InternalMetadataModel :
public QAbstractListModel
110 explicit InternalMetadataModel(QObject *parent = 0) : QAbstractListModel(parent) {};
113 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
114 QVariant data(
const QModelIndex &index,
int role)
const;
115 bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
116 QHash<int, QByteArray> roleNames()
const;
117 Qt::ItemFlags flags(
const QModelIndex &index)
const;
120 void add(QmlMetadata *data);
121 QmlMetadata *get(
int index)
const;
122 QList<QmlMetadata *> &list()
126 void remove(
int index);
129 typedef QList<QmlMetadata *> MetadataList;
132 unsigned computeFilterMask(
const QmlMetadata *meta);