| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickanimation_p_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
| 4 | ** Contact: https://www.qt.io/licensing/ | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 3 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
| 24 | ** | - |
| 25 | ** GNU General Public License Usage | - |
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
| 31 | ** included in the packaging of this file. Please review the following | - |
| 32 | ** information to ensure the GNU General Public License requirements will | - |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
| 35 | ** | - |
| 36 | ** $QT_END_LICENSE$ | - |
| 37 | ** | - |
| 38 | ****************************************************************************/ | - |
| 39 | - | |
| 40 | #ifndef QQUICKANIMATION2_P_H | - |
| 41 | #define QQUICKANIMATION2_P_H | - |
| 42 | - | |
| 43 | // | - |
| 44 | // W A R N I N G | - |
| 45 | // ------------- | - |
| 46 | // | - |
| 47 | // This file is not part of the Qt API. It exists purely as an | - |
| 48 | // implementation detail. This header file may change from version to | - |
| 49 | // version without notice, or even be removed. | - |
| 50 | // | - |
| 51 | // We mean it. | - |
| 52 | // | - |
| 53 | - | |
| 54 | #include "qquickanimation_p.h" | - |
| 55 | - | |
| 56 | #include <private/qqmlnullablevalue_p.h> | - |
| 57 | - | |
| 58 | #include <qqml.h> | - |
| 59 | #include <qqmlcontext.h> | - |
| 60 | - | |
| 61 | #include <private/qvariantanimation_p.h> | - |
| 62 | #include "private/qpauseanimationjob_p.h" | - |
| 63 | #include <QDebug> | - |
| 64 | - | |
| 65 | #include <private/qobject_p.h> | - |
| 66 | #include "private/qanimationgroupjob_p.h" | - |
| 67 | #include <QDebug> | - |
| 68 | - | |
| 69 | #include <private/qobject_p.h> | - |
| 70 | - | |
| 71 | - | |
| 72 | QT_BEGIN_NAMESPACE | - |
| 73 | - | |
| 74 | //interface for classes that provide animation actions for QActionAnimation | - |
| 75 | class QAbstractAnimationAction | - |
| 76 | { | - |
| 77 | public: | - |
| 78 | virtual ~QAbstractAnimationAction() {} | - |
| 79 | virtual void doAction() = 0; | - |
| 80 | virtual void debugAction(QDebug, int) const {} | - |
| 81 | }; | - |
| 82 | - | |
| 83 | //templated animation action | - |
| 84 | //allows us to specify an action that calls a function of a class. | - |
| 85 | //(so that class doesn't have to inherit QQuickAbstractAnimationAction) | - |
| 86 | template<class T, void (T::*method)(), void (T::*debugMethod)(QDebug, int) const> | - |
| 87 | class QAnimationActionProxy : public QAbstractAnimationAction | - |
| 88 | { | - |
| 89 | public: | - |
| 90 | QAnimationActionProxy(T *instance) : m_instance(instance) {} executed 21638 times by 8 tests: end of blockExecuted by:
| 21638 |
| 91 | void doAction() override { (m_instance->*method)(); } executed 18056 times by 8 tests: end of blockExecuted by:
| 18056 |
| 92 | void debugAction(QDebug d, int indentLevel) const override { (m_instance->*debugMethod)(d, indentLevel); } never executed: end of block | 0 |
| 93 | private: | - |
| 94 | T *m_instance; | - |
| 95 | }; | - |
| 96 | - | |
| 97 | //performs an action of type QAbstractAnimationAction | - |
| 98 | class Q_AUTOTEST_EXPORT QActionAnimation : public QAbstractAnimationJob | - |
| 99 | { | - |
| 100 | Q_DISABLE_COPY(QActionAnimation) | - |
| 101 | public: | - |
| 102 | QActionAnimation(); | - |
| 103 | - | |
| 104 | QActionAnimation(QAbstractAnimationAction *action); | - |
| 105 | ~QActionAnimation() override; | - |
| 106 | - | |
| 107 | int duration() const override; | - |
| 108 | void setAnimAction(QAbstractAnimationAction *action); | - |
| 109 | - | |
| 110 | protected: | - |
| 111 | void updateCurrentTime(int) override; | - |
| 112 | void updateState(State newState, State oldState) override; | - |
| 113 | void debugAnimation(QDebug d) const override; | - |
| 114 | - | |
| 115 | private: | - |
| 116 | QAbstractAnimationAction *animAction; | - |
| 117 | }; | - |
| 118 | - | |
| 119 | class QQuickBulkValueUpdater | - |
| 120 | { | - |
| 121 | public: | - |
| 122 | virtual ~QQuickBulkValueUpdater() {} | - |
| 123 | virtual void setValue(qreal value) = 0; | - |
| 124 | virtual void debugUpdater(QDebug, int) const {} | - |
| 125 | }; | - |
| 126 | - | |
| 127 | //animates QQuickBulkValueUpdater (assumes start and end values will be reals or compatible) | - |
| 128 | class Q_AUTOTEST_EXPORT QQuickBulkValueAnimator : public QAbstractAnimationJob | - |
| 129 | { | - |
| 130 | Q_DISABLE_COPY(QQuickBulkValueAnimator) | - |
| 131 | public: | - |
| 132 | QQuickBulkValueAnimator(); | - |
| 133 | ~QQuickBulkValueAnimator() override; | - |
| 134 | - | |
| 135 | void setAnimValue(QQuickBulkValueUpdater *value); | - |
| 136 | QQuickBulkValueUpdater *getAnimValue() const { return animValue; } executed 12 times by 2 tests: return animValue;Executed by:
| 12 |
| 137 | - | |
| 138 | void setFromSourcedValue(bool *value) { fromSourced = value; } executed 34524 times by 13 tests: end of blockExecuted by:
| 34524 |
| 139 | - | |
| 140 | int duration() const override { return m_duration; } executed 1162518 times by 13 tests: return m_duration;Executed by:
| 1162518 |
| 141 | void setDuration(int msecs) { m_duration = msecs; } executed 34538 times by 13 tests: end of blockExecuted by:
| 34538 |
| 142 | - | |
| 143 | QEasingCurve easingCurve() const { return easing; } executed 2 times by 1 test: return easing;Executed by:
| 2 |
| 144 | void setEasingCurve(const QEasingCurve &curve) { easing = curve; } executed 34538 times by 13 tests: end of blockExecuted by:
| 34538 |
| 145 | - | |
| 146 | protected: | - |
| 147 | void updateCurrentTime(int currentTime) override; | - |
| 148 | void topLevelAnimationLoopChanged() override; | - |
| 149 | void debugAnimation(QDebug d) const override; | - |
| 150 | - | |
| 151 | private: | - |
| 152 | QQuickBulkValueUpdater *animValue; | - |
| 153 | bool *fromSourced; | - |
| 154 | int m_duration; | - |
| 155 | QEasingCurve easing; | - |
| 156 | }; | - |
| 157 | - | |
| 158 | //an animation that just gives a tick | - |
| 159 | template<class T, void (T::*method)(int)> | - |
| 160 | class QTickAnimationProxy : public QAbstractAnimationJob | - |
| 161 | { | - |
| 162 | Q_DISABLE_COPY(QTickAnimationProxy) | - |
| 163 | public: | - |
| 164 | QTickAnimationProxy(T *instance) : QAbstractAnimationJob(), m_instance(instance) {} executed 8 times by 2 tests: end of blockExecuted by:
| 8 |
| 165 | int duration() const override { return -1; } executed 226 times by 2 tests: return -1;Executed by:
| 226 |
| 166 | protected: | - |
| 167 | void updateCurrentTime(int msec) override { (m_instance->*method)(msec); } executed 226 times by 2 tests: end of blockExecuted by:
| 226 |
| 168 | - | |
| 169 | private: | - |
| 170 | T *m_instance; | - |
| 171 | }; | - |
| 172 | - | |
| 173 | class Q_QUICK_PRIVATE_EXPORT QQuickAbstractAnimationPrivate : public QObjectPrivate, public QAnimationJobChangeListener | - |
| 174 | { | - |
| 175 | Q_DECLARE_PUBLIC(QQuickAbstractAnimation) | - |
| 176 | public: | - |
| 177 | QQuickAbstractAnimationPrivate() | - |
| 178 | : running(false), paused(false), alwaysRunToEnd(false), | - |
| 179 | /*connectedTimeLine(false), */componentComplete(true), | - |
| 180 | avoidPropertyValueSourceStart(false), disableUserControl(false), | - |
| 181 | registered(false), loopCount(1), group(nullptr), animationInstance(nullptr) {} executed 27504 times by 20 tests: end of blockExecuted by:
| 27504 |
| 182 | - | |
| 183 | bool running:1; | - |
| 184 | bool paused:1; | - |
| 185 | bool alwaysRunToEnd:1; | - |
| 186 | //bool connectedTimeLine:1; | - |
| 187 | bool componentComplete:1; | - |
| 188 | bool avoidPropertyValueSourceStart:1; | - |
| 189 | bool disableUserControl:1; | - |
| 190 | bool registered:1; | - |
| 191 | - | |
| 192 | int loopCount; | - |
| 193 | - | |
| 194 | void commence(); | - |
| 195 | void animationFinished(QAbstractAnimationJob *) override; | - |
| 196 | - | |
| 197 | QQmlProperty defaultProperty; | - |
| 198 | - | |
| 199 | QQuickAnimationGroup *group; | - |
| 200 | QAbstractAnimationJob* animationInstance; | - |
| 201 | - | |
| 202 | static QQmlProperty createProperty(QObject *obj, const QString &str, QObject *infoObj, QString *errorMessage = nullptr); | - |
| 203 | }; | - |
| 204 | - | |
| 205 | class QQuickPauseAnimationPrivate : public QQuickAbstractAnimationPrivate | - |
| 206 | { | - |
| 207 | Q_DECLARE_PUBLIC(QQuickPauseAnimation) | - |
| 208 | public: | - |
| 209 | QQuickPauseAnimationPrivate() | - |
| 210 | : QQuickAbstractAnimationPrivate(), duration(250) {} executed 4290 times by 11 tests: end of blockExecuted by:
| 4290 |
| 211 | - | |
| 212 | int duration; | - |
| 213 | }; | - |
| 214 | - | |
| 215 | class QQuickScriptActionPrivate : public QQuickAbstractAnimationPrivate | - |
| 216 | { | - |
| 217 | Q_DECLARE_PUBLIC(QQuickScriptAction) | - |
| 218 | public: | - |
| 219 | QQuickScriptActionPrivate(); | - |
| 220 | - | |
| 221 | QQmlScriptString script; | - |
| 222 | QString name; | - |
| 223 | QQmlScriptString runScriptScript; | - |
| 224 | bool hasRunScriptScript; | - |
| 225 | bool reversing; | - |
| 226 | - | |
| 227 | void execute(); | - |
| 228 | QAbstractAnimationAction* createAction(); | - |
| 229 | void debugAction(QDebug d, int indentLevel) const; | - |
| 230 | typedef QAnimationActionProxy<QQuickScriptActionPrivate, | - |
| 231 | &QQuickScriptActionPrivate::execute, | - |
| 232 | &QQuickScriptActionPrivate::debugAction> Proxy; | - |
| 233 | }; | - |
| 234 | - | |
| 235 | class QQuickPropertyActionPrivate : public QQuickAbstractAnimationPrivate | - |
| 236 | { | - |
| 237 | Q_DECLARE_PUBLIC(QQuickPropertyAction) | - |
| 238 | public: | - |
| 239 | QQuickPropertyActionPrivate() | - |
| 240 | : QQuickAbstractAnimationPrivate(), target(nullptr) {} executed 3598 times by 11 tests: end of blockExecuted by:
| 3598 |
| 241 | - | |
| 242 | QObject *target; | - |
| 243 | QString propertyName; | - |
| 244 | QString properties; | - |
| 245 | QList<QObject *> targets; | - |
| 246 | QList<QObject *> exclude; | - |
| 247 | - | |
| 248 | QQmlNullableValue<QVariant> value; | - |
| 249 | }; | - |
| 250 | - | |
| 251 | class QQuickAnimationGroupPrivate : public QQuickAbstractAnimationPrivate | - |
| 252 | { | - |
| 253 | Q_DECLARE_PUBLIC(QQuickAnimationGroup) | - |
| 254 | public: | - |
| 255 | QQuickAnimationGroupPrivate() | - |
| 256 | : QQuickAbstractAnimationPrivate() {} executed 5156 times by 14 tests: end of blockExecuted by:
| 5156 |
| 257 | - | |
| 258 | static void append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *role); | - |
| 259 | static void clear_animation(QQmlListProperty<QQuickAbstractAnimation> *list); | - |
| 260 | QList<QQuickAbstractAnimation *> animations; | - |
| 261 | }; | - |
| 262 | - | |
| 263 | class QQuickPropertyAnimationPrivate : public QQuickAbstractAnimationPrivate | - |
| 264 | { | - |
| 265 | Q_DECLARE_PUBLIC(QQuickPropertyAnimation) | - |
| 266 | public: | - |
| 267 | QQuickPropertyAnimationPrivate() | - |
| 268 | : QQuickAbstractAnimationPrivate(), target(nullptr), fromSourced(false), fromIsDefined(false), toIsDefined(false), | - |
| 269 | defaultToInterpolatorType(0), interpolatorType(0), interpolator(nullptr), duration(250), actions(nullptr) {} executed 10358 times by 16 tests: end of blockExecuted by:
| 10358 |
| 270 | - | |
| 271 | QVariant from; | - |
| 272 | QVariant to; | - |
| 273 | - | |
| 274 | QObject *target; | - |
| 275 | QString propertyName; | - |
| 276 | QString properties; | - |
| 277 | QList<QObject *> targets; | - |
| 278 | QList<QObject *> exclude; | - |
| 279 | QString defaultProperties; | - |
| 280 | - | |
| 281 | bool fromSourced; | - |
| 282 | bool fromIsDefined:1; | - |
| 283 | bool toIsDefined:1; | - |
| 284 | bool defaultToInterpolatorType:1; | - |
| 285 | int interpolatorType; | - |
| 286 | QVariantAnimation::Interpolator interpolator; | - |
| 287 | int duration; | - |
| 288 | QEasingCurve easing; | - |
| 289 | - | |
| 290 | // for animations that don't use the QQuickBulkValueAnimator | - |
| 291 | QQuickStateActions *actions; | - |
| 292 | - | |
| 293 | static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); | - |
| 294 | static void convertVariant(QVariant &variant, int type); | - |
| 295 | }; | - |
| 296 | - | |
| 297 | class QQuickRotationAnimationPrivate : public QQuickPropertyAnimationPrivate | - |
| 298 | { | - |
| 299 | Q_DECLARE_PUBLIC(QQuickRotationAnimation) | - |
| 300 | public: | - |
| 301 | QQuickRotationAnimationPrivate() : direction(QQuickRotationAnimation::Numerical) {} executed 14 times by 2 tests: end of blockExecuted by:
| 14 |
| 302 | - | |
| 303 | QQuickRotationAnimation::RotationDirection direction; | - |
| 304 | }; | - |
| 305 | - | |
| 306 | class Q_AUTOTEST_EXPORT QQuickAnimationPropertyUpdater : public QQuickBulkValueUpdater | - |
| 307 | { | - |
| 308 | public: | - |
| 309 | QQuickAnimationPropertyUpdater() : interpolatorType(0), interpolator(nullptr), prevInterpolatorType(0), reverse(false), fromSourced(false), fromDefined(false), wasDeleted(nullptr) {} executed 34502 times by 13 tests: end of blockExecuted by:
| 34502 |
| 310 | ~QQuickAnimationPropertyUpdater() override; | - |
| 311 | - | |
| 312 | void setValue(qreal v) override; | - |
| 313 | - | |
| 314 | void debugUpdater(QDebug d, int indentLevel) const override; | - |
| 315 | - | |
| 316 | QQuickStateActions actions; | - |
| 317 | int interpolatorType; //for Number/ColorAnimation | - |
| 318 | QVariantAnimation::Interpolator interpolator; | - |
| 319 | int prevInterpolatorType; //for generic | - |
| 320 | bool reverse; | - |
| 321 | bool fromSourced; | - |
| 322 | bool fromDefined; | - |
| 323 | bool *wasDeleted; | - |
| 324 | }; | - |
| 325 | - | |
| 326 | QT_END_NAMESPACE | - |
| 327 | - | |
| 328 | #endif // QQUICKANIMATION2_P_H | - |
| Source code | Switch to Preprocessed file |