diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2018-04-05 15:58:16 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2018-04-10 12:32:12 +0000 |
commit | 3cd04bbe02ef9f48f9b99994dae326c81d0f11e6 (patch) | |
tree | 92a446d68e95b0582bc70b00e11deb9032be5d18 | |
parent | 7ee1adca536b422623de1fe8da44135aeee6e9cf (diff) |
Rename KeyframeMutator to Timeline
Also renaming the class and tests.
Change-Id: I6037c00608c7fc31eb9e8c969d8b67861dbf5711
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r-- | src/imports/timeline/plugins.qmltypes | 4 | ||||
-rw-r--r-- | src/imports/timeline/qquickkeyframe.cpp | 10 | ||||
-rw-r--r-- | src/imports/timeline/qquicktimeline.cpp (renamed from src/imports/timeline/qquickkeyframemutator.cpp) | 90 | ||||
-rw-r--r-- | src/imports/timeline/qquicktimeline_p.h (renamed from src/imports/timeline/qquickkeyframemutator_p.h) | 14 | ||||
-rw-r--r-- | src/imports/timeline/qtquicktimelineplugin.cpp | 4 | ||||
-rw-r--r-- | src/imports/timeline/timeline.pri | 8 | ||||
-rw-r--r-- | tests/manual/timelineTestApp/test01.qml | 8 | ||||
-rw-r--r-- | tests/manual/timelineTestApp/test02.qml | 6 | ||||
-rw-r--r-- | tests/manual/timelineTestApp/test03.qml | 4 |
9 files changed, 74 insertions, 74 deletions
diff --git a/src/imports/timeline/plugins.qmltypes b/src/imports/timeline/plugins.qmltypes index a010238..bc58326 100644 --- a/src/imports/timeline/plugins.qmltypes +++ b/src/imports/timeline/plugins.qmltypes @@ -19,10 +19,10 @@ Module { Signal { name: "easingCurveChanged" } } Component { - name: "QQuickKeyframeMutator" + name: "QQuickTimeline" defaultProperty: "keyframes" prototype: "QObject" - exports: ["QtQuick.Timeline/KeyframeMutator 1.0"] + exports: ["QtQuick.Timeline/Timeline 1.0"] exportMetaObjectRevisions: [0] Property { name: "startFrame"; type: "double" } Property { name: "endFrame"; type: "double" } diff --git a/src/imports/timeline/qquickkeyframe.cpp b/src/imports/timeline/qquickkeyframe.cpp index 5cf75e8..3e98192 100644 --- a/src/imports/timeline/qquickkeyframe.cpp +++ b/src/imports/timeline/qquickkeyframe.cpp @@ -18,7 +18,7 @@ #include "qquickkeyframe_p.h" -#include "qquickkeyframemutator_p.h" +#include "qquicktimeline_p.h" #include <QtCore/QVariantAnimation> #include <QtCore/qmath.h> @@ -207,7 +207,7 @@ QVariant QQuickKeyframes::evaluate(qreal frame) const return QVariant(); static QQuickKeyframe dummy; - QQuickKeyframeMutator *timeline = qobject_cast<QQuickKeyframeMutator*>(parent()); + QQuickTimeline *timeline = qobject_cast<QQuickTimeline*>(parent()); if (timeline) dummy.setFrame(timeline->startFrame() - 0.0001); dummy.setValue(d->originalValue); @@ -251,9 +251,9 @@ void QQuickKeyframes::reset() if (!d->componentComplete) return; - QQuickKeyframeMutator *mutator = qobject_cast<QQuickKeyframeMutator*>(parent()); - if (mutator) - setProperty(mutator->currentFrame()); + auto *timeline = qobject_cast<QQuickTimeline*>(parent()); + if (timeline) + setProperty(timeline->currentFrame()); } void QQuickKeyframes::setupKeyframes() diff --git a/src/imports/timeline/qquickkeyframemutator.cpp b/src/imports/timeline/qquicktimeline.cpp index ab4b593..9f9c977 100644 --- a/src/imports/timeline/qquickkeyframemutator.cpp +++ b/src/imports/timeline/qquicktimeline.cpp @@ -16,7 +16,7 @@ ** ****************************************************************************/ -#include "qquickkeyframemutator_p.h" +#include "qquicktimeline_p.h" #include <QtCore/qmath.h> #include <QtGui/qpainter.h> @@ -24,11 +24,11 @@ QT_BEGIN_NAMESPACE -class QQuickKeyframeMutatorPrivate : public QObjectPrivate +class QQuickTimelinePrivate : public QObjectPrivate { - Q_DECLARE_PUBLIC(QQuickKeyframeMutator) + Q_DECLARE_PUBLIC(QQuickTimeline) public: - QQuickKeyframeMutatorPrivate() + QQuickTimelinePrivate() : startFrame(0), endFrame(0), currentFrame(0), @@ -56,7 +56,7 @@ protected: QList<QQuickKeyframes *> keyframes; }; -void QQuickKeyframeMutatorPrivate::init() +void QQuickTimelinePrivate::init() { for (auto keyFrames : keyframes) { keyFrames->init(); @@ -64,63 +64,63 @@ void QQuickKeyframeMutatorPrivate::init() } } -void QQuickKeyframeMutatorPrivate::disable() +void QQuickTimelinePrivate::disable() { for (auto keyFrames : keyframes) keyFrames->resetDefaultValue(); } -void QQuickKeyframeMutatorPrivate::append_keyframe(QQmlListProperty<QQuickKeyframes> *list, QQuickKeyframes *a) +void QQuickTimelinePrivate::append_keyframe(QQmlListProperty<QQuickKeyframes> *list, QQuickKeyframes *a) { - QQuickKeyframeMutator *q = static_cast<QQuickKeyframeMutator *>(list->object); + QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object); q->d_func()->keyframes.append(a); } -int QQuickKeyframeMutatorPrivate::keyframe_count(QQmlListProperty<QQuickKeyframes> *list) +int QQuickTimelinePrivate::keyframe_count(QQmlListProperty<QQuickKeyframes> *list) { - QQuickKeyframeMutator *q = static_cast<QQuickKeyframeMutator *>(list->object); + QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object); return q->d_func()->keyframes.count(); } -QQuickKeyframes* QQuickKeyframeMutatorPrivate::keyframe_at(QQmlListProperty<QQuickKeyframes> *list, int pos) +QQuickKeyframes* QQuickTimelinePrivate::keyframe_at(QQmlListProperty<QQuickKeyframes> *list, int pos) { - QQuickKeyframeMutator *q = static_cast<QQuickKeyframeMutator *>(list->object); + QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object); return q->d_func()->keyframes.at(pos); } -void QQuickKeyframeMutatorPrivate::clear_keyframes(QQmlListProperty<QQuickKeyframes> *list) +void QQuickTimelinePrivate::clear_keyframes(QQmlListProperty<QQuickKeyframes> *list) { - QQuickKeyframeMutator *q = static_cast<QQuickKeyframeMutator *>(list->object); + QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object); while (q->d_func()->keyframes.count()) { QQuickKeyframes *firstKeyframe = q->d_func()->keyframes.at(0); q->d_func()->keyframes.removeAll(firstKeyframe); } } -QQuickKeyframeMutator::QQuickKeyframeMutator(QObject *parent) : QObject(*(new QQuickKeyframeMutatorPrivate), parent) +QQuickTimeline::QQuickTimeline(QObject *parent) : QObject(*(new QQuickTimelinePrivate), parent) { } -QQmlListProperty<QQuickKeyframes> QQuickKeyframeMutator::keyframes() +QQmlListProperty<QQuickKeyframes> QQuickTimeline::keyframes() { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); - return QQmlListProperty<QQuickKeyframes>(this, &d->keyframes, QQuickKeyframeMutatorPrivate::append_keyframe, - QQuickKeyframeMutatorPrivate::keyframe_count, - QQuickKeyframeMutatorPrivate::keyframe_at, - QQuickKeyframeMutatorPrivate::clear_keyframes); + return QQmlListProperty<QQuickKeyframes>(this, &d->keyframes, QQuickTimelinePrivate::append_keyframe, + QQuickTimelinePrivate::keyframe_count, + QQuickTimelinePrivate::keyframe_at, + QQuickTimelinePrivate::clear_keyframes); } -bool QQuickKeyframeMutator::enabled() const +bool QQuickTimeline::enabled() const { - Q_D(const QQuickKeyframeMutator); + Q_D(const QQuickTimeline); return d->enabled; } -void QQuickKeyframeMutator::setEnabled(bool b) +void QQuickTimeline::setEnabled(bool b) { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); if (d->enabled == b) return; d->enabled = b; @@ -135,45 +135,45 @@ void QQuickKeyframeMutator::setEnabled(bool b) emit enabledChanged(); } -qreal QQuickKeyframeMutator::startFrame() const +qreal QQuickTimeline::startFrame() const { - Q_D(const QQuickKeyframeMutator); + Q_D(const QQuickTimeline); return d->startFrame; } -void QQuickKeyframeMutator::setStartFrame(qreal frame) +void QQuickTimeline::setStartFrame(qreal frame) { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); if (d->startFrame == frame) return; d->startFrame = frame; emit startFrameChanged(); } -qreal QQuickKeyframeMutator::endFrame() const +qreal QQuickTimeline::endFrame() const { - Q_D(const QQuickKeyframeMutator); + Q_D(const QQuickTimeline); return d->endFrame; } -void QQuickKeyframeMutator::setEndFrame(qreal frame) +void QQuickTimeline::setEndFrame(qreal frame) { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); if (d->endFrame == frame) return; d->endFrame = frame; emit endFrameChanged(); } -qreal QQuickKeyframeMutator::currentFrame() const +qreal QQuickTimeline::currentFrame() const { - Q_D(const QQuickKeyframeMutator); + Q_D(const QQuickTimeline); return d->currentFrame; } -void QQuickKeyframeMutator::setCurrentFrame(qreal frame) +void QQuickTimeline::setCurrentFrame(qreal frame) { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); if (d->currentFrame == frame) return; d->currentFrame = frame; @@ -185,31 +185,31 @@ void QQuickKeyframeMutator::setCurrentFrame(qreal frame) emit currentFrameChanged(); } -void QQuickKeyframeMutator::init() +void QQuickTimeline::init() { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); if (d->componentComplete) d->init(); } -void QQuickKeyframeMutator::reset() +void QQuickTimeline::reset() { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); if (d->componentComplete) d->disable(); } -void QQuickKeyframeMutator::classBegin() +void QQuickTimeline::classBegin() { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); d->componentComplete = false; } -void QQuickKeyframeMutator::componentComplete() +void QQuickTimeline::componentComplete() { - Q_D(QQuickKeyframeMutator); + Q_D(QQuickTimeline); d->componentComplete = true; if (d->enabled) diff --git a/src/imports/timeline/qquickkeyframemutator_p.h b/src/imports/timeline/qquicktimeline_p.h index 8cba93a..e54e450 100644 --- a/src/imports/timeline/qquickkeyframemutator_p.h +++ b/src/imports/timeline/qquicktimeline_p.h @@ -16,8 +16,8 @@ ** ****************************************************************************/ -#ifndef QQUICKKEYFRAMEMUTATOR_P_H -#define QQUICKKEYFRAMEMUTATOR_P_H +#ifndef QQUICKTIMELINE_P_H +#define QQUICKTIMELINE_P_H // // W A R N I N G @@ -36,12 +36,12 @@ QT_BEGIN_NAMESPACE -class QQuickKeyframeMutatorPrivate; +class QQuickTimelinePrivate; -class QQuickKeyframeMutator : public QObject, public QQmlParserStatus +class QQuickTimeline : public QObject, public QQmlParserStatus { Q_OBJECT - Q_DECLARE_PRIVATE(QQuickKeyframeMutator) + Q_DECLARE_PRIVATE(QQuickTimeline) Q_INTERFACES(QQmlParserStatus) @@ -54,7 +54,7 @@ class QQuickKeyframeMutator : public QObject, public QQmlParserStatus Q_CLASSINFO("DefaultProperty", "keyframes") public: - explicit QQuickKeyframeMutator(QObject *parent = nullptr); + explicit QQuickTimeline(QObject *parent = nullptr); QQmlListProperty<QQuickKeyframes> keyframes(); @@ -86,4 +86,4 @@ Q_SIGNALS: QT_END_NAMESPACE -#endif // QQUICKKEYFRAMEMUTATOR_P_H +#endif // QQUICKTIMELINE_P_H diff --git a/src/imports/timeline/qtquicktimelineplugin.cpp b/src/imports/timeline/qtquicktimelineplugin.cpp index 2a69ddf..df9659e 100644 --- a/src/imports/timeline/qtquicktimelineplugin.cpp +++ b/src/imports/timeline/qtquicktimelineplugin.cpp @@ -18,7 +18,7 @@ #include <QtQml/qqmlextensionplugin.h> -#include "qquickkeyframemutator_p.h" +#include "qquicktimeline_p.h" #include "qquickkeyframe_p.h" static inline void initResources() @@ -49,7 +49,7 @@ QtQuickTimelinePlugin::QtQuickTimelinePlugin(QObject *parent) : QQmlExtensionPlu void QtQuickTimelinePlugin::registerTypes(const char *uri) { - qmlRegisterType<QQuickKeyframeMutator>(uri, 1, 0, "KeyframeMutator"); + qmlRegisterType<QQuickTimeline>(uri, 1, 0, "Timeline"); qmlRegisterType<QQuickKeyframe>(uri, 1, 0, "Keyframe"); qmlRegisterType<QQuickKeyframes>(uri, 1, 0, "Keyframes"); } diff --git a/src/imports/timeline/timeline.pri b/src/imports/timeline/timeline.pri index df73d4e..5aa0999 100644 --- a/src/imports/timeline/timeline.pri +++ b/src/imports/timeline/timeline.pri @@ -1,7 +1,7 @@ HEADERS += \ - $$PWD/qquickkeyframemutator_p.h \ - $$PWD/qquickkeyframe_p.h + $$PWD/qquickkeyframe_p.h \ + $$PWD/qquicktimeline_p.h SOURCES += \ - $$PWD/qquickkeyframemutator.cpp \ - $$PWD/qquickkeyframe.cpp + $$PWD/qquickkeyframe.cpp \ + $$PWD/qquicktimeline.cpp diff --git a/tests/manual/timelineTestApp/test01.qml b/tests/manual/timelineTestApp/test01.qml index 95af21d..09df989 100644 --- a/tests/manual/timelineTestApp/test01.qml +++ b/tests/manual/timelineTestApp/test01.qml @@ -26,7 +26,7 @@ Item { color: "blue" MouseArea { anchors.fill: parent - onClicked: mutator.enabled = !mutator.enabled + onClicked: timeline.enabled = !timeline.enabled } } @@ -43,7 +43,7 @@ Item { NumberAnimation { id: animation - target: mutator + target: timeline property: "currentFrame" easing.type: Easing.InOutQuad duration: 2000 @@ -56,8 +56,8 @@ Item { width: 480 height: 480 - KeyframeMutator { - id: mutator + Timeline { + id: timeline startFrame: 0 endFrame: 100 diff --git a/tests/manual/timelineTestApp/test02.qml b/tests/manual/timelineTestApp/test02.qml index 449b69e..e0574f7 100644 --- a/tests/manual/timelineTestApp/test02.qml +++ b/tests/manual/timelineTestApp/test02.qml @@ -23,7 +23,7 @@ Item { PropertyAnimation { running: true duration: 1000 - target: mutator + target: timeline property: "currentFrame" from: 0 to: 1000 @@ -75,8 +75,8 @@ Item { color: "#242424" } - KeyframeMutator { - id: mutator + Timeline { + id: timeline enabled: true startFrame: 0 diff --git a/tests/manual/timelineTestApp/test03.qml b/tests/manual/timelineTestApp/test03.qml index 19368f8..1b346bb 100644 --- a/tests/manual/timelineTestApp/test03.qml +++ b/tests/manual/timelineTestApp/test03.qml @@ -22,8 +22,8 @@ import QtQuick.Timeline 1.0 Item { id: item1 - KeyframeMutator { - id: mutator + Timeline { + id: timeline enabled: true startFrame: 0 |