| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickcustomaffector_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 CUSTOMAFFECTOR_H | - | ||||||
| 41 | #define CUSTOMAFFECTOR_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 <QObject> | - | ||||||
| 55 | #include "qquickparticlesystem_p.h" | - | ||||||
| 56 | #include "qquickparticleextruder_p.h" | - | ||||||
| 57 | #include "qquickparticleaffector_p.h" | - | ||||||
| 58 | #include "qquickdirection_p.h" | - | ||||||
| 59 | - | |||||||
| 60 | QT_BEGIN_NAMESPACE | - | ||||||
| 61 | - | |||||||
| 62 | class QQuickCustomAffector : public QQuickParticleAffector | - | ||||||
| 63 | { | - | ||||||
| 64 | Q_OBJECT | - | ||||||
| 65 | Q_PROPERTY(bool relative READ relative WRITE setRelative NOTIFY relativeChanged) | - | ||||||
| 66 | Q_PROPERTY(QQuickDirection *position READ position WRITE setPosition NOTIFY positionChanged RESET positionReset) | - | ||||||
| 67 | Q_PROPERTY(QQuickDirection *velocity READ velocity WRITE setVelocity NOTIFY velocityChanged RESET velocityReset) | - | ||||||
| 68 | Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged RESET accelerationReset) | - | ||||||
| 69 | - | |||||||
| 70 | public: | - | ||||||
| 71 | explicit QQuickCustomAffector(QQuickItem *parent = 0); | - | ||||||
| 72 | void affectSystem(qreal dt) override; | - | ||||||
| 73 | - | |||||||
| 74 | QQuickDirection * position() const | - | ||||||
| 75 | { | - | ||||||
| 76 | return m_position; never executed: return m_position; | 0 | ||||||
| 77 | } | - | ||||||
| 78 | - | |||||||
| 79 | QQuickDirection * velocity() const | - | ||||||
| 80 | { | - | ||||||
| 81 | return m_velocity; never executed: return m_velocity; | 0 | ||||||
| 82 | } | - | ||||||
| 83 | - | |||||||
| 84 | QQuickDirection * acceleration() const | - | ||||||
| 85 | { | - | ||||||
| 86 | return m_acceleration; never executed: return m_acceleration; | 0 | ||||||
| 87 | } | - | ||||||
| 88 | - | |||||||
| 89 | void positionReset() | - | ||||||
| 90 | { | - | ||||||
| 91 | m_position = &m_nullVector; | - | ||||||
| 92 | } never executed: end of block | 0 | ||||||
| 93 | - | |||||||
| 94 | void velocityReset() | - | ||||||
| 95 | { | - | ||||||
| 96 | m_velocity = &m_nullVector; | - | ||||||
| 97 | } never executed: end of block | 0 | ||||||
| 98 | - | |||||||
| 99 | void accelerationReset() | - | ||||||
| 100 | { | - | ||||||
| 101 | m_acceleration = &m_nullVector; | - | ||||||
| 102 | } never executed: end of block | 0 | ||||||
| 103 | - | |||||||
| 104 | bool relative() const | - | ||||||
| 105 | { | - | ||||||
| 106 | return m_relative; never executed: return m_relative; | 0 | ||||||
| 107 | } | - | ||||||
| 108 | - | |||||||
| 109 | - | |||||||
| 110 | Q_SIGNALS: | - | ||||||
| 111 | void affectParticles(QQmlV4Handle particles, qreal dt); | - | ||||||
| 112 | - | |||||||
| 113 | void positionChanged(QQuickDirection * arg); | - | ||||||
| 114 | - | |||||||
| 115 | void velocityChanged(QQuickDirection * arg); | - | ||||||
| 116 | - | |||||||
| 117 | void accelerationChanged(QQuickDirection * arg); | - | ||||||
| 118 | - | |||||||
| 119 | void relativeChanged(bool arg); | - | ||||||
| 120 | - | |||||||
| 121 | public Q_SLOTS: | - | ||||||
| 122 | void setPosition(QQuickDirection * arg) | - | ||||||
| 123 | { | - | ||||||
| 124 | if (m_position != arg) {
| 0-6 | ||||||
| 125 | m_position = arg; | - | ||||||
| 126 | Q_EMIT positionChanged(arg); | - | ||||||
| 127 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||
| 128 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||
| 129 | - | |||||||
| 130 | void setVelocity(QQuickDirection * arg) | - | ||||||
| 131 | { | - | ||||||
| 132 | if (m_velocity != arg) {
| 0-4 | ||||||
| 133 | m_velocity = arg; | - | ||||||
| 134 | Q_EMIT velocityChanged(arg); | - | ||||||
| 135 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||
| 136 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||
| 137 | - | |||||||
| 138 | void setAcceleration(QQuickDirection * arg) | - | ||||||
| 139 | { | - | ||||||
| 140 | if (m_acceleration != arg) {
| 0-4 | ||||||
| 141 | m_acceleration = arg; | - | ||||||
| 142 | Q_EMIT accelerationChanged(arg); | - | ||||||
| 143 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||
| 144 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||
| 145 | - | |||||||
| 146 | void setRelative(bool arg) | - | ||||||
| 147 | { | - | ||||||
| 148 | if (m_relative != arg) {
| 0-6 | ||||||
| 149 | m_relative = arg; | - | ||||||
| 150 | Q_EMIT relativeChanged(arg); | - | ||||||
| 151 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||
| 152 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||
| 153 | - | |||||||
| 154 | protected: | - | ||||||
| 155 | bool isAffectConnected(); | - | ||||||
| 156 | bool affectParticle(QQuickParticleData *d, qreal dt) override; | - | ||||||
| 157 | - | |||||||
| 158 | private: | - | ||||||
| 159 | void affectProperties(const QList<QQuickParticleData*> particles, qreal dt); | - | ||||||
| 160 | QQuickDirection * m_position; | - | ||||||
| 161 | QQuickDirection * m_velocity; | - | ||||||
| 162 | QQuickDirection * m_acceleration; | - | ||||||
| 163 | - | |||||||
| 164 | QQuickDirection m_nullVector; | - | ||||||
| 165 | bool m_relative; | - | ||||||
| 166 | }; | - | ||||||
| 167 | - | |||||||
| 168 | QT_END_NAMESPACE | - | ||||||
| 169 | #endif // CUSTOMAFFECTOR_H | - | ||||||
| Source code | Switch to Preprocessed file |