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
This commit is contained in:
parent
6142e913f6
commit
7ccf35e9fd
@ -18,24 +18,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fade.h"
|
#include "fade.h"
|
||||||
|
#include "private/animationprivate_p.h"
|
||||||
|
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
FadeAnimation::FadeAnimation(double factor)
|
FadeAnimation::FadeAnimation(double factor)
|
||||||
: m_factor(factor)
|
|
||||||
{
|
{
|
||||||
|
AnimationPrivate *obj = getAnimationPrivate();
|
||||||
if (m_factor > 1.0){
|
obj->animFactor = factor;
|
||||||
|
if (obj->animFactor > 1.0) {
|
||||||
kDebug() << "Opacity must be between 0 and 1.0. Reducing to 1.0.";
|
kDebug() << "Opacity must be between 0 and 1.0. Reducing to 1.0.";
|
||||||
m_factor = 1.0;
|
obj->animFactor = 1.0;
|
||||||
} else if(m_factor < 0){
|
} else if (obj->animFactor < 0) {
|
||||||
kDebug() << "Opacity must be between 0 and 1.0. Increasing to 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
|
//create animation
|
||||||
QGraphicsWidget *m_object = getAnimatedObject();
|
QGraphicsWidget *m_object = getAnimatedObject();
|
||||||
QPropertyAnimation* anim = new QPropertyAnimation(m_object, "opacity", parent);
|
QPropertyAnimation* anim = new QPropertyAnimation(m_object, "opacity", parent);
|
||||||
anim->setEndValue(m_factor);
|
anim->setEndValue(getAnimationPrivate()->animFactor);
|
||||||
anim->setDuration(getDuration());
|
anim->setDuration(getDuration());
|
||||||
|
|
||||||
//QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater()));
|
//QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater()));
|
||||||
|
@ -41,15 +41,13 @@ class PLASMA_EXPORT FadeAnimation : public Animation
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/* TODO: convert to qreal */
|
||||||
FadeAnimation(double factor);
|
FadeAnimation(double factor);
|
||||||
virtual ~FadeAnimation(){};
|
virtual ~FadeAnimation(){};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QAbstractAnimation* render(QObject* parent = 0);
|
virtual QAbstractAnimation* render(QObject* parent = 0);
|
||||||
|
|
||||||
private:
|
|
||||||
qreal m_factor;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ class PLASMA_EXPORT GrowAnimation : public Animation
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/* TODO: convert to qreal */
|
||||||
GrowAnimation(double factor);
|
GrowAnimation(double factor);
|
||||||
virtual ~GrowAnimation(){};
|
virtual ~GrowAnimation(){};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user