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,
57 explicit KeyframesModel(QObject* parent = 0);
58 virtual ~KeyframesModel();
60 int rowCount(
const QModelIndex& parent)
const;
61 int columnCount(
const QModelIndex& parent)
const;
62 QVariant data(
const QModelIndex& index,
int role)
const;
63 QModelIndex index(
int row,
int column = 0,
64 const QModelIndex& parent = QModelIndex())
const;
65 QModelIndex parent(
const QModelIndex& index)
const;
66 QHash<int, QByteArray> roleNames()
const;
67 void load(QmlFilter*, QmlMetadata*);
68 Q_INVOKABLE
bool remove(
int parameterIndex,
int keyframeIndex);
69 int previousKeyframePosition(
int parameterIndex,
int currentPosition);
70 int nextKeyframePosition(
int parameterIndex,
int currentPosition);
71 Q_INVOKABLE
int keyframeIndex(
int parameterIndex,
int currentPosition);
72 Q_INVOKABLE
int parameterIndex(
const QString& propertyName)
const;
73 Q_INVOKABLE
bool setInterpolation(
int parameterIndex,
int keyframeIndex, InterpolationType type);
74 Q_INVOKABLE
void setKeyframePosition(
int parameterIndex,
int keyframeIndex,
int position);
75 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
double value,
int position, InterpolationType type);
76 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
int position);
77 Q_INVOKABLE
void setKeyframeValue(
int parameterIndex,
int keyframeIndex,
double value);
78 Q_INVOKABLE
void setKeyframeValuePosition(
int parameterIndex,
int keyframeIndex,
double value,
int position);
79 Q_INVOKABLE
bool isKeyframe(
int parameterIndex,
int position);
80 Q_INVOKABLE
bool advancedKeyframesInUse();
81 Q_INVOKABLE
void removeAdvancedKeyframes();
82 Q_INVOKABLE
bool simpleKeyframesInUse();
83 Q_INVOKABLE
void removeSimpleKeyframes();
87 void keyframeAdded(QString parameter,
int position);
91 void onFilterChanged(
const QString& property);
92 void onFilterInChanged(
int delta);
93 void trimFilterIn(
int in);
94 void trimFilterOut(
int out);
97 QList<QString> m_propertyNames;
98 QmlMetadata* m_metadata;
100 QList<int> m_keyframeCounts;
101 QList<int> m_metadataIndex;
103 int keyframeCount(
int index)
const;
104 void updateNeighborsMinMax(
int parameterIndex,
int keyframeIndex);