add PauseAnimation

svn path=/trunk/KDE/kdelibs/; revision=1038847
This commit is contained in:
Aaron J. Seigo 2009-10-22 03:59:27 +00:00
parent b460485f1e
commit 545164b5b8
4 changed files with 96 additions and 1 deletions

39
animations/pause.cpp Normal file
View File

@ -0,0 +1,39 @@
/*
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
*
* 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 "pause.h"
#include <QPauseAnimation>
namespace Plasma
{
PauseAnimation::PauseAnimation(QObject *parent)
: Animation(parent)
{
}
QAbstractAnimation* PauseAnimation::render(QObject* parent)
{
//create animation
return new QPauseAnimation(duration(), parent);
}
} //namespace Plasma

50
animations/pause.h Normal file
View File

@ -0,0 +1,50 @@
/*
* Copyright 2009 Aaron J. Seigo <aseigo@kde.org>
*
* 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.
*/
/**
* @file This file contains the definition for the Expand effect.
*/
#ifndef PLASMA_ANIMATIONS_PAUSE_H
#define PLASMA_ANIMATIONS_PAUSE_H
#include <plasma/animations/animation.h>
#include <plasma/plasma_export.h>
namespace Plasma
{
/**
* @class PauseAnimation
* @short Provides a pause in animations
*/
class PauseAnimation : public Animation
{
Q_OBJECT
public:
PauseAnimation(QObject *parent = 0);
protected:
virtual QAbstractAnimation* render(QObject* parent = 0);
};
}
#endif

View File

@ -27,6 +27,7 @@
#include "animations/expand.h" #include "animations/expand.h"
#include "animations/fade.h" #include "animations/fade.h"
#include "animations/grow.h" #include "animations/grow.h"
#include "animations/pause.h"
#include "animations/pulser.h" #include "animations/pulser.h"
#include "animations/rotation.h" #include "animations/rotation.h"
#include "animations/slide.h" #include "animations/slide.h"
@ -69,6 +70,10 @@ AbstractAnimation *Animator::create(Animation type, QObject *parent)
result = new Plasma::SlideAnimation; result = new Plasma::SlideAnimation;
break; break;
case PauseAnimation:
result = new Plasma::PauseAnimation;
break;
default: default:
kDebug() << "Unsupported animation type."; kDebug() << "Unsupported animation type.";

View File

@ -64,7 +64,8 @@ public:
PulseAnimation, /*<< Pulse animated object (opacity/geometry/scale) */ PulseAnimation, /*<< Pulse animated object (opacity/geometry/scale) */
RotationAnimation, /*<< Rotate an animated object */ RotationAnimation, /*<< Rotate an animated object */
RotationStackedAnimation, /*<< TODO: for flipping one object with another */ RotationStackedAnimation, /*<< TODO: for flipping one object with another */
SlideAnimation /*<< Move the position of animated object */ SlideAnimation, /*<< Move the position of animated object */
PauseAnimation /*<< Pulse animated object (opacity/geometry/scale) */
}; };
enum CurveShape { enum CurveShape {