SlideAnimation is done now.
svn path=/trunk/KDE/kdelibs/; revision=1036795
This commit is contained in:
parent
fc19c8cbf3
commit
10d9afacb4
@ -18,20 +18,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "slide.h"
|
#include "slide.h"
|
||||||
|
#include "private/animationprivate_p.h"
|
||||||
|
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
SlideAnimation::SlideAnimation(AnimationDirection direction, qreal distance)
|
SlideAnimation::SlideAnimation(AnimationDirection direction, qreal distance)
|
||||||
: m_direction(direction),
|
|
||||||
m_distance(distance),
|
|
||||||
m_end_visibility(true)
|
|
||||||
{
|
{
|
||||||
|
AnimationPrivate *obj = getAnimationPrivate();
|
||||||
|
obj->animDirection = direction;
|
||||||
|
//: m_direction(direction),
|
||||||
|
obj->animDistance = distance;
|
||||||
|
//m_distance(distance),
|
||||||
|
obj->animVisible = true;
|
||||||
|
//m_end_visibility(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,23 +48,24 @@ QAbstractAnimation* SlideAnimation::render(QObject* parent){
|
|||||||
qreal newX = x;
|
qreal newX = x;
|
||||||
qreal newY = y;
|
qreal newY = y;
|
||||||
|
|
||||||
|
AnimationPrivate *obj = getAnimationPrivate();
|
||||||
//compute new geometry values
|
//compute new geometry values
|
||||||
switch (m_direction){
|
switch (obj->animDirection) {
|
||||||
|
|
||||||
case MoveUp:
|
case MoveUp:
|
||||||
newY = y - m_distance;
|
newY = y - obj->animDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveRight:
|
case MoveRight:
|
||||||
newX = x + m_distance;
|
newX = x + obj->animDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveDown:
|
case MoveDown:
|
||||||
newY = y + m_distance;
|
newY = y + obj->animDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveLeft:
|
case MoveLeft:
|
||||||
newX = x - m_distance;
|
newX = x - obj->animDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveUpRight:
|
case MoveUpRight:
|
||||||
@ -81,7 +85,7 @@ UpLeft) are not supported\n";
|
|||||||
|
|
||||||
//QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater()));
|
//QObject::connect(anim, SIGNAL(finished()), anim, SLOT(deleteLater()));
|
||||||
|
|
||||||
if(m_end_visibility){
|
if (obj->animVisible) {
|
||||||
QObject::connect(anim, SIGNAL(finished()), m_object, SLOT(show()));
|
QObject::connect(anim, SIGNAL(finished()), m_object, SLOT(show()));
|
||||||
} else {
|
} else {
|
||||||
QObject::connect(anim, SIGNAL(finished()), m_object, SLOT(hide()));
|
QObject::connect(anim, SIGNAL(finished()), m_object, SLOT(hide()));
|
||||||
@ -92,7 +96,7 @@ UpLeft) are not supported\n";
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SlideAnimation::setVisibleAtEnd(bool visibility){
|
void SlideAnimation::setVisibleAtEnd(bool visibility){
|
||||||
m_end_visibility = visibility;
|
getAnimationPrivate()->animVisible = visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace Plasma
|
} //namespace Plasma
|
||||||
|
@ -53,12 +53,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual QAbstractAnimation* render(QObject* parent = 0);
|
virtual QAbstractAnimation* render(QObject* parent = 0);
|
||||||
|
|
||||||
private:
|
|
||||||
AnimationDirection m_direction;
|
|
||||||
qreal m_distance;
|
|
||||||
//bool m_beginning_visibility;
|
|
||||||
bool m_end_visibility;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
qreal animDistance;
|
qreal animDistance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation visibility: whether to end the animation being visible
|
||||||
|
* or not.
|
||||||
|
*/
|
||||||
|
bool animVisible;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user