BINARY INCOMPATIBLE CHANGES
* const correctness in Animator * remove the vestiges of the FrameAppear stuff in Phase we never used * introduce FastSlide[In|Out] * put the duration in the hands of the Animator with duration methods svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=765004
This commit is contained in:
parent
76747db2d9
commit
0dfb81a617
43
animator.cpp
43
animator.cpp
@ -36,35 +36,59 @@ Animator::~Animator()
|
||||
{
|
||||
}
|
||||
|
||||
int Animator::framesPerSecond(Plasma::Phase::Animation animation)
|
||||
int Animator::framesPerSecond(Plasma::Phase::Animation animation) const
|
||||
{
|
||||
Q_UNUSED(animation)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Animator::framesPerSecond(Plasma::Phase::Movement movement)
|
||||
int Animator::framesPerSecond(Plasma::Phase::Movement movement) const
|
||||
{
|
||||
Q_UNUSED(movement)
|
||||
return 20;
|
||||
}
|
||||
|
||||
int Animator::framesPerSecond(Plasma::Phase::ElementAnimation animation)
|
||||
int Animator::framesPerSecond(Plasma::Phase::ElementAnimation animation) const
|
||||
{
|
||||
Q_UNUSED(animation)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Phase::CurveShape Animator::curve(Plasma::Phase::Animation)
|
||||
int Animator::duration(Plasma::Phase::Animation) const
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
|
||||
int Animator::duration(Plasma::Phase::Movement movement) const
|
||||
{
|
||||
switch (movement) {
|
||||
case Phase::FastSlideIn:
|
||||
case Phase::FastSlideOut:
|
||||
return 100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 270;
|
||||
}
|
||||
|
||||
int Animator::duration(Plasma::Phase::ElementAnimation) const
|
||||
{
|
||||
return 333;
|
||||
}
|
||||
|
||||
Phase::CurveShape Animator::curve(Plasma::Phase::Animation) const
|
||||
{
|
||||
return Phase::EaseInOutCurve;
|
||||
}
|
||||
|
||||
Phase::CurveShape Animator::curve(Plasma::Phase::Movement)
|
||||
Phase::CurveShape Animator::curve(Plasma::Phase::Movement) const
|
||||
{
|
||||
return Phase::EaseInOutCurve;
|
||||
}
|
||||
|
||||
Phase::CurveShape Animator::curve(Plasma::Phase::ElementAnimation)
|
||||
Phase::CurveShape Animator::curve(Plasma::Phase::ElementAnimation) const
|
||||
{
|
||||
return Phase::EaseInOutCurve;
|
||||
}
|
||||
@ -102,13 +126,6 @@ void Animator::activate(qreal frame, QGraphicsItem* item)
|
||||
Q_UNUSED(item)
|
||||
}
|
||||
|
||||
void Animator::frameAppear(qreal frame, QGraphicsItem* item, const QRegion& drawable)
|
||||
{
|
||||
Q_UNUSED(frame)
|
||||
Q_UNUSED(item)
|
||||
Q_UNUSED(drawable)
|
||||
}
|
||||
|
||||
void Animator::slideIn(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
|
||||
{
|
||||
double x = start.x() + (destination.x() - start.x()) * progress;
|
||||
|
16
animator.h
16
animator.h
@ -44,12 +44,15 @@ public:
|
||||
~Animator();
|
||||
|
||||
// Parameter definitions
|
||||
virtual int framesPerSecond(Plasma::Phase::Animation);
|
||||
virtual int framesPerSecond(Plasma::Phase::Movement);
|
||||
virtual int framesPerSecond(Plasma::Phase::ElementAnimation);
|
||||
virtual Phase::CurveShape curve(Plasma::Phase::Animation);
|
||||
virtual Phase::CurveShape curve(Plasma::Phase::Movement);
|
||||
virtual Phase::CurveShape curve(Plasma::Phase::ElementAnimation);
|
||||
virtual int framesPerSecond(Plasma::Phase::Animation) const;
|
||||
virtual int framesPerSecond(Plasma::Phase::Movement) const;
|
||||
virtual int framesPerSecond(Plasma::Phase::ElementAnimation) const;
|
||||
virtual int duration(Plasma::Phase::Animation) const;
|
||||
virtual int duration(Plasma::Phase::Movement) const;
|
||||
virtual int duration(Plasma::Phase::ElementAnimation) const;
|
||||
virtual Phase::CurveShape curve(Plasma::Phase::Animation) const;
|
||||
virtual Phase::CurveShape curve(Plasma::Phase::Movement) const;
|
||||
virtual Phase::CurveShape curve(Plasma::Phase::ElementAnimation) const;
|
||||
|
||||
// Element animations
|
||||
virtual QPixmap elementAppear(qreal frame, const QPixmap& pixmap);
|
||||
@ -58,7 +61,6 @@ public:
|
||||
// Item animations
|
||||
virtual void appear(qreal progress, QGraphicsItem* item);
|
||||
virtual void disappear(qreal progress, QGraphicsItem* item);
|
||||
virtual void frameAppear(qreal progress, QGraphicsItem* item, const QRegion& drawable);
|
||||
virtual void activate(qreal progress, QGraphicsItem* item);
|
||||
|
||||
// Item movements
|
||||
|
11
phase.cpp
11
phase.cpp
@ -135,9 +135,6 @@ class Phase::Private
|
||||
case Phase::Activate:
|
||||
animator->activate(amount, state->item);
|
||||
break;
|
||||
case Phase::FrameAppear:
|
||||
animator->frameAppear(amount, state->item, QRegion()); //FIXME: what -is- the frame region?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,10 +142,12 @@ class Phase::Private
|
||||
{
|
||||
switch (state->movement) {
|
||||
case Phase::SlideIn:
|
||||
case Phase::FastSlideIn:
|
||||
//kDebug() << "performMovement, SlideIn";
|
||||
animator->slideIn(amount, state->item, state->start, state->destination);
|
||||
break;
|
||||
case Phase::SlideOut:
|
||||
case Phase::FastSlideOut:
|
||||
//kDebug() << "performMovement, SlideOut";
|
||||
animator->slideOut(amount, state->item, state->start, state->destination);
|
||||
break;
|
||||
@ -254,7 +253,7 @@ void Phase::animateItem(QGraphicsItem* item, Animation animation)
|
||||
//TODO: variance in times based on the value of animation
|
||||
state->frames = frames / 3;
|
||||
state->currentFrame = 0;
|
||||
state->interval = 333 / state->frames;
|
||||
state->interval = d->animator->duration(animation) / state->frames;
|
||||
state->interval = (state->interval / MIN_TICK_RATE) * MIN_TICK_RATE;
|
||||
state->currentInterval = state->interval;
|
||||
|
||||
@ -292,7 +291,7 @@ void Phase::moveItem(QGraphicsItem* item, Movement movement, const QPoint &desti
|
||||
//TODO: variance in times based on the value of animation
|
||||
state->frames = frames / 2;
|
||||
state->currentFrame = 0;
|
||||
state->interval = 240 / state->frames;
|
||||
state->interval = d->animator->duration(movement) / state->frames;
|
||||
state->interval = (state->interval / MIN_TICK_RATE) * MIN_TICK_RATE;
|
||||
state->currentInterval = state->interval;
|
||||
|
||||
@ -360,7 +359,7 @@ Phase::AnimId Phase::animateElement(QGraphicsItem *item, ElementAnimation animat
|
||||
//TODO: variance in times based on the value of animation
|
||||
state->frames = d->animator->framesPerSecond(animation) / 5;
|
||||
state->currentFrame = 0;
|
||||
state->interval = 200 / state->frames;
|
||||
state->interval = d->animator->duration(animation) / state->frames;
|
||||
state->interval = (state->interval / MIN_TICK_RATE) * MIN_TICK_RATE;
|
||||
state->currentInterval = state->interval;
|
||||
state->id = ++d->animId;
|
||||
|
7
phase.h
7
phase.h
@ -47,8 +47,7 @@ public:
|
||||
{
|
||||
Appear = 0 /*<< When some appears in the Corona */,
|
||||
Disappear /*<< When something is about to disappear */,
|
||||
Activate /*<< When something is activated or launched, such as an app icon being clicked */,
|
||||
FrameAppear /*<< Make a frame appear around an object */
|
||||
Activate /*<< When something is activated or launched, such as an app icon being clicked */
|
||||
};
|
||||
|
||||
enum ElementAnimation
|
||||
@ -68,7 +67,9 @@ public:
|
||||
enum Movement
|
||||
{
|
||||
SlideIn = 0,
|
||||
SlideOut
|
||||
SlideOut,
|
||||
FastSlideIn,
|
||||
FastSlideOut
|
||||
};
|
||||
|
||||
typedef int AnimId;
|
||||
|
Loading…
Reference in New Issue
Block a user