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,
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,
76 InterpolationType type);
77 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
int position);
78 Q_INVOKABLE
void setKeyframeValue(
int parameterIndex,
int keyframeIndex,
double value);
79 Q_INVOKABLE
void setKeyframeValuePosition(
int parameterIndex,
int keyframeIndex,
double value,
81 Q_INVOKABLE
bool isKeyframe(
int parameterIndex,
int position);
82 Q_INVOKABLE
bool advancedKeyframesInUse();
83 Q_INVOKABLE
void removeAdvancedKeyframes();
84 Q_INVOKABLE
bool simpleKeyframesInUse();
85 Q_INVOKABLE
void removeSimpleKeyframes();
89 void keyframeAdded(QString parameter,
int position);
93 void onFilterChanged(
const QString &property);
94 void onFilterInChanged(
int delta);
95 void trimFilterIn(
int in);
96 void trimFilterOut(
int out);
99 QList<QString> m_propertyNames;
100 QmlMetadata *m_metadata;
102 QList<int> m_keyframeCounts;
103 QList<int> m_metadataIndex;
105 int keyframeCount(
int index)
const;
106 void updateNeighborsMinMax(
int parameterIndex,
int keyframeIndex);