18 #ifndef KEYFRAMESMODEL_H
19 #define KEYFRAMESMODEL_H
21 #include <QAbstractItemModel>
23 #include <MltProperties.h>
24 #include <MltAnimation.h>
29 class KeyframesModel :
public QAbstractItemModel
34 enum InterpolationType {
35 DiscreteInterpolation,
39 Q_ENUM(InterpolationType)
43 NameRole = Qt::UserRole + 1,
55 explicit KeyframesModel(QObject* parent = 0);
56 virtual ~KeyframesModel();
58 int rowCount(
const QModelIndex& parent)
const;
59 int columnCount(
const QModelIndex& parent)
const;
60 QVariant data(
const QModelIndex& index,
int role)
const;
61 QModelIndex index(
int row,
int column = 0,
62 const QModelIndex& parent = QModelIndex())
const;
63 QModelIndex parent(
const QModelIndex& index)
const;
64 QHash<int, QByteArray> roleNames()
const;
65 void load(QmlFilter*, QmlMetadata*);
66 Q_INVOKABLE
bool remove(
int parameterIndex,
int keyframeIndex);
67 int previousKeyframePosition(
int parameterIndex,
int currentPosition);
68 int nextKeyframePosition(
int parameterIndex,
int currentPosition);
69 Q_INVOKABLE
int keyframeIndex(
int parameterIndex,
int currentPosition);
70 Q_INVOKABLE
int parameterIndex(
const QString& propertyName)
const;
71 Q_INVOKABLE
bool setInterpolation(
int parameterIndex,
int keyframeIndex, InterpolationType type);
72 Q_INVOKABLE
bool setPosition(
int parameterIndex,
int keyframeIndex,
int position);
73 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
double value,
int position, InterpolationType type);
74 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
int position);
75 Q_INVOKABLE
void setKeyframe(
int parameterIndex,
double value,
int position, InterpolationType type);
76 Q_INVOKABLE
bool isKeyframe(
int parameterIndex,
int position);
80 void keyframeAdded(QString parameter,
int position);
84 void onFilterChanged(
const QString& property);
85 void onFilterInChanged(
int delta);
86 void onFilterOutChanged(
int delta);
89 QList<QString> m_propertyNames;
90 QmlMetadata* m_metadata;
92 QList<int> m_keyframeCounts;
93 QList<int> m_metadataIndex;
95 int keyframeCount(
int index)
const;
96 void updateNeighborsMinMax(
int parameterIndex,
int keyframeIndex);