| 1 | // Copyright (C) 2024 The Qt Company Ltd. |
|---|---|
| 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 QSVGANIMATOR_P_H |
| 5 | #define QSVGANIMATOR_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtSvg/private/qtsvgglobal_p.h> |
| 19 | #include <QtSvg/private/qsvgnode_p.h> |
| 20 | #include "qsvgabstractanimation_p.h" |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class Q_SVG_EXPORT QSvgAbstractAnimator |
| 25 | { |
| 26 | public: |
| 27 | QSvgAbstractAnimator(); |
| 28 | virtual ~QSvgAbstractAnimator(); |
| 29 | |
| 30 | void appendAnimation(const QSvgNode *node, QSvgAbstractAnimation *anim); |
| 31 | QList<QSvgAbstractAnimation *> animationsForNode(const QSvgNode *node) const; |
| 32 | |
| 33 | void advanceAnimations(); |
| 34 | virtual void restartAnimation() = 0; |
| 35 | virtual qint64 currentElapsed() = 0; |
| 36 | virtual void setAnimatorTime(qint64 time) = 0; |
| 37 | |
| 38 | void setAnimationDuration(qint64 dur); |
| 39 | qint64 animationDuration() const; |
| 40 | |
| 41 | protected: |
| 42 | qint64 m_time; |
| 43 | qint64 m_animationDuration; |
| 44 | |
| 45 | private: |
| 46 | QList<QSvgAbstractAnimation *> combinedAnimationsForNode(const QSvgNode *node) const; |
| 47 | |
| 48 | private: |
| 49 | QHash<const QSvgNode *, QList<QSvgAbstractAnimation *>> m_animationsSMIL; |
| 50 | QHash<const QSvgNode *, QList<QSvgAbstractAnimation *>> m_animationsCSS; |
| 51 | }; |
| 52 | |
| 53 | class Q_SVG_EXPORT QSvgAnimator : public QSvgAbstractAnimator |
| 54 | { |
| 55 | public: |
| 56 | QSvgAnimator(); |
| 57 | ~QSvgAnimator(); |
| 58 | |
| 59 | virtual void restartAnimation() override; |
| 60 | virtual qint64 currentElapsed() override; |
| 61 | virtual void setAnimatorTime(qint64 time) override; |
| 62 | }; |
| 63 | |
| 64 | class Q_SVG_EXPORT QSvgAnimationController : public QSvgAbstractAnimator |
| 65 | { |
| 66 | public: |
| 67 | QSvgAnimationController(); |
| 68 | ~QSvgAnimationController(); |
| 69 | |
| 70 | virtual void restartAnimation() override; |
| 71 | virtual qint64 currentElapsed() override; |
| 72 | virtual void setAnimatorTime(qint64 time) override; |
| 73 | }; |
| 74 | |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif // QSVGANIMATOR_P_H |
| 79 |
