1 /***************************************************************************
2 transition.h - description
4 begin : Tue Jan 24 2006
5 copyright : (C) 2006 by Jean-Baptiste Mardelle
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
20 * @author Jean-Baptiste Mardelle
21 * @brief Describes a transition with a name, parameters, keyframes, etc.
28 #include <QGraphicsRectItem>
30 #include <QDomElement>
34 #include "definitions.h"
35 #include "abstractclipitem.h"
39 class Transition : public AbstractClipItem
44 Transition(const ItemInfo &info, int transitiontrack, double fps, QDomElement params = QDomElement(), bool automaticTransition = false);
45 virtual ~Transition();
46 virtual void paint(QPainter *painter,
47 const QStyleOptionGraphicsItem *option,
49 virtual int type() const;
51 /** @brief Returns an XML representation of this transition. */
54 /** @brief Returns the track number of the transition in the playlist. */
55 int transitionEndTrack() const;
56 bool hasClip(const ClipItem * clip) const;
57 bool belongsToClip(const ClipItem * clip) const;
58 bool invertedTransition() const;
59 QString transitionTag() const;
60 QStringList transitionInfo() const;
61 OPERATIONTYPE operationMode(QPointF pos);
62 static int itemHeight();
63 static int itemOffset();
64 //const QMap < QString, QString > transitionParameters() const;
65 void setTransitionParameters(const QDomElement params);
66 void setTransitionDirection(bool inv);
67 void setTransitionTrack(int track);
68 //Transition *reparent(ClipItem * clip);
71 /** @brief Links the transition to another track.
73 * This happens only if the current track is not forced. */
74 void updateTransitionEndTrack(int newtrack);
75 void setForcedTrack(bool force, int track);
76 bool forcedTrack() const;
77 const ClipItem *referencedClip() const;
79 bool isAutomatic() const;
80 void setAutomatic(bool automatic);
82 int defaultZValue() const;
83 /** @brief When a transition is resized, check if keyframes are out of the transition and fix if necessary. */
84 bool updateKeyframes();
87 virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
91 bool m_forceTransitionTrack;
93 /** @brief True if the transition is attached to its clip. */
94 bool m_automaticTransition;
96 /** @brief Contains the transition parameters. */
97 QDomElement m_parameters;
99 /** @brief The clip to which the transition is attached. */
100 ClipItem *m_referenceClip;
102 /** @brief The second clip to which the transition is attached. */
103 ClipItem *m_secondClip;
104 int m_transitionTrack;
106 /** @brief Returns the display name for a transition type. */
107 QString getTransitionName(const TRANSITIONTYPE & type);
109 /** @brief Returns the transition type for a given name. */
110 TRANSITIONTYPE getTransitionForName(const QString & type);
112 #if QT_VERSION >= 0x040600
113 QPropertyAnimation *m_startAnimation;