aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/animations
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@jollamobile.com>2014-03-28 11:43:47 -0500
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-08 01:39:37 +0200
commit02ad96fa8870630c6b77327098c712d6418b8fda (patch)
tree7f9557c1f00d80e3f16deb4e447cc34863b0a884 /src/qml/animations
parent0a74379a57bcf68328ab167121c2dd16fc2d47c3 (diff)
Support dumping of animation jobs via QML_ANIMATION_TICK_DUMP.
Change-Id: I0b444321667691be3e1037164d02f29ed4dfc13e Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/qml/animations')
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp23
-rw-r--r--src/qml/animations/qabstractanimationjob_p.h5
-rw-r--r--src/qml/animations/qanimationgroupjob.cpp12
-rw-r--r--src/qml/animations/qanimationgroupjob_p.h2
-rw-r--r--src/qml/animations/qcontinuinganimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qcontinuinganimationgroupjob_p.h1
-rw-r--r--src/qml/animations/qparallelanimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qparallelanimationgroupjob_p.h1
-rw-r--r--src/qml/animations/qpauseanimationjob.cpp5
-rw-r--r--src/qml/animations/qpauseanimationjob_p.h1
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob.cpp7
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob_p.h1
12 files changed, 72 insertions, 0 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp
index b6222a541c..0928c0efc1 100644
--- a/src/qml/animations/qabstractanimationjob.cpp
+++ b/src/qml/animations/qabstractanimationjob.cpp
@@ -45,6 +45,7 @@
#include "private/qanimationgroupjob_p.h"
#include "private/qanimationjobutil_p.h"
#include "private/qqmlengine_p.h"
+#include "private/qqmlglobal_p.h"
#define DEFAULT_TIMER_INTERVAL 16
@@ -54,6 +55,8 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QThreadStorage<QQmlAnimationTimer *>, animationTimer)
#endif
+DEFINE_BOOL_CONFIG_OPTION(animationTickDump, QML_ANIMATION_TICK_DUMP);
+
QAnimationJobChangeListener::~QAnimationJobChangeListener()
{
}
@@ -115,6 +118,11 @@ void QQmlAnimationTimer::updateAnimationsTime(qint64 delta)
+ (animation->direction() == QAbstractAnimationJob::Forward ? delta : -delta);
animation->setCurrentTime(elapsed);
}
+ if (animationTickDump()) {
+ qDebug() << "***** Dumping Animation Tree ***** ( tick:" << lastTick << "delta:" << delta << ")";
+ for (int i = 0; i < animations.count(); ++i)
+ qDebug() << animations.at(i);
+ }
insideTick = false;
currentAnimationIdx = 0;
}
@@ -647,6 +655,21 @@ void QAbstractAnimationJob::removeAnimationChangeListener(QAnimationJobChangeLis
}
}
+void QAbstractAnimationJob::debugAnimation(QDebug d) const
+{
+ d << "AbstractAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << duration();
+}
+
+QDebug operator<<(QDebug d, const QAbstractAnimationJob *job)
+{
+ if (!job) {
+ d << "AbstractAnimationJob(null)";
+ return d;
+ }
+ job->debugAnimation(d);
+ return d;
+}
+
QT_END_NAMESPACE
//#include "moc_qabstractanimation2_p.cpp"
diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h
index e8745c8c92..c905fca0d7 100644
--- a/src/qml/animations/qabstractanimationjob_p.h
+++ b/src/qml/animations/qabstractanimationjob_p.h
@@ -123,6 +123,8 @@ protected:
virtual void updateDirection(QAbstractAnimationJob::Direction direction);
virtual void topLevelAnimationLoopChanged() {}
+ virtual void debugAnimation(QDebug d) const;
+
void fireTopLevelAnimationLoopChanged();
void setState(QAbstractAnimationJob::State state);
@@ -169,6 +171,7 @@ protected:
friend class QQmlAnimationTimer;
friend class QAnimationGroupJob;
+ friend QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
};
class Q_QML_PRIVATE_EXPORT QAnimationJobChangeListener
@@ -237,6 +240,8 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractAnimationJob::ChangeTypes)
+QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
+
QT_END_NAMESPACE
#endif // QABSTRACTANIMATIONJOB_P_H
diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp
index afdf07639b..a8b1b28e3e 100644
--- a/src/qml/animations/qanimationgroupjob.cpp
+++ b/src/qml/animations/qanimationgroupjob.cpp
@@ -167,4 +167,16 @@ void QAnimationGroupJob::animationRemoved(QAbstractAnimationJob* anim, QAbstract
}
}
+void QAnimationGroupJob::debugChildren(QDebug d) const
+{
+ int indentLevel = 1;
+ const QAnimationGroupJob *group = this;
+ while ((group = group->m_group))
+ ++indentLevel;
+
+ QByteArray ind(indentLevel, ' ');
+ for (QAbstractAnimationJob *child = firstChild(); child; child = child->nextSibling())
+ d << "\n" << ind.constData() << child;
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h
index 0f62194656..45bf32fd36 100644
--- a/src/qml/animations/qanimationgroupjob_p.h
+++ b/src/qml/animations/qanimationgroupjob_p.h
@@ -76,6 +76,8 @@ protected:
int uncontrolledAnimationFinishTime(QAbstractAnimationJob *anim) const { return anim->m_uncontrolledFinishTime; }
void setUncontrolledAnimationFinishTime(QAbstractAnimationJob *anim, int time);
+ void debugChildren(QDebug d) const;
+
private:
//definition
QAbstractAnimationJob *m_firstChild;
diff --git a/src/qml/animations/qcontinuinganimationgroupjob.cpp b/src/qml/animations/qcontinuinganimationgroupjob.cpp
index 17ab071bf2..432ed8c692 100644
--- a/src/qml/animations/qcontinuinganimationgroupjob.cpp
+++ b/src/qml/animations/qcontinuinganimationgroupjob.cpp
@@ -121,5 +121,12 @@ void QContinuingAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimat
stop();
}
+void QContinuingAnimationGroupJob::debugAnimation(QDebug d) const
+{
+ d << "ContinuingAnimationGroupJob(" << hex << (void *) this << dec << ")";
+
+ debugChildren(d);
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qcontinuinganimationgroupjob_p.h b/src/qml/animations/qcontinuinganimationgroupjob_p.h
index 7578ab9709..c84ff3ca10 100644
--- a/src/qml/animations/qcontinuinganimationgroupjob_p.h
+++ b/src/qml/animations/qcontinuinganimationgroupjob_p.h
@@ -60,6 +60,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
void updateDirection(QAbstractAnimationJob::Direction direction);
void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
+ void debugAnimation(QDebug d) const;
};
QT_END_NAMESPACE
diff --git a/src/qml/animations/qparallelanimationgroupjob.cpp b/src/qml/animations/qparallelanimationgroupjob.cpp
index 85a8527c6b..80538432ef 100644
--- a/src/qml/animations/qparallelanimationgroupjob.cpp
+++ b/src/qml/animations/qparallelanimationgroupjob.cpp
@@ -232,5 +232,12 @@ void QParallelAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimatio
}
}
+void QParallelAnimationGroupJob::debugAnimation(QDebug d) const
+{
+ d << "ParallelAnimationGroupJob(" << hex << (void *) this << dec << ")";
+
+ debugChildren(d);
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h
index 8e29402f33..8cad1c993f 100644
--- a/src/qml/animations/qparallelanimationgroupjob_p.h
+++ b/src/qml/animations/qparallelanimationgroupjob_p.h
@@ -60,6 +60,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
void updateDirection(QAbstractAnimationJob::Direction direction);
void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
+ void debugAnimation(QDebug d) const;
private:
bool shouldAnimationStart(QAbstractAnimationJob *animation, bool startIfAtEnd) const;
diff --git a/src/qml/animations/qpauseanimationjob.cpp b/src/qml/animations/qpauseanimationjob.cpp
index b6b081d39d..f185b12750 100644
--- a/src/qml/animations/qpauseanimationjob.cpp
+++ b/src/qml/animations/qpauseanimationjob.cpp
@@ -68,4 +68,9 @@ void QPauseAnimationJob::updateCurrentTime(int)
{
}
+void QPauseAnimationJob::debugAnimation(QDebug d) const
+{
+ d << "PauseAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << m_duration;
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qpauseanimationjob_p.h b/src/qml/animations/qpauseanimationjob_p.h
index f84143d9bf..a2ec71f373 100644
--- a/src/qml/animations/qpauseanimationjob_p.h
+++ b/src/qml/animations/qpauseanimationjob_p.h
@@ -58,6 +58,7 @@ public:
protected:
void updateCurrentTime(int);
+ void debugAnimation(QDebug d) const;
private:
//definition
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp
index ec9b2ba906..135760b3cb 100644
--- a/src/qml/animations/qsequentialanimationgroupjob.cpp
+++ b/src/qml/animations/qsequentialanimationgroupjob.cpp
@@ -413,4 +413,11 @@ void QSequentialAnimationGroupJob::animationRemoved(QAbstractAnimationJob *anim,
m_totalCurrentTime = m_currentTime + m_loopCount * duration();
}
+void QSequentialAnimationGroupJob::debugAnimation(QDebug d) const
+{
+ d << "SequentialAnimationGroupJob(" << hex << (void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation;
+
+ debugChildren(d);
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h
index 18dc6fcc7b..7d4b933bd5 100644
--- a/src/qml/animations/qsequentialanimationgroupjob_p.h
+++ b/src/qml/animations/qsequentialanimationgroupjob_p.h
@@ -63,6 +63,7 @@ protected:
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
void updateDirection(QAbstractAnimationJob::Direction direction);
void uncontrolledAnimationFinished(QAbstractAnimationJob *animation);
+ void debugAnimation(QDebug d) const;
private:
struct AnimationIndex