fix logic
[personal-kdelibs.git] / plasma / animationdriver.cpp
blob5e91b4c77262bf5b967555cddd87fd4a344c9e85
1 /*
2 * Copyright 2007 Aaron Seigo <aseigo@kde.org>
3 * 2007 Alexis Ménard <darktears31@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "animationdriver.h"
23 #include <QPainter>
24 #include <QGraphicsItem>
26 namespace Plasma
29 AnimationDriver::AnimationDriver(QObject *parent)
30 : QObject(parent),
31 d(0)
35 AnimationDriver::~AnimationDriver()
39 int AnimationDriver::animationFps(Plasma::Animator::Animation animation) const
41 Q_UNUSED(animation)
42 return 0;
45 int AnimationDriver::movementAnimationFps(Plasma::Animator::Movement movement) const
47 Q_UNUSED(movement)
48 return 40;
51 int AnimationDriver::elementAnimationFps(Plasma::Animator::Animation animation) const
53 Q_UNUSED(animation)
54 return 0;
57 int AnimationDriver::animationDuration(Plasma::Animator::Animation) const
59 return 200;
62 int AnimationDriver::movementAnimationDuration(Plasma::Animator::Movement movement) const
64 switch (movement) {
65 case Animator::FastSlideInMovement:
66 case Animator::FastSlideOutMovement:
67 return 150;
68 break;
69 default:
70 break;
73 return 250;
76 int AnimationDriver::elementAnimationDuration(Plasma::Animator::Animation) const
78 return 333;
81 Animator::CurveShape AnimationDriver::animationCurve(Plasma::Animator::Animation) const
83 return Animator::EaseInOutCurve;
86 Animator::CurveShape AnimationDriver::movementAnimationCurve(Plasma::Animator::Movement) const
88 return Animator::EaseInOutCurve;
91 Animator::CurveShape AnimationDriver::elementAnimationCurve(Plasma::Animator::Animation) const
93 return Animator::EaseInOutCurve;
96 QPixmap AnimationDriver::elementAppear(qreal progress, const QPixmap &pixmap)
98 Q_UNUSED(progress)
99 return pixmap;
102 QPixmap AnimationDriver::elementDisappear(qreal progress, const QPixmap &pixmap)
104 Q_UNUSED(progress)
105 QPixmap pix(pixmap.size());
106 pix.fill(Qt::transparent);
108 return pix;
111 void AnimationDriver::itemAppear(qreal frame, QGraphicsItem *item)
113 Q_UNUSED(frame)
114 Q_UNUSED(item)
117 void AnimationDriver::itemDisappear(qreal frame, QGraphicsItem *item)
119 Q_UNUSED(frame)
120 Q_UNUSED(item)
123 void AnimationDriver::itemActivated(qreal frame, QGraphicsItem *item)
125 Q_UNUSED(frame)
126 Q_UNUSED(item)
129 void AnimationDriver::itemSlideIn(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
131 double x = start.x() + (destination.x() - start.x()) * progress;
132 double y = start.y() + (destination.y() - start.y()) * progress;
133 item->setPos(x, y);
136 void AnimationDriver::itemSlideOut(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
138 //kDebug();
139 double x = start.x() + (destination.x() - start.x()) * progress;
140 double y = start.y() + (destination.y() - start.y()) * progress;
141 item->setPos(x, y);
144 } // Plasma namespace
146 #include "animationdriver.moc"