plasma-framework/animations/animation.cpp
Aaron J. Seigo 8814c2b2c0 * consolidate the start() methods
* make some changes needed for bindings

svn path=/trunk/KDE/kdelibs/; revision=1038369
2009-10-21 07:51:11 +00:00

83 lines
1.8 KiB
C++

/*
* Copyright 2009 Mehmet Ali Akmanalp <makmanalp@wpi.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "animation.h"
#include <QMapIterator>
#include <QObject>
#include <QParallelAnimationGroup>
#include <QSequentialAnimationGroup>
#include <kdebug.h>
#include <kglobalsettings.h>
namespace Plasma
{
class AnimationPrivate {
public:
/**
* Duration of the animation. Default is 1000ms.
*/
int duration;
};
Animation::Animation(QObject* parent)
: AbstractAnimation(parent),
d(new AnimationPrivate)
{
d->duration = 250;
}
Animation::~Animation()
{
delete d;
}
void Animation::setDuration(int duration)
{
d->duration = duration;
}
QAbstractAnimation* Animation::toQAbstractAnimation(QObject* parent)
{
//check if .setObject() was done
if (!widgetToAnimate()) {
kDebug() << "Object not set.";
return NULL;
}
//check which parent to use
if (parent) {
return render(parent);
} else {
return render(this->parent());
}
}
int Animation::duration() const
{
return d->duration;
}
} //namespace Plasma
#include <../animation.moc>