| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | static QThreadStorage<QUnifiedTimer *> *unifiedTimer() { static QGlobalStatic<QThreadStorage<QUnifiedTimer *> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QThreadStorage<QUnifiedTimer *> *x = new QThreadStorage<QUnifiedTimer *>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QThreadStorage<QUnifiedTimer *> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:5540 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:18 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:18 | yes Evaluation Count:5522 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:18 | no Evaluation Count:0 |
| 0-5540 |
| 12 | | - |
| 13 | | - |
| 14 | QUnifiedTimer::QUnifiedTimer() : | - |
| 15 | QObject(), defaultDriver(this), lastTick(0), timingInterval(16), | - |
| 16 | currentAnimationIdx(0), insideTick(false), insideRestart(false), consistentTiming(false), slowMode(false), | - |
| 17 | startTimersPending(false), stopTimerPending(false), | - |
| 18 | slowdownFactor(5.0f), profilerCallback(0) | - |
| 19 | { | - |
| 20 | time.invalidate(); | - |
| 21 | driver = &defaultDriver; | - |
| 22 | } executed: }Execution Count:9 | 9 |
| 23 | | - |
| 24 | | - |
| 25 | QUnifiedTimer *QUnifiedTimer::instance(bool create) | - |
| 26 | { | - |
| 27 | QUnifiedTimer *inst; | - |
| 28 | | - |
| 29 | if (create && !unifiedTimer()->hasLocalData()) { evaluated: create| yes Evaluation Count:1433 | yes Evaluation Count:625 |
evaluated: !unifiedTimer()->hasLocalData()| yes Evaluation Count:9 | yes Evaluation Count:1424 |
| 9-1433 |
| 30 | inst = new QUnifiedTimer; | - |
| 31 | unifiedTimer()->setLocalData(inst); | - |
| 32 | } else { executed: }Execution Count:9 | 9 |
| 33 | inst = unifiedTimer() ? unifiedTimer()->localData() : 0; partially evaluated: unifiedTimer()| yes Evaluation Count:2049 | no Evaluation Count:0 |
| 0-2049 |
| 34 | } executed: }Execution Count:2049 | 2049 |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | return inst; executed: return inst;Execution Count:2058 | 2058 |
| 40 | } | - |
| 41 | | - |
| 42 | QUnifiedTimer *QUnifiedTimer::instance() | - |
| 43 | { | - |
| 44 | return instance(true); executed: return instance(true);Execution Count:1353 | 1353 |
| 45 | } | - |
| 46 | | - |
| 47 | void QUnifiedTimer::maybeUpdateAnimationsToCurrentTime() | - |
| 48 | { | - |
| 49 | if (time.elapsed() - lastTick > 50) evaluated: time.elapsed() - lastTick > 50| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 50 | updateAnimationTimers(driver->elapsed()); executed: updateAnimationTimers(driver->elapsed());Execution Count:1 | 1 |
| 51 | } executed: }Execution Count:2 | 2 |
| 52 | | - |
| 53 | void QUnifiedTimer::updateAnimationTimers(qint64 currentTick) | - |
| 54 | { | - |
| 55 | | - |
| 56 | if(insideTick) partially evaluated: insideTick| no Evaluation Count:0 | yes Evaluation Count:1323 |
| 0-1323 |
| 57 | return; | 0 |
| 58 | | - |
| 59 | qint64 totalElapsed = currentTick >= 0 ? currentTick : time.elapsed(); evaluated: currentTick >= 0| yes Evaluation Count:1 | yes Evaluation Count:1322 |
| 1-1322 |
| 60 | | - |
| 61 | | - |
| 62 | qint64 delta = (consistentTiming && !pauseTimer.isActive()) ? evaluated: consistentTiming| yes Evaluation Count:97 | yes Evaluation Count:1226 |
evaluated: !pauseTimer.isActive()| yes Evaluation Count:79 | yes Evaluation Count:18 |
| 18-1226 |
| 63 | timingInterval : totalElapsed - lastTick; | - |
| 64 | if (slowMode) { partially evaluated: slowMode| no Evaluation Count:0 | yes Evaluation Count:1323 |
| 0-1323 |
| 65 | if (slowdownFactor > 0) never evaluated: slowdownFactor > 0 | 0 |
| 66 | delta = qRound(delta / slowdownFactor); never executed: delta = qRound(delta / slowdownFactor); | 0 |
| 67 | else | - |
| 68 | delta = 0; never executed: delta = 0; | 0 |
| 69 | } | - |
| 70 | | - |
| 71 | lastTick = totalElapsed; | - |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | if (delta) { evaluated: delta| yes Evaluation Count:1322 | yes Evaluation Count:1 |
| 1-1322 |
| 77 | insideTick = true; | - |
| 78 | if (profilerCallback) partially evaluated: profilerCallback| no Evaluation Count:0 | yes Evaluation Count:1322 |
| 0-1322 |
| 79 | profilerCallback(delta); never executed: profilerCallback(delta); | 0 |
| 80 | for (currentAnimationIdx = 0; currentAnimationIdx < animationTimers.count(); ++currentAnimationIdx) { evaluated: currentAnimationIdx < animationTimers.count()| yes Evaluation Count:1316 | yes Evaluation Count:1322 |
| 1316-1322 |
| 81 | QAbstractAnimationTimer *animation = animationTimers.at(currentAnimationIdx); | - |
| 82 | animation->updateAnimationsTime(delta); | - |
| 83 | } executed: }Execution Count:1316 | 1316 |
| 84 | insideTick = false; | - |
| 85 | currentAnimationIdx = 0; | - |
| 86 | } executed: }Execution Count:1322 | 1322 |
| 87 | } executed: }Execution Count:1323 | 1323 |
| 88 | | - |
| 89 | int QUnifiedTimer::runningAnimationCount() | - |
| 90 | { | - |
| 91 | int count = 0; | - |
| 92 | for (int i = 0; i < animationTimers.count(); ++i) never evaluated: i < animationTimers.count() | 0 |
| 93 | count += animationTimers.at(i)->runningAnimationCount(); never executed: count += animationTimers.at(i)->runningAnimationCount(); | 0 |
| 94 | return count; never executed: return count; | 0 |
| 95 | } | - |
| 96 | | - |
| 97 | void QUnifiedTimer::registerProfilerCallback(void (*cb)(qint64)) | - |
| 98 | { | - |
| 99 | profilerCallback = cb; | - |
| 100 | } | 0 |
| 101 | | - |
| 102 | void QUnifiedTimer::localRestart() | - |
| 103 | { | - |
| 104 | if (insideRestart) evaluated: insideRestart| yes Evaluation Count:21 | yes Evaluation Count:1412 |
| 21-1412 |
| 105 | return; executed: return;Execution Count:21 | 21 |
| 106 | | - |
| 107 | if (!pausedAnimationTimers.isEmpty() && (animationTimers.count() + animationTimersToStart.count() == pausedAnimationTimers.count())) { evaluated: !pausedAnimationTimers.isEmpty()| yes Evaluation Count:32 | yes Evaluation Count:1380 |
partially evaluated: (animationTimers.count() + animationTimersToStart.count() == pausedAnimationTimers.count())| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-1380 |
| 108 | driver->stop(); | - |
| 109 | int closestTimeToFinish = closestPausedAnimationTimerTimeToFinish(); | - |
| 110 | | - |
| 111 | Qt::TimerType timerType = closestTimeToFinish < 2000 ? Qt::PreciseTimer : Qt::CoarseTimer; partially evaluated: closestTimeToFinish < 2000| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
| 112 | pauseTimer.start(closestTimeToFinish, timerType, this); | - |
| 113 | } else if (!driver->isRunning()) { evaluated: !driver->isRunning()| yes Evaluation Count:82 | yes Evaluation Count:1298 |
executed: }Execution Count:32 | 32-1298 |
| 114 | if (pauseTimer.isActive()) evaluated: pauseTimer.isActive()| yes Evaluation Count:12 | yes Evaluation Count:70 |
| 12-70 |
| 115 | pauseTimer.stop(); executed: pauseTimer.stop();Execution Count:12 | 12 |
| 116 | driver->setStartTime(time.isValid() ? time.elapsed() : 0); | - |
| 117 | driver->start(); | - |
| 118 | } executed: }Execution Count:82 | 82 |
| 119 | | - |
| 120 | } | - |
| 121 | | - |
| 122 | void QUnifiedTimer::restart() | - |
| 123 | { | - |
| 124 | insideRestart = true; | - |
| 125 | for (int i = 0; i < animationTimers.count(); ++i) evaluated: i < animationTimers.count()| yes Evaluation Count:1313 | yes Evaluation Count:1319 |
| 1313-1319 |
| 126 | animationTimers.at(i)->restartAnimationTimer(); executed: animationTimers.at(i)->restartAnimationTimer();Execution Count:1313 | 1313 |
| 127 | insideRestart = false; | - |
| 128 | | - |
| 129 | localRestart(); | - |
| 130 | } executed: }Execution Count:1319 | 1319 |
| 131 | | - |
| 132 | void QUnifiedTimer::setTimingInterval(int interval) | - |
| 133 | { | - |
| 134 | timingInterval = interval; | - |
| 135 | | - |
| 136 | if (driver->isRunning() && !pauseTimer.isActive()) { never evaluated: driver->isRunning() never evaluated: !pauseTimer.isActive() | 0 |
| 137 | | - |
| 138 | driver->stop(); | - |
| 139 | driver->setStartTime(time.isValid() ? time.elapsed() : 0); | - |
| 140 | driver->start(); | - |
| 141 | } | 0 |
| 142 | } | 0 |
| 143 | | - |
| 144 | void QUnifiedTimer::startTimers() | - |
| 145 | { | - |
| 146 | startTimersPending = false; | - |
| 147 | if (!animationTimers.isEmpty()) partially evaluated: !animationTimers.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:80 |
| 0-80 |
| 148 | updateAnimationTimers(-1); never executed: updateAnimationTimers(-1); | 0 |
| 149 | | - |
| 150 | | - |
| 151 | animationTimers += animationTimersToStart; | - |
| 152 | animationTimersToStart.clear(); | - |
| 153 | if (!animationTimers.isEmpty()) { partially evaluated: !animationTimers.isEmpty()| yes Evaluation Count:80 | no Evaluation Count:0 |
| 0-80 |
| 154 | localRestart(); | - |
| 155 | if (!time.isValid()) { partially evaluated: !time.isValid()| yes Evaluation Count:80 | no Evaluation Count:0 |
| 0-80 |
| 156 | lastTick = 0; | - |
| 157 | time.start(); | - |
| 158 | } executed: }Execution Count:80 | 80 |
| 159 | } executed: }Execution Count:80 | 80 |
| 160 | } executed: }Execution Count:80 | 80 |
| 161 | | - |
| 162 | void QUnifiedTimer::stopTimer() | - |
| 163 | { | - |
| 164 | stopTimerPending = false; | - |
| 165 | if (animationTimers.isEmpty()) { partially evaluated: animationTimers.isEmpty()| yes Evaluation Count:77 | no Evaluation Count:0 |
| 0-77 |
| 166 | driver->stop(); | - |
| 167 | pauseTimer.stop(); | - |
| 168 | | - |
| 169 | time.invalidate(); | - |
| 170 | } executed: }Execution Count:77 | 77 |
| 171 | } executed: }Execution Count:77 | 77 |
| 172 | | - |
| 173 | void QUnifiedTimer::timerEvent(QTimerEvent *event) | - |
| 174 | { | - |
| 175 | | - |
| 176 | | - |
| 177 | if (consistentTiming) { evaluated: consistentTiming| yes Evaluation Count:16 | yes Evaluation Count:3 |
| 3-16 |
| 178 | if (stopTimerPending) partially evaluated: stopTimerPending| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 179 | stopTimer(); never executed: stopTimer(); | 0 |
| 180 | if (startTimersPending) partially evaluated: startTimersPending| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 181 | startTimers(); never executed: startTimers(); | 0 |
| 182 | } executed: }Execution Count:16 | 16 |
| 183 | | - |
| 184 | if (event->timerId() == pauseTimer.timerId()) { partially evaluated: event->timerId() == pauseTimer.timerId()| yes Evaluation Count:19 | no Evaluation Count:0 |
| 0-19 |
| 185 | | - |
| 186 | updateAnimationTimers(-1); | - |
| 187 | restart(); | - |
| 188 | } executed: }Execution Count:19 | 19 |
| 189 | } executed: }Execution Count:19 | 19 |
| 190 | | - |
| 191 | void QUnifiedTimer::startAnimationTimer(QAbstractAnimationTimer *timer) | - |
| 192 | { | - |
| 193 | if (timer->isRegistered) partially evaluated: timer->isRegistered| no Evaluation Count:0 | yes Evaluation Count:80 |
| 0-80 |
| 194 | return; | 0 |
| 195 | timer->isRegistered = true; | - |
| 196 | | - |
| 197 | QUnifiedTimer *inst = instance(true); | - |
| 198 | inst->animationTimersToStart << timer; | - |
| 199 | if (!inst->startTimersPending) { partially evaluated: !inst->startTimersPending| yes Evaluation Count:80 | no Evaluation Count:0 |
| 0-80 |
| 200 | inst->startTimersPending = true; | - |
| 201 | QMetaObject::invokeMethod(inst, "startTimers", Qt::QueuedConnection); | - |
| 202 | } executed: }Execution Count:80 | 80 |
| 203 | } executed: }Execution Count:80 | 80 |
| 204 | | - |
| 205 | void QUnifiedTimer::stopAnimationTimer(QAbstractAnimationTimer *timer) | - |
| 206 | { | - |
| 207 | QUnifiedTimer *inst = QUnifiedTimer::instance(false); | - |
| 208 | if (inst) { partially evaluated: inst| yes Evaluation Count:77 | no Evaluation Count:0 |
| 0-77 |
| 209 | | - |
| 210 | | - |
| 211 | | - |
| 212 | if (!timer->isRegistered) partially evaluated: !timer->isRegistered| no Evaluation Count:0 | yes Evaluation Count:77 |
| 0-77 |
| 213 | return; | 0 |
| 214 | timer->isRegistered = false; | - |
| 215 | | - |
| 216 | int idx = inst->animationTimers.indexOf(timer); | - |
| 217 | if (idx != -1) { partially evaluated: idx != -1| yes Evaluation Count:77 | no Evaluation Count:0 |
| 0-77 |
| 218 | inst->animationTimers.removeAt(idx); | - |
| 219 | | - |
| 220 | if (idx <= inst->currentAnimationIdx) evaluated: idx <= inst->currentAnimationIdx| yes Evaluation Count:76 | yes Evaluation Count:1 |
| 1-76 |
| 221 | --inst->currentAnimationIdx; executed: --inst->currentAnimationIdx;Execution Count:76 | 76 |
| 222 | | - |
| 223 | if (inst->animationTimers.isEmpty() && !inst->stopTimerPending) { partially evaluated: inst->animationTimers.isEmpty()| yes Evaluation Count:77 | no Evaluation Count:0 |
partially evaluated: !inst->stopTimerPending| yes Evaluation Count:77 | no Evaluation Count:0 |
| 0-77 |
| 224 | inst->stopTimerPending = true; | - |
| 225 | QMetaObject::invokeMethod(inst, "stopTimer", Qt::QueuedConnection); | - |
| 226 | } executed: }Execution Count:77 | 77 |
| 227 | } else { executed: }Execution Count:77 | 77 |
| 228 | inst->animationTimersToStart.removeOne(timer); | - |
| 229 | } | 0 |
| 230 | } | - |
| 231 | } executed: }Execution Count:77 | 77 |
| 232 | | - |
| 233 | void QUnifiedTimer::pauseAnimationTimer(QAbstractAnimationTimer *timer, int duration) | - |
| 234 | { | - |
| 235 | QUnifiedTimer *inst = QUnifiedTimer::instance(); | - |
| 236 | if (!timer->isRegistered) evaluated: !timer->isRegistered| yes Evaluation Count:10 | yes Evaluation Count:12 |
| 10-12 |
| 237 | inst->startAnimationTimer(timer); executed: inst->startAnimationTimer(timer);Execution Count:10 | 10 |
| 238 | | - |
| 239 | bool timerWasPaused = timer->isPaused; | - |
| 240 | timer->isPaused = true; | - |
| 241 | timer->pauseDuration = duration; | - |
| 242 | if (!timerWasPaused) evaluated: !timerWasPaused| yes Evaluation Count:12 | yes Evaluation Count:10 |
| 10-12 |
| 243 | inst->pausedAnimationTimers << timer; executed: inst->pausedAnimationTimers << timer;Execution Count:12 | 12 |
| 244 | inst->localRestart(); | - |
| 245 | } executed: }Execution Count:22 | 22 |
| 246 | | - |
| 247 | void QUnifiedTimer::resumeAnimationTimer(QAbstractAnimationTimer *timer) | - |
| 248 | { | - |
| 249 | if (!timer->isPaused) evaluated: !timer->isPaused| yes Evaluation Count:76 | yes Evaluation Count:12 |
| 12-76 |
| 250 | return; executed: return;Execution Count:76 | 76 |
| 251 | | - |
| 252 | timer->isPaused = false; | - |
| 253 | QUnifiedTimer *inst = QUnifiedTimer::instance(); | - |
| 254 | inst->pausedAnimationTimers.removeOne(timer); | - |
| 255 | inst->localRestart(); | - |
| 256 | } executed: }Execution Count:12 | 12 |
| 257 | | - |
| 258 | int QUnifiedTimer::closestPausedAnimationTimerTimeToFinish() | - |
| 259 | { | - |
| 260 | int closestTimeToFinish = 2147483647; | - |
| 261 | for (int i = 0; i < pausedAnimationTimers.size(); ++i) { evaluated: i < pausedAnimationTimers.size()| yes Evaluation Count:32 | yes Evaluation Count:32 |
| 32 |
| 262 | int timeToFinish = pausedAnimationTimers.at(i)->pauseDuration; | - |
| 263 | if (timeToFinish < closestTimeToFinish) partially evaluated: timeToFinish < closestTimeToFinish| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
| 264 | closestTimeToFinish = timeToFinish; executed: closestTimeToFinish = timeToFinish;Execution Count:32 | 32 |
| 265 | } executed: }Execution Count:32 | 32 |
| 266 | return closestTimeToFinish; executed: return closestTimeToFinish;Execution Count:32 | 32 |
| 267 | } | - |
| 268 | | - |
| 269 | void QUnifiedTimer::installAnimationDriver(QAnimationDriver *d) | - |
| 270 | { | - |
| 271 | if (driver != &defaultDriver) { never evaluated: driver != &defaultDriver | 0 |
| 272 | QMessageLogger("animation/qabstractanimation.cpp", 479, __PRETTY_FUNCTION__).warning("QUnifiedTimer: animation driver already installed..."); | - |
| 273 | return; | 0 |
| 274 | } | - |
| 275 | | - |
| 276 | if (driver->isRunning()) { never evaluated: driver->isRunning() | 0 |
| 277 | driver->stop(); | - |
| 278 | d->setStartTime(time.isValid() ? time.elapsed() : 0); | - |
| 279 | d->start(); | - |
| 280 | } | 0 |
| 281 | | - |
| 282 | driver = d; | - |
| 283 | | - |
| 284 | } | 0 |
| 285 | | - |
| 286 | void QUnifiedTimer::uninstallAnimationDriver(QAnimationDriver *d) | - |
| 287 | { | - |
| 288 | if (driver != d) { never evaluated: driver != d | 0 |
| 289 | QMessageLogger("animation/qabstractanimation.cpp", 496, __PRETTY_FUNCTION__).warning("QUnifiedTimer: trying to uninstall a driver that is not installed..."); | - |
| 290 | return; | 0 |
| 291 | } | - |
| 292 | | - |
| 293 | driver = &defaultDriver; | - |
| 294 | | - |
| 295 | if (d->isRunning()) { never evaluated: d->isRunning() | 0 |
| 296 | d->stop(); | - |
| 297 | driver->setStartTime(time.isValid() ? time.elapsed() : 0); | - |
| 298 | driver->start(); | - |
| 299 | } | 0 |
| 300 | } | 0 |
| 301 | | - |
| 302 | | - |
| 303 | | - |
| 304 | | - |
| 305 | | - |
| 306 | bool QUnifiedTimer::canUninstallAnimationDriver(QAnimationDriver *d) | - |
| 307 | { | - |
| 308 | return d == driver && driver != &defaultDriver; never executed: return d == driver && driver != &defaultDriver; | 0 |
| 309 | } | - |
| 310 | | - |
| 311 | | - |
| 312 | static QThreadStorage<QAnimationTimer *> *animationTimer() { static QGlobalStatic<QThreadStorage<QAnimationTimer *> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QThreadStorage<QAnimationTimer *> *x = new QThreadStorage<QAnimationTimer *>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QThreadStorage<QAnimationTimer *> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:18 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:18 | yes Evaluation Count:5682 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:18 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:5700 | 0-5700 |
| 313 | | - |
| 314 | | - |
| 315 | QAnimationTimer::QAnimationTimer() : | - |
| 316 | QAbstractAnimationTimer(), lastTick(0), | - |
| 317 | currentAnimationIdx(0), insideTick(false), | - |
| 318 | startAnimationPending(false), stopTimerPending(false), | - |
| 319 | runningLeafAnimations(0) | - |
| 320 | { | - |
| 321 | } executed: }Execution Count:18 | 18 |
| 322 | | - |
| 323 | QAnimationTimer *QAnimationTimer::instance(bool create) | - |
| 324 | { | - |
| 325 | QAnimationTimer *inst; | - |
| 326 | | - |
| 327 | if (create && !animationTimer()->hasLocalData()) { evaluated: create| yes Evaluation Count:924 | yes Evaluation Count:1473 |
evaluated: !animationTimer()->hasLocalData()| yes Evaluation Count:18 | yes Evaluation Count:906 |
| 18-1473 |
| 328 | inst = new QAnimationTimer; | - |
| 329 | animationTimer()->setLocalData(inst); | - |
| 330 | } else { executed: }Execution Count:18 | 18 |
| 331 | inst = animationTimer() ? animationTimer()->localData() : 0; partially evaluated: animationTimer()| yes Evaluation Count:2379 | no Evaluation Count:0 |
| 0-2379 |
| 332 | } executed: }Execution Count:2379 | 2379 |
| 333 | | - |
| 334 | | - |
| 335 | | - |
| 336 | | - |
| 337 | return inst; executed: return inst;Execution Count:2397 | 2397 |
| 338 | } | - |
| 339 | | - |
| 340 | QAnimationTimer *QAnimationTimer::instance() | - |
| 341 | { | - |
| 342 | return instance(true); never executed: return instance(true); | 0 |
| 343 | } | - |
| 344 | | - |
| 345 | void QAnimationTimer::ensureTimerUpdate() | - |
| 346 | { | - |
| 347 | QAnimationTimer *inst = QAnimationTimer::instance(false); | - |
| 348 | QUnifiedTimer *instU = QUnifiedTimer::instance(false); | - |
| 349 | if (instU && inst && inst->isPaused) evaluated: instU| yes Evaluation Count:231 | yes Evaluation Count:308 |
partially evaluated: inst| yes Evaluation Count:231 | no Evaluation Count:0 |
evaluated: inst->isPaused| yes Evaluation Count:3 | yes Evaluation Count:228 |
| 0-308 |
| 350 | instU->updateAnimationTimers(-1); executed: instU->updateAnimationTimers(-1);Execution Count:3 | 3 |
| 351 | } executed: }Execution Count:539 | 539 |
| 352 | | - |
| 353 | void QAnimationTimer::updateAnimationsTime(qint64 delta) | - |
| 354 | { | - |
| 355 | | - |
| 356 | if (insideTick) partially evaluated: insideTick| no Evaluation Count:0 | yes Evaluation Count:1316 |
| 0-1316 |
| 357 | return; | 0 |
| 358 | | - |
| 359 | lastTick += delta; | - |
| 360 | | - |
| 361 | | - |
| 362 | | - |
| 363 | | - |
| 364 | if (delta) { partially evaluated: delta| yes Evaluation Count:1316 | no Evaluation Count:0 |
| 0-1316 |
| 365 | insideTick = true; | - |
| 366 | for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { evaluated: currentAnimationIdx < animations.count()| yes Evaluation Count:1501 | yes Evaluation Count:1316 |
| 1316-1501 |
| 367 | QAbstractAnimation *animation = animations.at(currentAnimationIdx); | - |
| 368 | int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime | - |
| 369 | + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); evaluated: animation->direction() == QAbstractAnimation::Forward| yes Evaluation Count:1446 | yes Evaluation Count:55 |
| 55-1446 |
| 370 | animation->setCurrentTime(elapsed); | - |
| 371 | } executed: }Execution Count:1501 | 1501 |
| 372 | insideTick = false; | - |
| 373 | currentAnimationIdx = 0; | - |
| 374 | } executed: }Execution Count:1316 | 1316 |
| 375 | } executed: }Execution Count:1316 | 1316 |
| 376 | | - |
| 377 | void QAnimationTimer::updateAnimationTimer() | - |
| 378 | { | - |
| 379 | QAnimationTimer *inst = QAnimationTimer::instance(false); | - |
| 380 | if (inst) partially evaluated: inst| yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
| 381 | inst->restartAnimationTimer(); executed: inst->restartAnimationTimer();Execution Count:10 | 10 |
| 382 | } executed: }Execution Count:10 | 10 |
| 383 | | - |
| 384 | void QAnimationTimer::restartAnimationTimer() | - |
| 385 | { | - |
| 386 | if (runningLeafAnimations == 0 && !runningPauseAnimations.isEmpty()) evaluated: runningLeafAnimations == 0| yes Evaluation Count:78 | yes Evaluation Count:1328 |
evaluated: !runningPauseAnimations.isEmpty()| yes Evaluation Count:22 | yes Evaluation Count:56 |
| 22-1328 |
| 387 | QUnifiedTimer::pauseAnimationTimer(this, closestPauseAnimationTimeToFinish()); executed: QUnifiedTimer::pauseAnimationTimer(this, closestPauseAnimationTimeToFinish());Execution Count:22 | 22 |
| 388 | else if (isPaused) evaluated: isPaused| yes Evaluation Count:11 | yes Evaluation Count:1373 |
| 11-1373 |
| 389 | QUnifiedTimer::resumeAnimationTimer(this); executed: QUnifiedTimer::resumeAnimationTimer(this);Execution Count:11 | 11 |
| 390 | else if (!isRegistered) evaluated: !isRegistered| yes Evaluation Count:70 | yes Evaluation Count:1303 |
| 70-1303 |
| 391 | QUnifiedTimer::startAnimationTimer(this); executed: QUnifiedTimer::startAnimationTimer(this);Execution Count:70 | 70 |
| 392 | } | - |
| 393 | | - |
| 394 | void QAnimationTimer::startAnimations() | - |
| 395 | { | - |
| 396 | startAnimationPending = false; | - |
| 397 | | - |
| 398 | if (!animations.isEmpty()) evaluated: !animations.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:206 |
| 2-206 |
| 399 | QUnifiedTimer::instance()->maybeUpdateAnimationsToCurrentTime(); executed: QUnifiedTimer::instance()->maybeUpdateAnimationsToCurrentTime();Execution Count:2 | 2 |
| 400 | | - |
| 401 | | - |
| 402 | animations += animationsToStart; | - |
| 403 | animationsToStart.clear(); | - |
| 404 | if (!animations.isEmpty()) evaluated: !animations.isEmpty()| yes Evaluation Count:83 | yes Evaluation Count:125 |
| 83-125 |
| 405 | restartAnimationTimer(); executed: restartAnimationTimer();Execution Count:83 | 83 |
| 406 | } executed: }Execution Count:208 | 208 |
| 407 | | - |
| 408 | void QAnimationTimer::stopTimer() | - |
| 409 | { | - |
| 410 | stopTimerPending = false; | - |
| 411 | if (animations.isEmpty()) { evaluated: animations.isEmpty()| yes Evaluation Count:77 | yes Evaluation Count:1 |
| 1-77 |
| 412 | QUnifiedTimer::resumeAnimationTimer(this); | - |
| 413 | QUnifiedTimer::stopAnimationTimer(this); | - |
| 414 | | - |
| 415 | lastTick = 0; | - |
| 416 | } executed: }Execution Count:77 | 77 |
| 417 | } executed: }Execution Count:78 | 78 |
| 418 | | - |
| 419 | void QAnimationTimer::registerAnimation(QAbstractAnimation *animation, bool isTopLevel) | - |
| 420 | { | - |
| 421 | QAnimationTimer *inst = instance(true); | - |
| 422 | inst->registerRunningAnimation(animation); | - |
| 423 | if (isTopLevel) { evaluated: isTopLevel| yes Evaluation Count:507 | yes Evaluation Count:417 |
| 417-507 |
| 424 | qt_noop(); | - |
| 425 | QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true; | - |
| 426 | inst->animationsToStart << animation; | - |
| 427 | if (!inst->startAnimationPending) { evaluated: !inst->startAnimationPending| yes Evaluation Count:211 | yes Evaluation Count:296 |
| 211-296 |
| 428 | inst->startAnimationPending = true; | - |
| 429 | QMetaObject::invokeMethod(inst, "startAnimations", Qt::QueuedConnection); | - |
| 430 | } executed: }Execution Count:211 | 211 |
| 431 | } executed: }Execution Count:507 | 507 |
| 432 | } executed: }Execution Count:924 | 924 |
| 433 | | - |
| 434 | void QAnimationTimer::unregisterAnimation(QAbstractAnimation *animation) | - |
| 435 | { | - |
| 436 | QAnimationTimer *inst = QAnimationTimer::instance(false); | - |
| 437 | if (inst) { partially evaluated: inst| yes Evaluation Count:924 | no Evaluation Count:0 |
| 0-924 |
| 438 | | - |
| 439 | | - |
| 440 | | - |
| 441 | inst->unregisterRunningAnimation(animation); | - |
| 442 | | - |
| 443 | if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer) evaluated: !QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer| yes Evaluation Count:417 | yes Evaluation Count:507 |
| 417-507 |
| 444 | return; executed: return;Execution Count:417 | 417 |
| 445 | | - |
| 446 | int idx = inst->animations.indexOf(animation); | - |
| 447 | if (idx != -1) { evaluated: idx != -1| yes Evaluation Count:97 | yes Evaluation Count:410 |
| 97-410 |
| 448 | inst->animations.removeAt(idx); | - |
| 449 | | - |
| 450 | if (idx <= inst->currentAnimationIdx) evaluated: idx <= inst->currentAnimationIdx| yes Evaluation Count:88 | yes Evaluation Count:9 |
| 9-88 |
| 451 | --inst->currentAnimationIdx; executed: --inst->currentAnimationIdx;Execution Count:88 | 88 |
| 452 | | - |
| 453 | if (inst->animations.isEmpty() && !inst->stopTimerPending) { evaluated: inst->animations.isEmpty()| yes Evaluation Count:81 | yes Evaluation Count:16 |
partially evaluated: !inst->stopTimerPending| yes Evaluation Count:81 | no Evaluation Count:0 |
| 0-81 |
| 454 | inst->stopTimerPending = true; | - |
| 455 | QMetaObject::invokeMethod(inst, "stopTimer", Qt::QueuedConnection); | - |
| 456 | } executed: }Execution Count:81 | 81 |
| 457 | } else { executed: }Execution Count:97 | 97 |
| 458 | inst->animationsToStart.removeOne(animation); | - |
| 459 | } executed: }Execution Count:410 | 410 |
| 460 | } | - |
| 461 | QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = false; | - |
| 462 | } executed: }Execution Count:507 | 507 |
| 463 | | - |
| 464 | void QAnimationTimer::registerRunningAnimation(QAbstractAnimation *animation) | - |
| 465 | { | - |
| 466 | if (QAbstractAnimationPrivate::get(animation)->isGroup) evaluated: QAbstractAnimationPrivate::get(animation)->isGroup| yes Evaluation Count:112 | yes Evaluation Count:812 |
| 112-812 |
| 467 | return; executed: return;Execution Count:112 | 112 |
| 468 | | - |
| 469 | if (QAbstractAnimationPrivate::get(animation)->isPause) { evaluated: QAbstractAnimationPrivate::get(animation)->isPause| yes Evaluation Count:27 | yes Evaluation Count:785 |
| 27-785 |
| 470 | runningPauseAnimations << animation; | - |
| 471 | } else executed: }Execution Count:27 | 27 |
| 472 | runningLeafAnimations++; executed: runningLeafAnimations++;Execution Count:785 | 785 |
| 473 | } | - |
| 474 | | - |
| 475 | void QAnimationTimer::unregisterRunningAnimation(QAbstractAnimation *animation) | - |
| 476 | { | - |
| 477 | if (QAbstractAnimationPrivate::get(animation)->isGroup) evaluated: QAbstractAnimationPrivate::get(animation)->isGroup| yes Evaluation Count:112 | yes Evaluation Count:812 |
| 112-812 |
| 478 | return; executed: return;Execution Count:112 | 112 |
| 479 | | - |
| 480 | if (QAbstractAnimationPrivate::get(animation)->isPause) evaluated: QAbstractAnimationPrivate::get(animation)->isPause| yes Evaluation Count:27 | yes Evaluation Count:785 |
| 27-785 |
| 481 | runningPauseAnimations.removeOne(animation); executed: runningPauseAnimations.removeOne(animation);Execution Count:27 | 27 |
| 482 | else | - |
| 483 | runningLeafAnimations--; executed: runningLeafAnimations--;Execution Count:785 | 785 |
| 484 | qt_noop(); | - |
| 485 | } executed: }Execution Count:812 | 812 |
| 486 | | - |
| 487 | int QAnimationTimer::closestPauseAnimationTimeToFinish() | - |
| 488 | { | - |
| 489 | int closestTimeToFinish = 2147483647; | - |
| 490 | for (int i = 0; i < runningPauseAnimations.size(); ++i) { evaluated: i < runningPauseAnimations.size()| yes Evaluation Count:39 | yes Evaluation Count:22 |
| 22-39 |
| 491 | QAbstractAnimation *animation = runningPauseAnimations.at(i); | - |
| 492 | int timeToFinish; | - |
| 493 | | - |
| 494 | if (animation->direction() == QAbstractAnimation::Forward) evaluated: animation->direction() == QAbstractAnimation::Forward| yes Evaluation Count:38 | yes Evaluation Count:1 |
| 1-38 |
| 495 | timeToFinish = animation->duration() - animation->currentLoopTime(); executed: timeToFinish = animation->duration() - animation->currentLoopTime();Execution Count:38 | 38 |
| 496 | else | - |
| 497 | timeToFinish = animation->currentLoopTime(); executed: timeToFinish = animation->currentLoopTime();Execution Count:1 | 1 |
| 498 | | - |
| 499 | if (timeToFinish < closestTimeToFinish) evaluated: timeToFinish < closestTimeToFinish| yes Evaluation Count:26 | yes Evaluation Count:13 |
| 13-26 |
| 500 | closestTimeToFinish = timeToFinish; executed: closestTimeToFinish = timeToFinish;Execution Count:26 | 26 |
| 501 | } executed: }Execution Count:39 | 39 |
| 502 | return closestTimeToFinish; executed: return closestTimeToFinish;Execution Count:22 | 22 |
| 503 | } | - |
| 504 | QAnimationDriver::QAnimationDriver(QObject *parent) | - |
| 505 | : QObject(*(new QAnimationDriverPrivate), parent) | - |
| 506 | { | - |
| 507 | } executed: }Execution Count:9 | 9 |
| 508 | | - |
| 509 | QAnimationDriver::QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent) | - |
| 510 | : QObject(dd, parent) | - |
| 511 | { | - |
| 512 | } | 0 |
| 513 | | - |
| 514 | QAnimationDriver::~QAnimationDriver() | - |
| 515 | { | - |
| 516 | QUnifiedTimer *timer = QUnifiedTimer::instance(false); | - |
| 517 | if (timer && timer->canUninstallAnimationDriver(this)) partially evaluated: timer| no Evaluation Count:0 | yes Evaluation Count:9 |
never evaluated: timer->canUninstallAnimationDriver(this) | 0-9 |
| 518 | uninstall(); never executed: uninstall(); | 0 |
| 519 | } executed: }Execution Count:9 | 9 |
| 520 | void QAnimationDriver::setStartTime(qint64 startTime) | - |
| 521 | { | - |
| 522 | QAnimationDriverPrivate * const d = d_func(); | - |
| 523 | d->startTime = startTime; | - |
| 524 | } executed: }Execution Count:82 | 82 |
| 525 | | - |
| 526 | | - |
| 527 | | - |
| 528 | | - |
| 529 | qint64 QAnimationDriver::startTime() const | - |
| 530 | { | - |
| 531 | const QAnimationDriverPrivate * const d = d_func(); | - |
| 532 | return d->startTime; never executed: return d->startTime; | 0 |
| 533 | } | - |
| 534 | void QAnimationDriver::advanceAnimation(qint64 timeStep) | - |
| 535 | { | - |
| 536 | QUnifiedTimer *instance = QUnifiedTimer::instance(); | - |
| 537 | | - |
| 538 | | - |
| 539 | instance->updateAnimationTimers(timeStep); | - |
| 540 | instance->restart(); | - |
| 541 | } executed: }Execution Count:1300 | 1300 |
| 542 | void QAnimationDriver::advance() | - |
| 543 | { | - |
| 544 | advanceAnimation(-1); | - |
| 545 | } executed: }Execution Count:1300 | 1300 |
| 546 | void QAnimationDriver::install() | - |
| 547 | { | - |
| 548 | QUnifiedTimer *timer = QUnifiedTimer::instance(true); | - |
| 549 | timer->installAnimationDriver(this); | - |
| 550 | } | 0 |
| 551 | | - |
| 552 | | - |
| 553 | | - |
| 554 | | - |
| 555 | | - |
| 556 | | - |
| 557 | | - |
| 558 | void QAnimationDriver::uninstall() | - |
| 559 | { | - |
| 560 | QUnifiedTimer *timer = QUnifiedTimer::instance(true); | - |
| 561 | timer->uninstallAnimationDriver(this); | - |
| 562 | } | 0 |
| 563 | | - |
| 564 | bool QAnimationDriver::isRunning() const | - |
| 565 | { | - |
| 566 | return d_func()->running; executed: return d_func()->running;Execution Count:1380 | 1380 |
| 567 | } | - |
| 568 | | - |
| 569 | | - |
| 570 | void QAnimationDriver::start() | - |
| 571 | { | - |
| 572 | QAnimationDriverPrivate * const d = d_func(); | - |
| 573 | if (!d->running) { partially evaluated: !d->running| yes Evaluation Count:82 | no Evaluation Count:0 |
| 0-82 |
| 574 | started(); | - |
| 575 | d->running = true; | - |
| 576 | } executed: }Execution Count:82 | 82 |
| 577 | } executed: }Execution Count:82 | 82 |
| 578 | | - |
| 579 | | - |
| 580 | void QAnimationDriver::stop() | - |
| 581 | { | - |
| 582 | QAnimationDriverPrivate * const d = d_func(); | - |
| 583 | if (d->running) { evaluated: d->running| yes Evaluation Count:79 | yes Evaluation Count:30 |
| 30-79 |
| 584 | stopped(); | - |
| 585 | d->running = false; | - |
| 586 | } executed: }Execution Count:79 | 79 |
| 587 | } executed: }Execution Count:109 | 109 |
| 588 | qint64 QAnimationDriver::elapsed() const | - |
| 589 | { | - |
| 590 | | - |
| 591 | | - |
| 592 | return QUnifiedTimer::instance()->time.elapsed(); executed: return QUnifiedTimer::instance()->time.elapsed();Execution Count:1 | 1 |
| 593 | } | - |
| 594 | QDefaultAnimationDriver::QDefaultAnimationDriver(QUnifiedTimer *timer) | - |
| 595 | : QAnimationDriver(0), m_unified_timer(timer) | - |
| 596 | { | - |
| 597 | connect(this, "2""started()", this, "1""startTimer()"); | - |
| 598 | connect(this, "2""stopped()", this, "1""stopTimer()"); | - |
| 599 | } executed: }Execution Count:9 | 9 |
| 600 | | - |
| 601 | void QDefaultAnimationDriver::timerEvent(QTimerEvent *e) | - |
| 602 | { | - |
| 603 | qt_noop(); | - |
| 604 | (void)e;; | - |
| 605 | advance(); | - |
| 606 | } executed: }Execution Count:1300 | 1300 |
| 607 | | - |
| 608 | void QDefaultAnimationDriver::startTimer() | - |
| 609 | { | - |
| 610 | | - |
| 611 | m_timer.start(m_unified_timer->timingInterval, Qt::PreciseTimer, this); | - |
| 612 | } executed: }Execution Count:82 | 82 |
| 613 | | - |
| 614 | void QDefaultAnimationDriver::stopTimer() | - |
| 615 | { | - |
| 616 | m_timer.stop(); | - |
| 617 | } executed: }Execution Count:79 | 79 |
| 618 | | - |
| 619 | | - |
| 620 | | - |
| 621 | void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) | - |
| 622 | { | - |
| 623 | QAbstractAnimation * const q = q_func(); | - |
| 624 | if (state == newState) evaluated: state == newState| yes Evaluation Count:1 | yes Evaluation Count:1811 |
| 1-1811 |
| 625 | return; executed: return;Execution Count:1 | 1 |
| 626 | | - |
| 627 | if (loopCount == 0) evaluated: loopCount == 0| yes Evaluation Count:1 | yes Evaluation Count:1810 |
| 1-1810 |
| 628 | return; executed: return;Execution Count:1 | 1 |
| 629 | | - |
| 630 | QAbstractAnimation::State oldState = state; | - |
| 631 | int oldCurrentTime = currentTime; | - |
| 632 | int oldCurrentLoop = currentLoop; | - |
| 633 | QAbstractAnimation::Direction oldDirection = direction; | - |
| 634 | | - |
| 635 | | - |
| 636 | if ((newState == QAbstractAnimation::Paused || newState == QAbstractAnimation::Running) evaluated: newState == QAbstractAnimation::Paused| yes Evaluation Count:58 | yes Evaluation Count:1752 |
evaluated: newState == QAbstractAnimation::Running| yes Evaluation Count:924 | yes Evaluation Count:828 |
| 58-1752 |
| 637 | && oldState == QAbstractAnimation::Stopped) { evaluated: oldState == QAbstractAnimation::Stopped| yes Evaluation Count:912 | yes Evaluation Count:70 |
| 70-912 |
| 638 | | - |
| 639 | | - |
| 640 | | - |
| 641 | totalCurrentTime = currentTime = (direction == QAbstractAnimation::Forward) ? evaluated: (direction == QAbstractAnimation::Forward)| yes Evaluation Count:794 | yes Evaluation Count:118 |
| 118-794 |
| 642 | 0 : (loopCount == -1 ? q->duration() : q->totalDuration()); | - |
| 643 | } executed: }Execution Count:912 | 912 |
| 644 | | - |
| 645 | state = newState; | - |
| 646 | QPointer<QAbstractAnimation> guard(q); | - |
| 647 | | - |
| 648 | | - |
| 649 | | - |
| 650 | bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped; evaluated: !group| yes Evaluation Count:992 | yes Evaluation Count:818 |
evaluated: group->state() == QAbstractAnimation::Stopped| yes Evaluation Count:37 | yes Evaluation Count:781 |
| 37-992 |
| 651 | if (oldState == QAbstractAnimation::Running) { evaluated: oldState == QAbstractAnimation::Running| yes Evaluation Count:844 | yes Evaluation Count:966 |
| 844-966 |
| 652 | if (newState == QAbstractAnimation::Paused && hasRegisteredTimer) evaluated: newState == QAbstractAnimation::Paused| yes Evaluation Count:58 | yes Evaluation Count:786 |
evaluated: hasRegisteredTimer| yes Evaluation Count:29 | yes Evaluation Count:29 |
| 29-786 |
| 653 | QAnimationTimer::ensureTimerUpdate(); executed: QAnimationTimer::ensureTimerUpdate();Execution Count:29 | 29 |
| 654 | | - |
| 655 | QAnimationTimer::unregisterAnimation(q); | - |
| 656 | } else if (newState == QAbstractAnimation::Running) { executed: }Execution Count:844 evaluated: newState == QAbstractAnimation::Running| yes Evaluation Count:924 | yes Evaluation Count:42 |
| 42-924 |
| 657 | QAnimationTimer::registerAnimation(q, isTopLevel); | - |
| 658 | } executed: }Execution Count:924 | 924 |
| 659 | | - |
| 660 | q->updateState(newState, oldState); | - |
| 661 | if (!guard || newState != state) partially evaluated: !guard| no Evaluation Count:0 | yes Evaluation Count:1810 |
partially evaluated: newState != state| no Evaluation Count:0 | yes Evaluation Count:1810 |
| 0-1810 |
| 662 | return; | 0 |
| 663 | | - |
| 664 | | - |
| 665 | q->stateChanged(newState, oldState); | - |
| 666 | if (!guard || newState != state) partially evaluated: !guard| no Evaluation Count:0 | yes Evaluation Count:1810 |
partially evaluated: newState != state| no Evaluation Count:0 | yes Evaluation Count:1810 |
| 0-1810 |
| 667 | return; | 0 |
| 668 | | - |
| 669 | switch (state) { | - |
| 670 | case QAbstractAnimation::Paused: | - |
| 671 | break; executed: break;Execution Count:58 | 58 |
| 672 | case QAbstractAnimation::Running: | - |
| 673 | { | - |
| 674 | | - |
| 675 | | - |
| 676 | if (oldState == QAbstractAnimation::Stopped) { evaluated: oldState == QAbstractAnimation::Stopped| yes Evaluation Count:912 | yes Evaluation Count:12 |
| 12-912 |
| 677 | if (isTopLevel) { evaluated: isTopLevel| yes Evaluation Count:500 | yes Evaluation Count:412 |
| 412-500 |
| 678 | | - |
| 679 | QAnimationTimer::ensureTimerUpdate(); | - |
| 680 | q->setCurrentTime(totalCurrentTime); | - |
| 681 | } executed: }Execution Count:500 | 500 |
| 682 | } executed: }Execution Count:912 | 912 |
| 683 | } | - |
| 684 | break; executed: break;Execution Count:924 | 924 |
| 685 | case QAbstractAnimation::Stopped: | - |
| 686 | | - |
| 687 | int dura = q->duration(); | - |
| 688 | | - |
| 689 | if (deleteWhenStopped) evaluated: deleteWhenStopped| yes Evaluation Count:287 | yes Evaluation Count:541 |
| 287-541 |
| 690 | q->deleteLater(); executed: q->deleteLater();Execution Count:287 | 287 |
| 691 | | - |
| 692 | if (dura == -1 || loopCount < 0 evaluated: dura == -1| yes Evaluation Count:17 | yes Evaluation Count:811 |
evaluated: loopCount < 0| yes Evaluation Count:9 | yes Evaluation Count:802 |
| 9-811 |
| 693 | || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount)) evaluated: oldDirection == QAbstractAnimation::Forward| yes Evaluation Count:710 | yes Evaluation Count:92 |
evaluated: (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount)| yes Evaluation Count:611 | yes Evaluation Count:99 |
| 92-710 |
| 694 | || (oldDirection == QAbstractAnimation::Backward && oldCurrentTime == 0)) { evaluated: oldDirection == QAbstractAnimation::Backward| yes Evaluation Count:92 | yes Evaluation Count:99 |
evaluated: oldCurrentTime == 0| yes Evaluation Count:87 | yes Evaluation Count:5 |
| 5-99 |
| 695 | q->finished(); | - |
| 696 | } executed: }Execution Count:724 | 724 |
| 697 | break; executed: break;Execution Count:828 | 828 |
| 698 | } | - |
| 699 | } executed: }Execution Count:1810 | 1810 |
| 700 | | - |
| 701 | | - |
| 702 | | - |
| 703 | | - |
| 704 | | - |
| 705 | | - |
| 706 | | - |
| 707 | QAbstractAnimation::QAbstractAnimation(QObject *parent) | - |
| 708 | : QObject(*new QAbstractAnimationPrivate, 0) | - |
| 709 | { | - |
| 710 | | - |
| 711 | setParent(parent); | - |
| 712 | } executed: }Execution Count:27 | 27 |
| 713 | | - |
| 714 | | - |
| 715 | | - |
| 716 | | - |
| 717 | QAbstractAnimation::QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent) | - |
| 718 | : QObject(dd, 0) | - |
| 719 | { | - |
| 720 | | - |
| 721 | setParent(parent); | - |
| 722 | } executed: }Execution Count:1505 | 1505 |
| 723 | | - |
| 724 | | - |
| 725 | | - |
| 726 | | - |
| 727 | | - |
| 728 | | - |
| 729 | QAbstractAnimation::~QAbstractAnimation() | - |
| 730 | { | - |
| 731 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 732 | | - |
| 733 | if (d->state != Stopped) { evaluated: d->state != Stopped| yes Evaluation Count:84 | yes Evaluation Count:1317 |
| 84-1317 |
| 734 | QAbstractAnimation::State oldState = d->state; | - |
| 735 | d->state = Stopped; | - |
| 736 | stateChanged(oldState, d->state); | - |
| 737 | if (oldState == QAbstractAnimation::Running) evaluated: oldState == QAbstractAnimation::Running| yes Evaluation Count:80 | yes Evaluation Count:4 |
| 4-80 |
| 738 | QAnimationTimer::unregisterAnimation(this); executed: QAnimationTimer::unregisterAnimation(this);Execution Count:80 | 80 |
| 739 | } executed: }Execution Count:84 | 84 |
| 740 | } executed: }Execution Count:1401 | 1401 |
| 741 | QAbstractAnimation::State QAbstractAnimation::state() const | - |
| 742 | { | - |
| 743 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 744 | return d->state; executed: return d->state;Execution Count:3659 | 3659 |
| 745 | } | - |
| 746 | | - |
| 747 | | - |
| 748 | | - |
| 749 | | - |
| 750 | | - |
| 751 | | - |
| 752 | | - |
| 753 | QAnimationGroup *QAbstractAnimation::group() const | - |
| 754 | { | - |
| 755 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 756 | return d->group; executed: return d->group;Execution Count:701 | 701 |
| 757 | } | - |
| 758 | QAbstractAnimation::Direction QAbstractAnimation::direction() const | - |
| 759 | { | - |
| 760 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 761 | return d->direction; executed: return d->direction;Execution Count:1563 | 1563 |
| 762 | } | - |
| 763 | void QAbstractAnimation::setDirection(Direction direction) | - |
| 764 | { | - |
| 765 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 766 | if (d->direction == direction) evaluated: d->direction == direction| yes Evaluation Count:232 | yes Evaluation Count:99 |
| 99-232 |
| 767 | return; executed: return;Execution Count:232 | 232 |
| 768 | | - |
| 769 | if (state() == Stopped) { evaluated: state() == Stopped| yes Evaluation Count:89 | yes Evaluation Count:10 |
| 10-89 |
| 770 | if (direction == Backward) { evaluated: direction == Backward| yes Evaluation Count:87 | yes Evaluation Count:2 |
| 2-87 |
| 771 | d->currentTime = duration(); | - |
| 772 | d->currentLoop = d->loopCount - 1; | - |
| 773 | } else { executed: }Execution Count:87 | 87 |
| 774 | d->currentTime = 0; | - |
| 775 | d->currentLoop = 0; | - |
| 776 | } executed: }Execution Count:2 | 2 |
| 777 | } | - |
| 778 | | - |
| 779 | | - |
| 780 | | - |
| 781 | if (d->hasRegisteredTimer) evaluated: d->hasRegisteredTimer| yes Evaluation Count:10 | yes Evaluation Count:89 |
| 10-89 |
| 782 | QAnimationTimer::ensureTimerUpdate(); executed: QAnimationTimer::ensureTimerUpdate();Execution Count:10 | 10 |
| 783 | | - |
| 784 | d->direction = direction; | - |
| 785 | updateDirection(direction); | - |
| 786 | | - |
| 787 | if (d->hasRegisteredTimer) evaluated: d->hasRegisteredTimer| yes Evaluation Count:10 | yes Evaluation Count:89 |
| 10-89 |
| 788 | | - |
| 789 | QAnimationTimer::updateAnimationTimer(); executed: QAnimationTimer::updateAnimationTimer();Execution Count:10 | 10 |
| 790 | | - |
| 791 | directionChanged(direction); | - |
| 792 | } executed: }Execution Count:99 | 99 |
| 793 | int QAbstractAnimation::loopCount() const | - |
| 794 | { | - |
| 795 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 796 | return d->loopCount; executed: return d->loopCount;Execution Count:8157 | 8157 |
| 797 | } | - |
| 798 | void QAbstractAnimation::setLoopCount(int loopCount) | - |
| 799 | { | - |
| 800 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 801 | d->loopCount = loopCount; | - |
| 802 | } executed: }Execution Count:146 | 146 |
| 803 | int QAbstractAnimation::currentLoop() const | - |
| 804 | { | - |
| 805 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 806 | return d->currentLoop; executed: return d->currentLoop;Execution Count:138 | 138 |
| 807 | } | - |
| 808 | int QAbstractAnimation::totalDuration() const | - |
| 809 | { | - |
| 810 | int dura = duration(); | - |
| 811 | if (dura <= 0) evaluated: dura <= 0| yes Evaluation Count:1190 | yes Evaluation Count:7987 |
| 1190-7987 |
| 812 | return dura; executed: return dura;Execution Count:1190 | 1190 |
| 813 | int loopcount = loopCount(); | - |
| 814 | if (loopcount < 0) evaluated: loopcount < 0| yes Evaluation Count:32 | yes Evaluation Count:7955 |
| 32-7955 |
| 815 | return -1; executed: return -1;Execution Count:32 | 32 |
| 816 | return dura * loopcount; executed: return dura * loopcount;Execution Count:7955 | 7955 |
| 817 | } | - |
| 818 | | - |
| 819 | | - |
| 820 | | - |
| 821 | | - |
| 822 | | - |
| 823 | | - |
| 824 | | - |
| 825 | int QAbstractAnimation::currentLoopTime() const | - |
| 826 | { | - |
| 827 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 828 | return d->currentTime; executed: return d->currentTime;Execution Count:482 | 482 |
| 829 | } | - |
| 830 | int QAbstractAnimation::currentTime() const | - |
| 831 | { | - |
| 832 | const QAbstractAnimationPrivate * const d = d_func(); | - |
| 833 | return d->totalCurrentTime; executed: return d->totalCurrentTime;Execution Count:165 | 165 |
| 834 | } | - |
| 835 | void QAbstractAnimation::setCurrentTime(int msecs) | - |
| 836 | { | - |
| 837 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 838 | msecs = qMax(msecs, 0); | - |
| 839 | | - |
| 840 | | - |
| 841 | int dura = duration(); | - |
| 842 | int totalDura = dura <= 0 ? dura : ((d->loopCount < 0) ? -1 : dura * d->loopCount); evaluated: dura <= 0| yes Evaluation Count:739 | yes Evaluation Count:3204 |
| 739-3204 |
| 843 | if (totalDura != -1) evaluated: totalDura != -1| yes Evaluation Count:3615 | yes Evaluation Count:328 |
| 328-3615 |
| 844 | msecs = qMin(totalDura, msecs); executed: msecs = qMin(totalDura, msecs);Execution Count:3615 | 3615 |
| 845 | d->totalCurrentTime = msecs; | - |
| 846 | | - |
| 847 | | - |
| 848 | int oldLoop = d->currentLoop; | - |
| 849 | d->currentLoop = ((dura <= 0) ? 0 : (msecs / dura)); evaluated: (dura <= 0)| yes Evaluation Count:739 | yes Evaluation Count:3204 |
| 739-3204 |
| 850 | if (d->currentLoop == d->loopCount) { evaluated: d->currentLoop == d->loopCount| yes Evaluation Count:356 | yes Evaluation Count:3587 |
| 356-3587 |
| 851 | | - |
| 852 | d->currentTime = qMax(0, dura); | - |
| 853 | d->currentLoop = qMax(0, d->loopCount - 1); | - |
| 854 | } else { executed: }Execution Count:356 | 356 |
| 855 | if (d->direction == Forward) { evaluated: d->direction == Forward| yes Evaluation Count:3354 | yes Evaluation Count:233 |
| 233-3354 |
| 856 | d->currentTime = (dura <= 0) ? msecs : (msecs % dura); evaluated: (dura <= 0)| yes Evaluation Count:709 | yes Evaluation Count:2645 |
| 709-2645 |
| 857 | } else { executed: }Execution Count:3354 | 3354 |
| 858 | d->currentTime = (dura <= 0) ? msecs : ((msecs - 1) % dura) + 1; evaluated: (dura <= 0)| yes Evaluation Count:30 | yes Evaluation Count:203 |
| 30-203 |
| 859 | if (d->currentTime == dura) evaluated: d->currentTime == dura| yes Evaluation Count:46 | yes Evaluation Count:187 |
| 46-187 |
| 860 | --d->currentLoop; executed: --d->currentLoop;Execution Count:46 | 46 |
| 861 | } executed: }Execution Count:233 | 233 |
| 862 | } | - |
| 863 | | - |
| 864 | updateCurrentTime(d->currentTime); | - |
| 865 | if (d->currentLoop != oldLoop) evaluated: d->currentLoop != oldLoop| yes Evaluation Count:237 | yes Evaluation Count:3706 |
| 237-3706 |
| 866 | currentLoopChanged(d->currentLoop); executed: currentLoopChanged(d->currentLoop);Execution Count:237 | 237 |
| 867 | | - |
| 868 | | - |
| 869 | | - |
| 870 | | - |
| 871 | if ((d->direction == Forward && d->totalCurrentTime == totalDura) evaluated: d->direction == Forward| yes Evaluation Count:3634 | yes Evaluation Count:309 |
evaluated: d->totalCurrentTime == totalDura| yes Evaluation Count:696 | yes Evaluation Count:2938 |
| 309-3634 |
| 872 | || (d->direction == Backward && d->totalCurrentTime == 0)) { evaluated: d->direction == Backward| yes Evaluation Count:309 | yes Evaluation Count:2938 |
evaluated: d->totalCurrentTime == 0| yes Evaluation Count:74 | yes Evaluation Count:235 |
| 74-2938 |
| 873 | stop(); | - |
| 874 | } executed: }Execution Count:770 | 770 |
| 875 | } executed: }Execution Count:3943 | 3943 |
| 876 | void QAbstractAnimation::start(DeletionPolicy policy) | - |
| 877 | { | - |
| 878 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 879 | if (d->state == Running) evaluated: d->state == Running| yes Evaluation Count:474 | yes Evaluation Count:920 |
| 474-920 |
| 880 | return; executed: return;Execution Count:474 | 474 |
| 881 | d->deleteWhenStopped = policy; | - |
| 882 | d->setState(Running); | - |
| 883 | } executed: }Execution Count:920 | 920 |
| 884 | void QAbstractAnimation::stop() | - |
| 885 | { | - |
| 886 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 887 | | - |
| 888 | if (d->state == Stopped) evaluated: d->state == Stopped| yes Evaluation Count:1528 | yes Evaluation Count:828 |
| 828-1528 |
| 889 | return; executed: return;Execution Count:1528 | 1528 |
| 890 | | - |
| 891 | d->setState(Stopped); | - |
| 892 | } executed: }Execution Count:828 | 828 |
| 893 | void QAbstractAnimation::pause() | - |
| 894 | { | - |
| 895 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 896 | if (d->state == Stopped) { evaluated: d->state == Stopped| yes Evaluation Count:2 | yes Evaluation Count:59 |
| 2-59 |
| 897 | QMessageLogger("animation/qabstractanimation.cpp", 1349, __PRETTY_FUNCTION__).warning("QAbstractAnimation::pause: Cannot pause a stopped animation"); | - |
| 898 | return; executed: return;Execution Count:2 | 2 |
| 899 | } | - |
| 900 | | - |
| 901 | d->setState(Paused); | - |
| 902 | } executed: }Execution Count:59 | 59 |
| 903 | void QAbstractAnimation::resume() | - |
| 904 | { | - |
| 905 | QAbstractAnimationPrivate * const d = d_func(); | - |
| 906 | if (d->state != Paused) { evaluated: d->state != Paused| yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
| 907 | QMessageLogger("animation/qabstractanimation.cpp", 1367, __PRETTY_FUNCTION__).warning("QAbstractAnimation::resume: " | - |
| 908 | "Cannot resume an animation that is not paused"); | - |
| 909 | return; executed: return;Execution Count:2 | 2 |
| 910 | } | - |
| 911 | | - |
| 912 | d->setState(Running); | - |
| 913 | } executed: }Execution Count:5 | 5 |
| 914 | | - |
| 915 | | - |
| 916 | | - |
| 917 | | - |
| 918 | | - |
| 919 | | - |
| 920 | | - |
| 921 | void QAbstractAnimation::setPaused(bool paused) | - |
| 922 | { | - |
| 923 | if (paused) | 0 |
| 924 | pause(); | 0 |
| 925 | else | - |
| 926 | resume(); never executed: resume(); | 0 |
| 927 | } | - |
| 928 | | - |
| 929 | | - |
| 930 | | - |
| 931 | | - |
| 932 | | - |
| 933 | bool QAbstractAnimation::event(QEvent *event) | - |
| 934 | { | - |
| 935 | return QObject::event(event); executed: return QObject::event(event);Execution Count:1036 | 1036 |
| 936 | } | - |
| 937 | void QAbstractAnimation::updateState(QAbstractAnimation::State newState, | - |
| 938 | QAbstractAnimation::State oldState) | - |
| 939 | { | - |
| 940 | (void)oldState;; | - |
| 941 | (void)newState;; | - |
| 942 | } executed: }Execution Count:305 | 305 |
| 943 | | - |
| 944 | | - |
| 945 | | - |
| 946 | | - |
| 947 | | - |
| 948 | | - |
| 949 | | - |
| 950 | void QAbstractAnimation::updateDirection(QAbstractAnimation::Direction direction) | - |
| 951 | { | - |
| 952 | (void)direction;; | - |
| 953 | } executed: }Execution Count:78 | 78 |
| 954 | | - |
| 955 | | - |
| 956 | | - |
| 957 | | - |
| 958 | | - |
| | |