mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
plasma: remove unused and mapped animations
Plasma::Animator::AppearAnimation and Plasma::Animator::DisappearAnimation are mapped to Plasma::Animator::ZoomAnimation by plasma-desktop Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
47a439be90
commit
36c233341a
8 changed files with 22 additions and 158 deletions
|
@ -52,9 +52,6 @@ void JavascriptAnimation::prepInstance()
|
|||
QScriptEngine *engine = AnimationScriptEngine::globalEngine();
|
||||
m_instance.setProperty("__plasma_javascriptanimation", engine->newQObject(this),
|
||||
QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
|
||||
ADD_ENUM_VALUE(m_instance, Plasma::Animator, AppearAnimation);
|
||||
ADD_ENUM_VALUE(m_instance, Plasma::Animator, DisappearAnimation);
|
||||
ADD_ENUM_VALUE(m_instance, Plasma::Animator, ActivateAnimation);
|
||||
ADD_ENUM_VALUE(m_instance, Plasma::Animator, FadeAnimation);
|
||||
ADD_ENUM_VALUE(m_instance, Plasma::Animator, GrowAnimation);
|
||||
ADD_ENUM_VALUE(m_instance, Plasma::Animator, PulseAnimation);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
|
||||
#include "animator.h"
|
||||
#include "private/animator_p.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
|
@ -37,102 +36,49 @@
|
|||
namespace Plasma
|
||||
{
|
||||
|
||||
QHash<Animator::Animation, Animator::Animation> AnimatorPrivate::s_stockAnimMappings;
|
||||
QHash<Animator::Animation, QString> AnimatorPrivate::s_loadableAnimMappings;
|
||||
|
||||
void AnimatorPrivate::mapAnimation(Animator::Animation from, Animator::Animation to)
|
||||
{
|
||||
if (from == to) {
|
||||
return;
|
||||
}
|
||||
|
||||
s_loadableAnimMappings.remove(from);
|
||||
s_stockAnimMappings.insert(from, to);
|
||||
}
|
||||
|
||||
void AnimatorPrivate::mapAnimation(Animator::Animation from, const QString &to)
|
||||
{
|
||||
s_stockAnimMappings.remove(from);
|
||||
s_loadableAnimMappings.insert(from, to);
|
||||
}
|
||||
|
||||
Plasma::Animation* Animator::create(Animator::Animation type, QObject *parent)
|
||||
{
|
||||
if (AnimatorPrivate::s_stockAnimMappings.contains(type)) {
|
||||
return create(AnimatorPrivate::s_stockAnimMappings.value(type));
|
||||
} else if (AnimatorPrivate::s_loadableAnimMappings.contains(type)) {
|
||||
const QString anim = AnimatorPrivate::s_loadableAnimMappings.value(type);
|
||||
return create(anim, parent);
|
||||
}
|
||||
|
||||
Plasma::Animation *result = 0;
|
||||
|
||||
switch (type) {
|
||||
case FadeAnimation: {
|
||||
result = create("FadeAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::FadeAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GrowAnimation: {
|
||||
result = create("GrowAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::GrowAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PulseAnimation: {
|
||||
result = create("PulseAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::PulseAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RotationAnimation: {
|
||||
result = create("RotationAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::RotationAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RotationStackedAnimation: {
|
||||
result = create("RotationStackedAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::RotationStackedAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SlideAnimation: {
|
||||
result = create("SlideAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::SlideAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GeometryAnimation: {
|
||||
result = create("GeometryAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::GeometryAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ZoomAnimation: {
|
||||
result = create("ZoomAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::ZoomAnimation(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PixmapTransitionAnimation: {
|
||||
result = create("PixmapTransitionAnimation", parent);
|
||||
if (!result) {
|
||||
result = new Plasma::PixmapTransition(parent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
//kDebug() << "Unsupported animation type.";
|
||||
kWarning() << "Unsupported animation type" << type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,19 +48,15 @@ class PLASMA_EXPORT Animator : public QObject
|
|||
|
||||
public:
|
||||
enum Animation {
|
||||
AppearAnimation = 0, /*<< Animate the appearance of an element */
|
||||
DisappearAnimation, /*<< Animate the disappearance of an element */
|
||||
ActivateAnimation, /*<< When something is activated or launched,
|
||||
such as an app icon being clicked */
|
||||
FadeAnimation, /*<< Can be used for both fade in and out */
|
||||
GrowAnimation, /*<< Grow animated object geometry */
|
||||
PulseAnimation, /*<< Pulse animated object (opacity/geometry/scale) */
|
||||
RotationAnimation, /*<< Rotate an animated object */
|
||||
RotationStackedAnimation, /*<< for flipping one object with another */
|
||||
SlideAnimation, /*<< Move the position of animated object */
|
||||
GeometryAnimation, /*<< Geometry animation*/
|
||||
ZoomAnimation, /*<<Zoom animation */
|
||||
PixmapTransitionAnimation, /*<< Transition between two pixmaps*/
|
||||
FadeAnimation = 0, /* Can be used for both fade in and out */
|
||||
GrowAnimation, /* Grow animated object geometry */
|
||||
PulseAnimation, /* Pulse animated object (opacity/geometry/scale) */
|
||||
RotationAnimation, /* Rotate an animated object */
|
||||
RotationStackedAnimation, /* For flipping one object with another */
|
||||
SlideAnimation, /* Move the position of animated object */
|
||||
GeometryAnimation, /* Geometry animation */
|
||||
ZoomAnimation, /* Zoom animation */
|
||||
PixmapTransitionAnimation, /* Transition between two pixmaps */
|
||||
LastAnimation = 1024
|
||||
};
|
||||
|
||||
|
|
|
@ -2869,7 +2869,7 @@ AppletOverlayWidget::AppletOverlayWidget(QGraphicsWidget *parent)
|
|||
|
||||
void AppletOverlayWidget::destroy()
|
||||
{
|
||||
Animation *anim = Plasma::Animator::create(Plasma::Animator::DisappearAnimation);
|
||||
Animation *anim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||
if (anim) {
|
||||
connect(anim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete()));
|
||||
anim->setTargetWidget(this);
|
||||
|
|
|
@ -879,12 +879,11 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
|||
if (!delayInit && !currentContainment) {
|
||||
applet->restore(*applet->d->mainConfigGroup());
|
||||
applet->init();
|
||||
Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::AppearAnimation);
|
||||
Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||
if (anim) {
|
||||
connect(anim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete()));
|
||||
anim->setTargetWidget(applet);
|
||||
//FIXME: small hack until we have proper js anim support; allows 'zoom' to work in the
|
||||
//'right' direction for appearance
|
||||
//FIXME: small hack that allows 'zoom' to work in the 'right' direction for appearance
|
||||
anim->setDirection(QAbstractAnimation::Backward);
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "containment.h"
|
||||
#include "containmentactionspluginsconfig.h"
|
||||
#include "view.h"
|
||||
#include "private/animator_p.h"
|
||||
#include "private/applet_p.h"
|
||||
#include "private/containment_p.h"
|
||||
#include "tooltipmanager.h"
|
||||
|
@ -354,16 +353,6 @@ Containment *Corona::addContainmentDelayed(const QString &name, const QVariantLi
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Corona::mapAnimation(Animator::Animation from, Animator::Animation to)
|
||||
{
|
||||
AnimatorPrivate::mapAnimation(from, to);
|
||||
}
|
||||
|
||||
void Corona::mapAnimation(Animator::Animation from, const QString &to)
|
||||
{
|
||||
AnimatorPrivate::mapAnimation(from, to);
|
||||
}
|
||||
|
||||
void Corona::addOffscreenWidget(QGraphicsWidget *widget)
|
||||
{
|
||||
foreach (QGraphicsWidget *w, d->offscreenWidgets) {
|
||||
|
|
|
@ -421,24 +421,6 @@ protected:
|
|||
**/
|
||||
virtual void loadDefaultLayout();
|
||||
|
||||
/**
|
||||
* Maps a stock animation to one of the semantic animations. Used to control things such
|
||||
* as what animation is used to make a Plasma::Appear appear in a containment.
|
||||
* @param from the animation to map a new value to
|
||||
* @param to the animation value to map to from
|
||||
* @since 4.5
|
||||
*/
|
||||
void mapAnimation(Animator::Animation from, Animator::Animation to);
|
||||
|
||||
/**
|
||||
* Maps a loadable animation to one of the semantic animations. Used to control things such
|
||||
* as what animation is used to make a Plasma::Appear appear in a containment.
|
||||
* @param from the animation to map a new value to
|
||||
* @param to the animation value to map to from; this must map to a Javascript animation
|
||||
* @since 4.5
|
||||
*/
|
||||
void mapAnimation(Animator::Animation from, const QString &to);
|
||||
|
||||
/**
|
||||
* @return The preferred toolbox plugin name for a given containment type.
|
||||
* @param type the containment type of which we want to know the preferred toolbox plugin.
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007 Aaron Seigo <aseigo@kde.org>
|
||||
* 2007 Alexis Ménard <darktears31@gmail.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ANIMATOR_P_H
|
||||
#define ANIMATOR_P_H
|
||||
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class Animator;
|
||||
|
||||
class AnimatorPrivate
|
||||
{
|
||||
public:
|
||||
static void mapAnimation(Animator::Animation from, Animator::Animation to);
|
||||
static void mapAnimation(Animator::Animation from, const QString &to);
|
||||
|
||||
static QHash<Animator::Animation, Animator::Animation> s_stockAnimMappings;
|
||||
static QHash<Animator::Animation, QString> s_loadableAnimMappings;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Reference in a new issue