From 7a4193fa2ac6a23f32229710e244cdf685e8cb6d Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Da Silva Date: Mon, 7 Dec 2009 18:16:33 +0000 Subject: [PATCH] Reusing duration property from base class and storing target animation scale factor. svn path=/trunk/KDE/kdelibs/; revision=1059938 --- animations/pulser.cpp | 18 +++++++++--------- animations/pulser_p.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/animations/pulser.cpp b/animations/pulser.cpp index a5f899267..19f61f066 100644 --- a/animations/pulser.cpp +++ b/animations/pulser.cpp @@ -38,7 +38,8 @@ public : PulseAnimationPrivate() : under(0), zvalue(0), - mscale(0), + scale(0), + endScale(1.5), opacityAnimation(0), scaleAnimation(0) {} @@ -47,7 +48,8 @@ public : { } QGraphicsWidget *under; - qreal zvalue, mscale, mopacity; + qreal zvalue, scale, mopacity; + qreal endScale; QPropertyAnimation *opacityAnimation; QPropertyAnimation *scaleAnimation; QWeakPointer animation; @@ -66,15 +68,13 @@ void PulseAnimation::setWidgetToAnimate(QGraphicsWidget *widget) delete d->under; d->under = 0; } - - createAnimation(); + createAnimation(Animation::duration(), d->endScale); } } PulseAnimation::PulseAnimation(QObject *parent) : Animation(parent), d(new PulseAnimationPrivate) { - } PulseAnimation::~PulseAnimation() @@ -99,11 +99,11 @@ void PulseAnimation::setCopy() d->mopacity = 0; d->zvalue = target->zValue(); --d->zvalue; - d->mscale = target->scale(); + d->scale = target->scale(); d->under = shadow; d->under->setOpacity(d->mopacity); - d->under->setScale(d->mscale); + d->under->setScale(d->scale); d->under->setZValue(d->zvalue); } @@ -111,7 +111,7 @@ void PulseAnimation::setCopy() void PulseAnimation::resetPulser() { d->under->setOpacity(d->mopacity); - d->under->setScale(d->mscale); + d->under->setScale(d->scale); d->under->setZValue(d->zvalue); } @@ -135,7 +135,7 @@ void PulseAnimation::createAnimation(qreal duration, qreal scale) d->scaleAnimation = new QPropertyAnimation(d->under, "scale"); d->scaleAnimation->setDuration(duration); - d->scaleAnimation->setStartValue(d->mscale); + d->scaleAnimation->setStartValue(d->scale); d->scaleAnimation->setEndValue(scale); /* The group takes ownership of all animations */ diff --git a/animations/pulser_p.h b/animations/pulser_p.h index 89e63882a..843f78d9e 100644 --- a/animations/pulser_p.h +++ b/animations/pulser_p.h @@ -47,7 +47,7 @@ protected: private: - void createAnimation(qreal _duration = 500, qreal _scale = 1.5); + void createAnimation(qreal _duration, qreal _scale); PulseAnimationPrivate *d; };