* adapt to API
* coding style fixes svn path=/trunk/KDE/kdelibs/; revision=1069730
This commit is contained in:
parent
b931262030
commit
8ccd1a0d9c
@ -57,22 +57,9 @@ qreal FadeAnimation::targetOpacity() const
|
|||||||
return m_targetOpacity;
|
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)
|
void FadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -86,7 +73,7 @@ void FadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAni
|
|||||||
|
|
||||||
void FadeAnimation::updateCurrentTime(int currentTime)
|
void FadeAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (w) {
|
if (w) {
|
||||||
qreal delta = currentTime / qreal(duration());
|
qreal delta = currentTime / qreal(duration());
|
||||||
delta = (m_startOpacity - m_targetOpacity) *
|
delta = (m_startOpacity - m_targetOpacity) *
|
||||||
|
@ -82,15 +82,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setTargetOpacity(qreal);
|
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:
|
protected:
|
||||||
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
||||||
void updateCurrentTime(int currentTime);
|
void updateCurrentTime(int currentTime);
|
||||||
|
@ -58,7 +58,7 @@ QRectF GeometryAnimation::targetGeometry() const
|
|||||||
|
|
||||||
void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstrac
|
|||||||
|
|
||||||
void GeometryAnimation::updateCurrentTime(int currentTime)
|
void GeometryAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (w) {
|
if (w) {
|
||||||
qreal delta = Animation::easingCurve().valueForProgress(
|
qreal delta = Animation::easingCurve().valueForProgress(
|
||||||
currentTime / qreal(duration()));
|
currentTime / qreal(duration()));
|
||||||
|
@ -42,7 +42,7 @@ qreal GrowAnimation::factor() const
|
|||||||
|
|
||||||
void GrowAnimation::updateCurrentTime(int currentTime)
|
void GrowAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (w && state() == QAbstractAnimation::Running) {
|
if (w && state() == QAbstractAnimation::Running) {
|
||||||
qreal delta = Animation::easingCurve().valueForProgress(
|
qreal delta = Animation::easingCurve().valueForProgress(
|
||||||
currentTime / qreal(duration()));
|
currentTime / qreal(duration()));
|
||||||
@ -56,7 +56,7 @@ void GrowAnimation::updateCurrentTime(int currentTime)
|
|||||||
void GrowAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
void GrowAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
|
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
|
||||||
QGraphicsWidget *widget = widgetToAnimate();
|
QGraphicsWidget *widget = targetWidget();
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ void RotationAnimation::setAngle(const qreal &angle)
|
|||||||
|
|
||||||
void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *m_object = widgetToAnimate();
|
QGraphicsWidget *m_object = targetWidget();
|
||||||
|
|
||||||
if (!m_object) {
|
if (!m_object) {
|
||||||
return;
|
return;
|
||||||
@ -157,7 +157,7 @@ void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstrac
|
|||||||
|
|
||||||
void RotationAnimation::updateCurrentTime(int currentTime)
|
void RotationAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (w) {
|
if (w) {
|
||||||
qreal delta = Animation::easingCurve().valueForProgress(
|
qreal delta = Animation::easingCurve().valueForProgress(
|
||||||
currentTime / qreal(duration()));
|
currentTime / qreal(duration()));
|
||||||
|
@ -70,8 +70,8 @@ void RotationStackedAnimation::setBackWidget(QGraphicsWidget *backWidget)
|
|||||||
{
|
{
|
||||||
m_backWidget = backWidget;
|
m_backWidget = backWidget;
|
||||||
|
|
||||||
if(widgetToAnimate()) {
|
if(targetWidget()) {
|
||||||
sLayout->addWidget(widgetToAnimate());
|
sLayout->addWidget(targetWidget());
|
||||||
sLayout->addWidget(m_backWidget.data());
|
sLayout->addWidget(m_backWidget.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ void RotationStackedAnimation::updateState(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QGraphicsWidget *,QGraphicsWidget *> widgets = qMakePair(widgetToAnimate(), backWidget());
|
QPair<QGraphicsWidget *,QGraphicsWidget *> widgets = qMakePair(targetWidget(), backWidget());
|
||||||
|
|
||||||
const qreal widgetFrontWidth = widgets.first->size().width();
|
const qreal widgetFrontWidth = widgets.first->size().width();
|
||||||
const qreal widgetFrontHeight = widgets.first->size().height();
|
const qreal widgetFrontHeight = widgets.first->size().height();
|
||||||
@ -142,7 +142,7 @@ void RotationStackedAnimation::updateState(
|
|||||||
|
|
||||||
void RotationStackedAnimation::updateCurrentTime(int currentTime)
|
void RotationStackedAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if(w) {
|
if(w) {
|
||||||
qreal delta;
|
qreal delta;
|
||||||
if (currentTime <= duration()/2) {
|
if (currentTime <= duration()/2) {
|
||||||
|
@ -60,7 +60,7 @@ qint8 SlideAnimation::movementDirection() const
|
|||||||
|
|
||||||
void SlideAnimation::updateCurrentTime(int currentTime)
|
void SlideAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (w && state() == QAbstractAnimation::Running) {
|
if (w && state() == QAbstractAnimation::Running) {
|
||||||
qreal delta = Animation::easingCurve().valueForProgress(
|
qreal delta = Animation::easingCurve().valueForProgress(
|
||||||
currentTime / qreal(duration()));
|
currentTime / qreal(duration()));
|
||||||
@ -71,10 +71,10 @@ void SlideAnimation::updateCurrentTime(int currentTime)
|
|||||||
void SlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
void SlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
|
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) {
|
||||||
if (!widgetToAnimate()) {
|
if (!targetWidget()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_startPos = widgetToAnimate()->pos();
|
m_startPos = targetWidget()->pos();
|
||||||
|
|
||||||
qreal newX = m_startPos.x();
|
qreal newX = m_startPos.x();
|
||||||
qreal newY = m_startPos.y();
|
qreal newY = m_startPos.y();
|
||||||
|
@ -47,7 +47,7 @@ qreal ZoomAnimation::zoom() const
|
|||||||
|
|
||||||
void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAni
|
|||||||
|
|
||||||
void ZoomAnimation::updateCurrentTime(int currentTime)
|
void ZoomAnimation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = targetWidget();
|
||||||
if (w) {
|
if (w) {
|
||||||
qreal delta = Animation::easingCurve().valueForProgress(
|
qreal delta = Animation::easingCurve().valueForProgress(
|
||||||
currentTime / qreal(duration()));
|
currentTime / qreal(duration()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user