Moving private members to a private class.
svn path=/trunk/KDE/kdelibs/; revision=1035762
This commit is contained in:
parent
451cf321a2
commit
a661ba66d6
@ -30,24 +30,41 @@
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class AnimationPrivate {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Parent owner object to use in generated animations.
|
||||
*/
|
||||
QObject* m_parent;
|
||||
|
||||
/**
|
||||
* Duration of the animation. Default is 1000ms.
|
||||
*/
|
||||
int m_duration;
|
||||
|
||||
};
|
||||
|
||||
Animation::Animation(QObject* parent)
|
||||
: m_parent(parent),
|
||||
m_duration(250)
|
||||
{
|
||||
d = new AnimationPrivate;
|
||||
d->m_parent = parent;
|
||||
d->m_duration = 250;
|
||||
|
||||
}
|
||||
|
||||
Animation::~Animation(){}
|
||||
Animation::~Animation()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Animation::setDuration(int duration){
|
||||
m_duration = duration;
|
||||
}
|
||||
|
||||
int Animation::duration() const {
|
||||
return m_duration;
|
||||
d->m_duration = duration;
|
||||
}
|
||||
|
||||
void Animation::start(){
|
||||
QAbstractAnimation* anim = getQtAnimation(m_parent);
|
||||
QAbstractAnimation* anim = getQtAnimation(d->m_parent);
|
||||
if (anim){
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
@ -65,14 +82,14 @@ QAbstractAnimation* Animation::getQtAnimation(QObject* parent){
|
||||
if (parent){
|
||||
return render(parent);
|
||||
} else {
|
||||
return render(m_parent);
|
||||
return render(d->m_parent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int Animation::getDuration() {
|
||||
|
||||
return m_duration;
|
||||
return d->m_duration;
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class AnimationPrivate;
|
||||
|
||||
/**
|
||||
* Abstract representation of a single animation.
|
||||
*/
|
||||
@ -48,12 +50,6 @@ public:
|
||||
Animation(QObject* parent = 0);
|
||||
virtual ~Animation() = 0;
|
||||
|
||||
/**
|
||||
* Get the animation duration.
|
||||
* @return duration in ms.
|
||||
*/
|
||||
virtual int duration() const;
|
||||
|
||||
/**
|
||||
* Start the animation.
|
||||
*/
|
||||
@ -82,20 +78,15 @@ protected:
|
||||
*/
|
||||
virtual QAbstractAnimation* render(QObject* parent = 0) = 0;
|
||||
|
||||
/**
|
||||
* Get the animation duration.
|
||||
* @return duration in ms.
|
||||
*/
|
||||
int getDuration();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Parent owner object to use in generated animations.
|
||||
*/
|
||||
QObject* m_parent;
|
||||
|
||||
/**
|
||||
* Duration of the animation. Default is 1000ms.
|
||||
*/
|
||||
int m_duration;
|
||||
|
||||
AnimationPrivate *d;
|
||||
};
|
||||
|
||||
} //namespace Plasma
|
||||
|
Loading…
x
Reference in New Issue
Block a user