From 921d6882caa4f4be78c747493295d3bdd3f1f673 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 26 Mar 2010 13:49:07 +1000 Subject: Cleanup. --- src/declarative/util/qdeclarativeanimation_p_p.h | 26 ++++-------------------- 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 #include #include - -#include +#include #include QT_BEGIN_NAMESPACE - - class QDeclarativeBehaviorPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QDeclarativeBehavior) @@ -64,7 +61,7 @@ public: QDeclarativeProperty property; QVariant currentValue; - QDeclarativeAbstractAnimation *animation; + QDeclarativeGuard animation; bool enabled; }; @@ -176,11 +173,10 @@ void QDeclarativeBehavior::write(const QVariant &value) actions << action; QList 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) -- cgit v0.12