| 1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DANIMATION_QABSTRACTCLIPANIMATOR_H |
| 5 | #define QT3DANIMATION_QABSTRACTCLIPANIMATOR_H |
| 6 | |
| 7 | #include <Qt3DAnimation/qt3danimation_global.h> |
| 8 | #include <Qt3DAnimation/qchannelmapper.h> |
| 9 | #include <Qt3DAnimation/qclock.h> |
| 10 | #include <Qt3DCore/qcomponent.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | namespace Qt3DAnimation { |
| 15 | |
| 16 | class QAnimationClip; |
| 17 | class QAbstractClipAnimatorPrivate; |
| 18 | |
| 19 | class Q_3DANIMATIONSHARED_EXPORT QAbstractClipAnimator : public Qt3DCore::QComponent |
| 20 | { |
| 21 | Q_OBJECT |
| 22 | Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) |
| 23 | Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged) |
| 24 | Q_PROPERTY(Qt3DAnimation::QChannelMapper *channelMapper READ channelMapper WRITE setChannelMapper NOTIFY channelMapperChanged) |
| 25 | Q_PROPERTY(Qt3DAnimation::QClock *clock READ clock WRITE setClock NOTIFY clockChanged) |
| 26 | Q_PROPERTY(float normalizedTime READ normalizedTime WRITE setNormalizedTime NOTIFY normalizedTimeChanged) |
| 27 | |
| 28 | public: |
| 29 | enum Loops { Infinite = -1 }; |
| 30 | Q_ENUM(Loops) |
| 31 | |
| 32 | ~QAbstractClipAnimator(); |
| 33 | |
| 34 | bool isRunning() const; |
| 35 | Qt3DAnimation::QChannelMapper *channelMapper() const; |
| 36 | int loopCount() const; |
| 37 | Qt3DAnimation::QClock *clock() const; |
| 38 | float normalizedTime() const; |
| 39 | |
| 40 | public Q_SLOTS: |
| 41 | void setRunning(bool running); |
| 42 | void setChannelMapper(Qt3DAnimation::QChannelMapper *channelMapper); |
| 43 | void setLoopCount(int loops); |
| 44 | void setClock(Qt3DAnimation::QClock *clock); |
| 45 | void setNormalizedTime(float timeFraction); |
| 46 | |
| 47 | void start(); |
| 48 | void stop(); |
| 49 | |
| 50 | Q_SIGNALS: |
| 51 | void runningChanged(bool running); |
| 52 | void channelMapperChanged(Qt3DAnimation::QChannelMapper *channelMapper); |
| 53 | void loopCountChanged(int loops); |
| 54 | void clockChanged(Qt3DAnimation::QClock *clock); |
| 55 | void normalizedTimeChanged(float index); |
| 56 | |
| 57 | protected: |
| 58 | explicit QAbstractClipAnimator(Qt3DCore::QNode *parent = nullptr); |
| 59 | QAbstractClipAnimator(QAbstractClipAnimatorPrivate &dd, Qt3DCore::QNode *parent = nullptr); |
| 60 | |
| 61 | private: |
| 62 | Q_DECLARE_PRIVATE(QAbstractClipAnimator) |
| 63 | }; |
| 64 | |
| 65 | } // namespace Qt3DAnimation |
| 66 | |
| 67 | QT_END_NAMESPACE |
| 68 | |
| 69 | #endif // QT3DANIMATION_QABSTRACTCLIPANIMATOR_H |
| 70 | |