diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-03-26 03:49:07 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-03-28 23:50:06 (GMT) |
commit | 921d6882caa4f4be78c747493295d3bdd3f1f673 (patch) | |
tree | a80a82f5a9c0e19157549e7c6128abda0baebd6f | |
parent | 2776592d1e8dc8059f3a1c05237294b4a45543d9 (diff) | |
download | Qt-921d6882caa4f4be78c747493295d3bdd3f1f673.zip Qt-921d6882caa4f4be78c747493295d3bdd3f1f673.tar.gz Qt-921d6882caa4f4be78c747493295d3bdd3f1f673.tar.bz2 |
Cleanup.
-rw-r--r-- | src/declarative/util/qdeclarativeanimation_p_p.h | 26 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativebehavior.cpp | 12 |
2 files changed, 8 insertions, 30 deletions
diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index 3908e50..2a66c8a 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -100,17 +100,11 @@ class QActionAnimation : public QAbstractAnimation { Q_OBJECT public: - QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped), running(false) {} + QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped) {} QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) - : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped), running(false) {} + : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped) {} ~QActionAnimation() { if (policy == DeleteWhenStopped) { delete animAction; animAction = 0; } } virtual int duration() const { return 0; } - void clearAnimAction() - { - if (policy == DeleteWhenStopped) - delete animAction; - animAction = 0; - } void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) { if (state() == Running) @@ -127,26 +121,18 @@ protected: { if (newState == Running) { if (animAction) { - running = true; animAction->doAction(); - running = false; if (state() == Stopped && policy == DeleteWhenStopped) { delete animAction; animAction = 0; } } - } /*else if (newState == Stopped && policy == DeleteWhenStopped) { - if (!running) { - delete animAction; - animAction = 0; - } - }*/ + } } private: QAbstractAnimationAction *animAction; DeletionPolicy policy; - bool running; }; class QDeclarativeBulkValueUpdater @@ -192,11 +178,7 @@ protected: //check for new from every loop if (fromSourced) *fromSourced = false; - } /*else if (newState == Stopped && policy == DeleteWhenStopped) { - delete animValue; - animValue = 0; - }*/ //### we get a stop each loop if we are in a group - //### top-level animation is the only reliable one for this + } } private: diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index 1e000df..7181777 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -47,15 +47,12 @@ #include <qdeclarativecontext.h> #include <qdeclarativeinfo.h> #include <qdeclarativeproperty_p.h> - -#include <QtCore/qparallelanimationgroup.h> +#include <qdeclarativeguard_p.h> #include <private/qobject_p.h> QT_BEGIN_NAMESPACE - - class QDeclarativeBehaviorPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeBehavior) @@ -64,7 +61,7 @@ public: QDeclarativeProperty property; QVariant currentValue; - QDeclarativeAbstractAnimation *animation; + QDeclarativeGuard<QDeclarativeAbstractAnimation> animation; bool enabled; }; @@ -176,11 +173,10 @@ void QDeclarativeBehavior::write(const QVariant &value) actions << action; QList<QDeclarativeProperty> after; - if (d->animation) - d->animation->transition(actions, after, QDeclarativeAbstractAnimation::Forward); + d->animation->transition(actions, after, QDeclarativeAbstractAnimation::Forward); d->animation->qtAnimation()->start(); if (!after.contains(d->property)) - QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property) |