18#ifndef KEYFRAMESMODEL_H
19#define KEYFRAMESMODEL_H
21#include <QAbstractItemModel>
23#include <MltProperties.h>
24#include <MltAnimation.h>
29class KeyframesModel :
public QAbstractItemModel
34 enum InterpolationType {
35 DiscreteInterpolation,
37 SmoothLooseInterpolation,
38 SmoothNaturalInterpolation,
39 SmoothTightInterpolation,
71 Q_ENUM(InterpolationType)
75 NameRole = Qt::UserRole + 1,
90 explicit KeyframesModel(QObject *parent = 0);
91 virtual ~KeyframesModel();
93 int rowCount(
const QModelIndex &parent)
const;
94 int columnCount(
const QModelIndex &parent)
const;
95 QVariant data(
const QModelIndex &index,
int role)
const;
96 QModelIndex index(
int row,
int column = 0,
97 const QModelIndex &parent = QModelIndex())
const;
98 QModelIndex parent(
const QModelIndex &index)
const;
99 QHash<int, QByteArray> roleNames()
const;
100 void load(QmlFilter *, QmlMetadata *);
101 Q_INVOKABLE
bool remove(
int parameterIndex,
int keyframeIndex);
102 int previousKeyframePosition(
int parameterIndex,
int currentPosition);
103 int nextKeyframePosition(
int parameterIndex,
int currentPosition);
104 Q_INVOKABLE
int keyframeIndex(
int parameterIndex,
int currentPosition);
105 Q_INVOKABLE
int parameterIndex(
const QString &propertyName)
const;
106 Q_INVOKABLE
bool setInterpolation(
int parameterIndex,
int keyframeIndex, InterpolationType type);
107 Q_INVOKABLE
void setKeyframePosition(
int parameterIndex,
int keyframeIndex,
int position);
108 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
double value,
int position,
109 InterpolationType type);
110 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
int position);
111 Q_INVOKABLE
void setKeyframeValue(
int parameterIndex,
int keyframeIndex,
double value);
112 Q_INVOKABLE
void setKeyframeValuePosition(
int parameterIndex,
int keyframeIndex,
double value,
114 Q_INVOKABLE
bool isKeyframe(
int parameterIndex,
int position);
115 Q_INVOKABLE
bool advancedKeyframesInUse();
116 Q_INVOKABLE
void removeAdvancedKeyframes();
117 Q_INVOKABLE
bool simpleKeyframesInUse();
118 Q_INVOKABLE
void removeSimpleKeyframes();
119 int keyframeCount(
int index)
const;
123 void keyframeAdded(QString parameter,
int position);
127 void onFilterChanged(
const QString &property);
128 void onFilterInChanged(
int delta);
129 void trimFilterIn(
int in);
130 void trimFilterOut(
int out);
133 QList<QString> m_propertyNames;
134 QmlMetadata *m_metadata;
136 QList<int> m_keyframeCounts;
137 QList<int> m_metadataIndex;
139 void updateNeighborsMinMax(
int parameterIndex,
int keyframeIndex);
140 QStringList gangedProperties(
int parameterIndex)
const;