From 7ccf35e9fd5df3381c0b1c9a8f740529a837ec90 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Da Silva Date: Sat, 17 Oct 2009 17:46:01 +0000 Subject: [PATCH] Converting FadeAnimation and adding some todos: we must use qreal since it is a typedef that falls back to float/double depending on the cpu. svn path=/trunk/KDE/kdelibs/; revision=1036741 --- animations/fade.cpp | 16 ++++++++-------- animations/fade.h | 4 +--- animations/grow.h | 1 + 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/animations/fade.cpp b/animations/fade.cpp index 536965b81..c290c90fe 100644 --- a/animations/fade.cpp +++ b/animations/fade.cpp @@ -18,24 +18,24 @@ */ #include "fade.h" +#include "private/animationprivate_p.h" #include - #include namespace Plasma { FadeAnimation::FadeAnimation(double factor) - : m_factor(factor) { - - if (m_factor > 1.0){ + AnimationPrivate *obj = getAnimationPrivate(); + obj->animFactor = factor; + if (obj->animFactor > 1.0) { kDebug() << "Opacity must be between 0 and 1.0. Reducing to 1.0."; - m_factor = 1.0; - } else if(m_factor < 0){ + obj->animFactor = 1.0; + } else if (obj->animFactor < 0) { kDebug() << "Opacity must be between 0 and 1.0. Increasing to 0."; - m_factor = 0; + obj->animFactor = 0; } } @@ -44,7 +44,7 @@ QAbstractAnimation* FadeAnimation::render(QObject* parent){ //create animation QGraphicsWidget *m_object = getAnimatedObject(); QPropertyAnimation* anim = new QPropertyAnimation(m_object, "opacity", parent); - anim->setEndValue(m_factor); + anim->setEndValue(getAnimationPrivate()->animFactor); anim->setDuration(getDuration()); //QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater())); diff --git a/animations/fade.h b/animations/fade.h index 20b50eac1..1d9158ef8 100644 --- a/animations/fade.h +++ b/animations/fade.h @@ -41,15 +41,13 @@ class PLASMA_EXPORT FadeAnimation : public Animation Q_OBJECT public: + /* TODO: convert to qreal */ FadeAnimation(double factor); virtual ~FadeAnimation(){}; protected: virtual QAbstractAnimation* render(QObject* parent = 0); -private: - qreal m_factor; - }; } diff --git a/animations/grow.h b/animations/grow.h index f07c5a274..a84b9fe37 100644 --- a/animations/grow.h +++ b/animations/grow.h @@ -43,6 +43,7 @@ class PLASMA_EXPORT GrowAnimation : public Animation Q_OBJECT public: + /* TODO: convert to qreal */ GrowAnimation(double factor); virtual ~GrowAnimation(){};