• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
  • deprecated
animationdriver.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2007 Aaron Seigo <aseigo@kde.org>
3  * 2007 Alexis Ménard <darktears31@gmail.com>
4  *
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.
9  *
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
14  *
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.
19  */
20 
21 #include "animationdriver.h"
22 
23 #include <QPainter>
24 #include <QGraphicsItem>
25 
26 namespace Plasma
27 {
28 
29 AnimationDriver::AnimationDriver(QObject *parent)
30  : QObject(parent),
31  d(0)
32 {
33 }
34 
35 AnimationDriver::~AnimationDriver()
36 {
37 }
38 
39 int AnimationDriver::animationFps(Plasma::Animator::Animation animation) const
40 {
41  Q_UNUSED(animation)
42  return 0;
43 }
44 
45 int AnimationDriver::movementAnimationFps(Plasma::Animator::Movement movement) const
46 {
47  Q_UNUSED(movement)
48  return 40;
49 }
50 
51 int AnimationDriver::elementAnimationFps(Plasma::Animator::Animation animation) const
52 {
53  Q_UNUSED(animation)
54  return 0;
55 }
56 
57 int AnimationDriver::animationDuration(Plasma::Animator::Animation) const
58 {
59  return 200;
60 }
61 
62 int AnimationDriver::movementAnimationDuration(Plasma::Animator::Movement movement) const
63 {
64  switch (movement) {
65  case Animator::FastSlideInMovement:
66  case Animator::FastSlideOutMovement:
67  return 150;
68  break;
69  default:
70  break;
71  }
72 
73  return 250;
74 }
75 
76 int AnimationDriver::elementAnimationDuration(Plasma::Animator::Animation) const
77 {
78  return 333;
79 }
80 
81 Animator::CurveShape AnimationDriver::animationCurve(Plasma::Animator::Animation) const
82 {
83  return Animator::EaseInOutCurve;
84 }
85 
86 Animator::CurveShape AnimationDriver::movementAnimationCurve(Plasma::Animator::Movement) const
87 {
88  return Animator::EaseInOutCurve;
89 }
90 
91 Animator::CurveShape AnimationDriver::elementAnimationCurve(Plasma::Animator::Animation) const
92 {
93  return Animator::EaseInOutCurve;
94 }
95 
96 QPixmap AnimationDriver::elementAppear(qreal progress, const QPixmap &pixmap)
97 {
98  Q_UNUSED(progress)
99  return pixmap;
100 }
101 
102 QPixmap AnimationDriver::elementDisappear(qreal progress, const QPixmap &pixmap)
103 {
104  Q_UNUSED(progress)
105  QPixmap pix(pixmap.size());
106  pix.fill(Qt::transparent);
107 
108  return pix;
109 }
110 
111 void AnimationDriver::itemAppear(qreal frame, QGraphicsItem *item)
112 {
113  Q_UNUSED(frame)
114  Q_UNUSED(item)
115 }
116 
117 void AnimationDriver::itemDisappear(qreal frame, QGraphicsItem *item)
118 {
119  Q_UNUSED(frame)
120  Q_UNUSED(item)
121 }
122 
123 void AnimationDriver::itemActivated(qreal frame, QGraphicsItem *item)
124 {
125  Q_UNUSED(frame)
126  Q_UNUSED(item)
127 }
128 
129 void AnimationDriver::itemSlideIn(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
130 {
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);
134 }
135 
136 void AnimationDriver::itemSlideOut(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
137 {
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);
142 }
143 
144 } // Plasma namespace
145 
146 #include "../animationdriver.moc"
Plasma::AnimationDriver::movementAnimationFps
virtual int movementAnimationFps(Plasma::Animator::Movement) const
Definition: animationdriver.cpp:45
Plasma::AnimationDriver::animationFps
virtual int animationFps(Plasma::Animator::Animation) const
Definition: animationdriver.cpp:39
Plasma::AnimationDriver::elementAnimationFps
virtual int elementAnimationFps(Plasma::Animator::Animation) const
Definition: animationdriver.cpp:51
Plasma::AnimationDriver::movementAnimationCurve
virtual Animator::CurveShape movementAnimationCurve(Plasma::Animator::Movement) const
Definition: animationdriver.cpp:86
Plasma::Animator::Animation
Animation
Definition: animator.h:55
Plasma::Animator::EaseInOutCurve
Definition: animator.h:76
Plasma::Animator::FastSlideInMovement
Definition: animator.h:84
Plasma::AnimationDriver::itemSlideIn
virtual void itemSlideIn(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
Definition: animationdriver.cpp:129
QObject
Plasma::AnimationDriver::elementAppear
virtual QPixmap elementAppear(qreal progress, const QPixmap &pixmap)
Definition: animationdriver.cpp:96
Plasma::AnimationScriptEngine::animation
QScriptValue animation(const QString &anim)
Definition: animationscriptengine.cpp:55
Plasma::AnimationDriver::elementAnimationCurve
virtual Animator::CurveShape elementAnimationCurve(Plasma::Animator::Animation) const
Definition: animationdriver.cpp:91
Plasma::Animator::FastSlideOutMovement
Definition: animator.h:85
Plasma::AnimationDriver::animationCurve
virtual Animator::CurveShape animationCurve(Plasma::Animator::Animation) const
Definition: animationdriver.cpp:81
Plasma::Animator::Movement
Movement
Definition: animator.h:81
Plasma::AnimationDriver::elementDisappear
virtual QPixmap elementDisappear(qreal progress, const QPixmap &pixmap)
Definition: animationdriver.cpp:102
Plasma::AnimationDriver::elementAnimationDuration
virtual int elementAnimationDuration(Plasma::Animator::Animation) const
Definition: animationdriver.cpp:76
Plasma::AnimationDriver::itemDisappear
virtual void itemDisappear(qreal progress, QGraphicsItem *item)
Definition: animationdriver.cpp:117
animationdriver.h
Plasma::AnimationDriver::animationDuration
virtual int animationDuration(Plasma::Animator::Animation) const
Definition: animationdriver.cpp:57
Plasma::AnimationDriver::movementAnimationDuration
virtual int movementAnimationDuration(Plasma::Animator::Movement) const
Definition: animationdriver.cpp:62
Plasma::AnimationDriver::~AnimationDriver
~AnimationDriver()
Definition: animationdriver.cpp:35
Plasma::Animator::CurveShape
CurveShape
Definition: animator.h:73
Plasma::AnimationDriver::itemSlideOut
virtual void itemSlideOut(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
Definition: animationdriver.cpp:136
Plasma::AnimationDriver::itemAppear
virtual void itemAppear(qreal progress, QGraphicsItem *item)
Definition: animationdriver.cpp:111
Plasma::AnimationDriver::AnimationDriver
AnimationDriver(QObject *parent=0)
Definition: animationdriver.cpp:29
Plasma::AnimationDriver::itemActivated
virtual void itemActivated(qreal progress, QGraphicsItem *item)
Definition: animationdriver.cpp:123
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal