Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquicktimeline_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 QQUICKTIMELINE_H | - | ||||||
41 | #define QQUICKTIMELINE_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 <QtCore/QObject> | - | ||||||
55 | #include "private/qabstractanimationjob_p.h" | - | ||||||
56 | - | |||||||
57 | QT_BEGIN_NAMESPACE | - | ||||||
58 | - | |||||||
59 | class QEasingCurve; | - | ||||||
60 | class QQuickTimeLineValue; | - | ||||||
61 | class QQuickTimeLineCallback; | - | ||||||
62 | struct QQuickTimeLinePrivate; | - | ||||||
63 | class QQuickTimeLineObject; | - | ||||||
64 | class Q_AUTOTEST_EXPORT QQuickTimeLine : public QObject, QAbstractAnimationJob | - | ||||||
65 | { | - | ||||||
66 | Q_OBJECT | - | ||||||
67 | public: | - | ||||||
68 | QQuickTimeLine(QObject *parent = nullptr); | - | ||||||
69 | ~QQuickTimeLine(); | - | ||||||
70 | - | |||||||
71 | enum SyncMode { LocalSync, GlobalSync }; | - | ||||||
72 | SyncMode syncMode() const; | - | ||||||
73 | void setSyncMode(SyncMode); | - | ||||||
74 | - | |||||||
75 | void pause(QQuickTimeLineObject &, int); | - | ||||||
76 | void callback(const QQuickTimeLineCallback &); | - | ||||||
77 | void set(QQuickTimeLineValue &, qreal); | - | ||||||
78 | - | |||||||
79 | int accel(QQuickTimeLineValue &, qreal velocity, qreal accel); | - | ||||||
80 | int accel(QQuickTimeLineValue &, qreal velocity, qreal accel, qreal maxDistance); | - | ||||||
81 | int accelDistance(QQuickTimeLineValue &, qreal velocity, qreal distance); | - | ||||||
82 | - | |||||||
83 | void move(QQuickTimeLineValue &, qreal destination, int time = 500); | - | ||||||
84 | void move(QQuickTimeLineValue &, qreal destination, const QEasingCurve &, int time = 500); | - | ||||||
85 | void moveBy(QQuickTimeLineValue &, qreal change, int time = 500); | - | ||||||
86 | void moveBy(QQuickTimeLineValue &, qreal change, const QEasingCurve &, int time = 500); | - | ||||||
87 | - | |||||||
88 | void sync(); | - | ||||||
89 | void setSyncPoint(int); | - | ||||||
90 | int syncPoint() const; | - | ||||||
91 | - | |||||||
92 | void sync(QQuickTimeLineValue &); | - | ||||||
93 | void sync(QQuickTimeLineValue &, QQuickTimeLineValue &); | - | ||||||
94 | - | |||||||
95 | void reset(QQuickTimeLineValue &); | - | ||||||
96 | - | |||||||
97 | void complete(); | - | ||||||
98 | void clear(); | - | ||||||
99 | bool isActive() const; | - | ||||||
100 | - | |||||||
101 | int time() const; | - | ||||||
102 | - | |||||||
103 | int duration() const override; | - | ||||||
104 | Q_SIGNALS: | - | ||||||
105 | void updated(); | - | ||||||
106 | void completed(); | - | ||||||
107 | - | |||||||
108 | protected: | - | ||||||
109 | void updateCurrentTime(int) override; | - | ||||||
110 | void debugAnimation(QDebug d) const override; | - | ||||||
111 | - | |||||||
112 | private: | - | ||||||
113 | void remove(QQuickTimeLineObject *); | - | ||||||
114 | friend class QQuickTimeLineObject; | - | ||||||
115 | friend struct QQuickTimeLinePrivate; | - | ||||||
116 | QQuickTimeLinePrivate *d; | - | ||||||
117 | }; | - | ||||||
118 | - | |||||||
119 | class Q_AUTOTEST_EXPORT QQuickTimeLineObject | - | ||||||
120 | { | - | ||||||
121 | public: | - | ||||||
122 | QQuickTimeLineObject(); | - | ||||||
123 | virtual ~QQuickTimeLineObject(); | - | ||||||
124 | - | |||||||
125 | protected: | - | ||||||
126 | friend class QQuickTimeLine; | - | ||||||
127 | friend struct QQuickTimeLinePrivate; | - | ||||||
128 | QQuickTimeLine *_t; | - | ||||||
129 | }; | - | ||||||
130 | - | |||||||
131 | class Q_AUTOTEST_EXPORT QQuickTimeLineValue : public QQuickTimeLineObject | - | ||||||
132 | { | - | ||||||
133 | public: | - | ||||||
134 | QQuickTimeLineValue(qreal v = 0.) : _v(v) {} executed 16966 times by 19 tests: end of block Executed by:
| 16966 | ||||||
135 | - | |||||||
136 | virtual qreal value() const { return _v; } executed 310706 times by 18 tests: return _v; Executed by:
| 310706 | ||||||
137 | virtual void setValue(qreal v) { _v = v; } executed 53811 times by 9 tests: end of block Executed by:
| 53811 | ||||||
138 | - | |||||||
139 | QQuickTimeLine *timeLine() const { return _t; } never executed: return _t; | 0 | ||||||
140 | - | |||||||
141 | operator qreal() const { return _v; } executed 17272 times by 9 tests: return _v; Executed by:
| 17272 | ||||||
142 | QQuickTimeLineValue &operator=(qreal v) { setValue(v); return *this; } never executed: return *this; | 0 | ||||||
143 | private: | - | ||||||
144 | friend class QQuickTimeLine; | - | ||||||
145 | friend struct QQuickTimeLinePrivate; | - | ||||||
146 | qreal _v; | - | ||||||
147 | }; | - | ||||||
148 | - | |||||||
149 | class Q_AUTOTEST_EXPORT QQuickTimeLineCallback | - | ||||||
150 | { | - | ||||||
151 | public: | - | ||||||
152 | typedef void (*Callback)(void *); | - | ||||||
153 | - | |||||||
154 | QQuickTimeLineCallback(); | - | ||||||
155 | QQuickTimeLineCallback(QQuickTimeLineObject *b, Callback, void * = nullptr); | - | ||||||
156 | QQuickTimeLineCallback(const QQuickTimeLineCallback &o); | - | ||||||
157 | - | |||||||
158 | QQuickTimeLineCallback &operator=(const QQuickTimeLineCallback &o); | - | ||||||
159 | QQuickTimeLineObject *callbackObject() const; | - | ||||||
160 | - | |||||||
161 | private: | - | ||||||
162 | friend struct QQuickTimeLinePrivate; | - | ||||||
163 | Callback d0; | - | ||||||
164 | void *d1; | - | ||||||
165 | QQuickTimeLineObject *d2; | - | ||||||
166 | }; | - | ||||||
167 | - | |||||||
168 | template<class T> | - | ||||||
169 | class QQuickTimeLineValueProxy : public QQuickTimeLineValue | - | ||||||
170 | { | - | ||||||
171 | public: | - | ||||||
172 | QQuickTimeLineValueProxy(T *cls, void (T::*func)(qreal), qreal v = 0.) | - | ||||||
173 | : QQuickTimeLineValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(nullptr) | - | ||||||
174 | { | - | ||||||
175 | Q_ASSERT(_class); | - | ||||||
176 | } executed 8764 times by 18 tests: end of block Executed by:
| 8764 | ||||||
177 | - | |||||||
178 | QQuickTimeLineValueProxy(T *cls, void (T::*func)(int), qreal v = 0.) | - | ||||||
179 | : QQuickTimeLineValue(v), _class(cls), _setFunctionReal(0), _setFunctionInt(func) | - | ||||||
180 | { | - | ||||||
181 | Q_ASSERT(_class); | - | ||||||
182 | } never executed: end of block | 0 | ||||||
183 | - | |||||||
184 | void setValue(qreal v) override | - | ||||||
185 | { | - | ||||||
186 | QQuickTimeLineValue::setValue(v); | - | ||||||
187 | if (_setFunctionReal) (_class->*_setFunctionReal)(v); executed 33038 times by 9 tests: (_class->*_setFunctionReal)(v); Executed by:
| 0-33038 | ||||||
188 | else if (_setFunctionInt) (_class->*_setFunctionInt)((int)v); never executed: (_class->*_setFunctionInt)((int)v);
| 0 | ||||||
189 | } executed 33038 times by 9 tests: end of block Executed by:
| 33038 | ||||||
190 | - | |||||||
191 | private: | - | ||||||
192 | T *_class; | - | ||||||
193 | void (T::*_setFunctionReal)(qreal); | - | ||||||
194 | void (T::*_setFunctionInt)(int); | - | ||||||
195 | }; | - | ||||||
196 | - | |||||||
197 | QT_END_NAMESPACE | - | ||||||
198 | - | |||||||
199 | #endif | - | ||||||
Source code | Switch to Preprocessed file |