Plasma
animationdriver.cpp
Go to the documentation of this file.
00001 /* 00002 * Copyright 2007 Aaron Seigo <aseigo@kde.org> 00003 * 2007 Alexis Ménard <darktears31@gmail.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Library General Public License as 00007 * published by the Free Software Foundation; either version 2, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this program; if not, write to the 00017 * Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "animationdriver.h" 00022 00023 #include <QPainter> 00024 #include <QGraphicsItem> 00025 00026 namespace Plasma 00027 { 00028 00029 AnimationDriver::AnimationDriver(QObject *parent) 00030 : QObject(parent), 00031 d(0) 00032 { 00033 } 00034 00035 AnimationDriver::~AnimationDriver() 00036 { 00037 } 00038 00039 int AnimationDriver::animationFps(Plasma::Animator::Animation animation) const 00040 { 00041 Q_UNUSED(animation) 00042 return 0; 00043 } 00044 00045 int AnimationDriver::movementAnimationFps(Plasma::Animator::Movement movement) const 00046 { 00047 Q_UNUSED(movement) 00048 return 40; 00049 } 00050 00051 int AnimationDriver::elementAnimationFps(Plasma::Animator::Animation animation) const 00052 { 00053 Q_UNUSED(animation) 00054 return 0; 00055 } 00056 00057 int AnimationDriver::animationDuration(Plasma::Animator::Animation) const 00058 { 00059 return 200; 00060 } 00061 00062 int AnimationDriver::movementAnimationDuration(Plasma::Animator::Movement movement) const 00063 { 00064 switch (movement) { 00065 case Animator::FastSlideInMovement: 00066 case Animator::FastSlideOutMovement: 00067 return 150; 00068 break; 00069 default: 00070 break; 00071 } 00072 00073 return 250; 00074 } 00075 00076 int AnimationDriver::elementAnimationDuration(Plasma::Animator::Animation) const 00077 { 00078 return 333; 00079 } 00080 00081 Animator::CurveShape AnimationDriver::animationCurve(Plasma::Animator::Animation) const 00082 { 00083 return Animator::EaseInOutCurve; 00084 } 00085 00086 Animator::CurveShape AnimationDriver::movementAnimationCurve(Plasma::Animator::Movement) const 00087 { 00088 return Animator::EaseInOutCurve; 00089 } 00090 00091 Animator::CurveShape AnimationDriver::elementAnimationCurve(Plasma::Animator::Animation) const 00092 { 00093 return Animator::EaseInOutCurve; 00094 } 00095 00096 QPixmap AnimationDriver::elementAppear(qreal progress, const QPixmap &pixmap) 00097 { 00098 Q_UNUSED(progress) 00099 return pixmap; 00100 } 00101 00102 QPixmap AnimationDriver::elementDisappear(qreal progress, const QPixmap &pixmap) 00103 { 00104 Q_UNUSED(progress) 00105 QPixmap pix(pixmap.size()); 00106 pix.fill(Qt::transparent); 00107 00108 return pix; 00109 } 00110 00111 void AnimationDriver::itemAppear(qreal frame, QGraphicsItem *item) 00112 { 00113 Q_UNUSED(frame) 00114 Q_UNUSED(item) 00115 } 00116 00117 void AnimationDriver::itemDisappear(qreal frame, QGraphicsItem *item) 00118 { 00119 Q_UNUSED(frame) 00120 Q_UNUSED(item) 00121 } 00122 00123 void AnimationDriver::itemActivated(qreal frame, QGraphicsItem *item) 00124 { 00125 Q_UNUSED(frame) 00126 Q_UNUSED(item) 00127 } 00128 00129 void AnimationDriver::itemSlideIn(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination) 00130 { 00131 double x = start.x() + (destination.x() - start.x()) * progress; 00132 double y = start.y() + (destination.y() - start.y()) * progress; 00133 item->setPos(x, y); 00134 } 00135 00136 void AnimationDriver::itemSlideOut(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination) 00137 { 00138 //kDebug(); 00139 double x = start.x() + (destination.x() - start.x()) * progress; 00140 double y = start.y() + (destination.y() - start.y()) * progress; 00141 item->setPos(x, y); 00142 } 00143 00144 } // Plasma namespace 00145 00146 #include "../animationdriver.moc"
KDE 4.6 API Reference