summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-01 23:33:27 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-01 23:38:05 (GMT)
commit001d1a2eac5b0fe63ae9809c4c69065b7ae14f38 (patch)
tree6654dd88dfa160c96cf8266226cc4bd6d7f86f92 /src/declarative/util
parente1aa5c3641ba3945e2e6a7b4c37c394eece53dd0 (diff)
downloadQt-001d1a2eac5b0fe63ae9809c4c69065b7ae14f38.zip
Qt-001d1a2eac5b0fe63ae9809c4c69065b7ae14f38.tar.gz
Qt-001d1a2eac5b0fe63ae9809c4c69065b7ae14f38.tar.bz2
Reapply "Some animation cleanup/refactoring."
This reverts commit 543c4b82e6d6cc4a396b1c105d7321643b6ef4c6. Conflicts: src/declarative/util/qdeclarativeanimation.cpp
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp11
-rw-r--r--src/declarative/util/qdeclarativeanimation_p_p.h21
2 files changed, 20 insertions, 12 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 10230d3..ebf1a20 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -1573,7 +1573,8 @@ QDeclarativeSequentialAnimation::QDeclarativeSequentialAnimation(QObject *parent
QDeclarativeAnimationGroup(parent)
{
Q_D(QDeclarativeAnimationGroup);
- d->ag = new QSequentialAnimationGroup(this);
+ d->ag = new QSequentialAnimationGroup;
+ QDeclarative_setParent_noEvent(d->ag, this);
}
QDeclarativeSequentialAnimation::~QDeclarativeSequentialAnimation()
@@ -1638,7 +1639,8 @@ QDeclarativeParallelAnimation::QDeclarativeParallelAnimation(QObject *parent) :
QDeclarativeAnimationGroup(parent)
{
Q_D(QDeclarativeAnimationGroup);
- d->ag = new QParallelAnimationGroup(this);
+ d->ag = new QParallelAnimationGroup;
+ QDeclarative_setParent_noEvent(d->ag, this);
}
QDeclarativeParallelAnimation::~QDeclarativeParallelAnimation()
@@ -1797,7 +1799,7 @@ QDeclarativePropertyAnimation::~QDeclarativePropertyAnimation()
void QDeclarativePropertyAnimationPrivate::init()
{
Q_Q(QDeclarativePropertyAnimation);
- va = new QDeclarativeTimeLineValueAnimator;
+ va = new QDeclarativeBulkValueAnimator;
QDeclarative_setParent_noEvent(va, q);
}
@@ -2213,7 +2215,7 @@ QAbstractAnimation *QDeclarativePropertyAnimation::qtAnimation()
return d->va;
}
-struct PropertyUpdater : public QDeclarativeTimeLineValue
+struct PropertyUpdater : public QDeclarativeBulkValueUpdater
{
QDeclarativeStateActions actions;
int interpolatorType; //for Number/ColorAnimation
@@ -2231,7 +2233,6 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue
wasDeleted = &deleted;
if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
v = 1 - v;
- QDeclarativeTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
QDeclarativeAction &action = actions[ii];
diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h
index e582066..ae82a90 100644
--- a/src/declarative/util/qdeclarativeanimation_p_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p_p.h
@@ -149,14 +149,21 @@ private:
bool running;
};
-//animates QDeclarativeTimeLineValue (assumes start and end values will be reals or compatible)
-class QDeclarativeTimeLineValueAnimator : public QVariantAnimation
+class QDeclarativeBulkValueUpdater
+{
+public:
+ virtual ~QDeclarativeBulkValueUpdater() {}
+ virtual void setValue(qreal value) = 0;
+};
+
+//animates QDeclarativeBulkValueUpdater (assumes start and end values will be reals or compatible)
+class QDeclarativeBulkValueAnimator : public QVariantAnimation
{
Q_OBJECT
public:
- QDeclarativeTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {}
- ~QDeclarativeTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } }
- void setAnimValue(QDeclarativeTimeLineValue *value, DeletionPolicy p)
+ QDeclarativeBulkValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {}
+ ~QDeclarativeBulkValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } }
+ void setAnimValue(QDeclarativeBulkValueUpdater *value, DeletionPolicy p)
{
if (state() == Running)
stop();
@@ -193,7 +200,7 @@ protected:
}
private:
- QDeclarativeTimeLineValue *animValue;
+ QDeclarativeBulkValueUpdater *animValue;
bool *fromSourced;
DeletionPolicy policy;
};
@@ -352,7 +359,7 @@ public:
int interpolatorType;
QVariantAnimation::Interpolator interpolator;
- QDeclarativeTimeLineValueAnimator *va;
+ QDeclarativeBulkValueAnimator *va;
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
static void convertVariant(QVariant &variant, int type);