* adapt to API

* coding style fixes

svn path=/trunk/KDE/kdelibs/; revision=1069730
This commit is contained in:
Aaron J. Seigo 2010-01-04 09:18:11 +00:00
parent b931262030
commit 8ccd1a0d9c
8 changed files with 17 additions and 39 deletions

View File

@ -57,22 +57,9 @@ qreal FadeAnimation::targetOpacity() const
return m_targetOpacity;
}
void FadeAnimation::setWidgetToAnimate(QGraphicsWidget *widget)
{
if (widget == widgetToAnimate()) {
return;
}
Animation::setWidgetToAnimate(widget);
if (widget) {
widget->setOpacity(m_startOpacity);
}
}
void FadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (!w) {
return;
}
@ -86,7 +73,7 @@ void FadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAni
void FadeAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = currentTime / qreal(duration());
delta = (m_startOpacity - m_targetOpacity) *

View File

@ -82,15 +82,6 @@ public:
*/
void setTargetOpacity(qreal);
/**
* Set the widget on which the animation is to be performed.
*
* This animation reimplements it to make possible to apply the
* start opacity in the widget (see \ref setStartOpacity).
* @arg receiver The QGraphicsWidget to be animated.
*/
void setWidgetToAnimate(QGraphicsWidget *widget);
protected:
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
void updateCurrentTime(int currentTime);

View File

@ -58,7 +58,7 @@ QRectF GeometryAnimation::targetGeometry() const
void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (!w) {
return;
}
@ -76,7 +76,7 @@ void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstrac
void GeometryAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));

View File

@ -42,7 +42,7 @@ qreal GrowAnimation::factor() const
void GrowAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (w && state() == QAbstractAnimation::Running) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
@ -56,7 +56,7 @@ void GrowAnimation::updateCurrentTime(int currentTime)
void GrowAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
QGraphicsWidget *widget = widgetToAnimate();
QGraphicsWidget *widget = targetWidget();
if (!widget) {
return;
}

View File

@ -75,7 +75,7 @@ void RotationAnimation::setAngle(const qreal &angle)
void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QGraphicsWidget *m_object = widgetToAnimate();
QGraphicsWidget *m_object = targetWidget();
if (!m_object) {
return;
@ -157,7 +157,7 @@ void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstrac
void RotationAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));

View File

@ -70,8 +70,8 @@ void RotationStackedAnimation::setBackWidget(QGraphicsWidget *backWidget)
{
m_backWidget = backWidget;
if(widgetToAnimate()) {
sLayout->addWidget(widgetToAnimate());
if(targetWidget()) {
sLayout->addWidget(targetWidget());
sLayout->addWidget(m_backWidget.data());
}
}
@ -88,7 +88,7 @@ void RotationStackedAnimation::updateState(
return;
}
QPair<QGraphicsWidget *,QGraphicsWidget *> widgets = qMakePair(widgetToAnimate(), backWidget());
QPair<QGraphicsWidget *,QGraphicsWidget *> widgets = qMakePair(targetWidget(), backWidget());
const qreal widgetFrontWidth = widgets.first->size().width();
const qreal widgetFrontHeight = widgets.first->size().height();
@ -142,7 +142,7 @@ void RotationStackedAnimation::updateState(
void RotationStackedAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if(w) {
qreal delta;
if (currentTime <= duration()/2) {

View File

@ -60,7 +60,7 @@ qint8 SlideAnimation::movementDirection() const
void SlideAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (w && state() == QAbstractAnimation::Running) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));
@ -71,10 +71,10 @@ void SlideAnimation::updateCurrentTime(int currentTime)
void SlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
if (!widgetToAnimate()) {
if (!targetWidget()) {
return;
}
m_startPos = widgetToAnimate()->pos();
m_startPos = targetWidget()->pos();
qreal newX = m_startPos.x();
qreal newY = m_startPos.y();

View File

@ -47,7 +47,7 @@ qreal ZoomAnimation::zoom() const
void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (!w) {
return;
}
@ -62,7 +62,7 @@ void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAni
void ZoomAnimation::updateCurrentTime(int currentTime)
{
QGraphicsWidget *w = widgetToAnimate();
QGraphicsWidget *w = targetWidget();
if (w) {
qreal delta = Animation::easingCurve().valueForProgress(
currentTime / qreal(duration()));