* *
***************************************************************************/
+/**
+ * @class Transition
+ * @author Jean-Baptiste Mardelle
+ * @brief Describes a transition with a name, parameters, keyframes, etc.
+ */
+
#ifndef TRANSITION_H
#define TRANSITION_H
#include <QString>
#include <QGraphicsRectItem>
#include <QPixmap>
-#include <qdom.h>
+#include <QDomElement>
#include <QMap>
#include "gentime.h"
#include "definitions.h"
#include "abstractclipitem.h"
-/**Describes a Transition, with a name, parameters keyframes, etc.
- *@author Jean-Baptiste Mardelle
- */
-
class ClipItem;
-class Transition : public AbstractClipItem {
+class Transition : public AbstractClipItem
+{
Q_OBJECT
public:
- Transition(const QRectF&, ClipItem * clipa, const QString& type, const GenTime &startTime, const GenTime &endTime, double fps, bool inverted = false);
- Transition(const QRectF&, ClipItem * clip, QDomElement transitionElement, double fps, GenTime offset = GenTime());
+ Transition(const ItemInfo &info, int transitiontrack, double fps, const QDomElement ¶ms = QDomElement(), bool automaticTransition = false);
virtual ~Transition();
virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget);
virtual int type() const;
- /** Returns an XML representation of this transition. */
+
+ /** @brief Returns an XML representation of this transition. */
QDomElement toXML();
- GenTime transitionStartTime() const;
- GenTime transitionEndTime() const;
- /** Return the track number of transition in the playlist*/
- int transitionStartTrack() const;
+ /** @brief Returns the track number of the transition in the playlist. */
int transitionEndTrack() const;
- Transition *clone();
- bool hasClip(const ClipItem * clip) const;
- bool belongsToClip(const ClipItem * clip) const;
- void resizeTransitionEnd(GenTime time);
- void resizeTransitionStart(GenTime time);
- void moveTransition(GenTime time);
- bool invertTransition() const;
- QString transitionName() const;
- OPERATIONTYPE operationMode(QPointF pos, double scale);
- void setTransitionType(QString newType);
+ QString transitionTag() const;
+ QStringList transitionInfo() const;
+ OperationType operationMode(const QPointF &pos);
+ static int itemHeight();
+ static int itemOffset();
//const QMap < QString, QString > transitionParameters() const;
- void setTransitionParameters(const QDomElement&);
- void setTransitionDirection(bool inv);
- int transitionTrack() const;
+ void setTransitionParameters(const QDomElement ¶ms);
void setTransitionTrack(int track);
- QPixmap transitionPixmap() const;
- Transition *reparent(ClipItem * clip);
- bool isValid() const;
- GenTime transitionDuration() const;
- const ClipItem *referencedClip() const;
-
-private:
-
- GenTime m_transitionStart;
- GenTime m_transitionDuration;
- QDomElement m_transitionParameters;
-
- /** The name of the transition to be displayed to user */
- QString m_transitionName;
- /** Should the transition be reversed */
- bool m_invertTransition;
+ /** @brief Links the transition to another track.
+ *
+ * This happens only if the current track is not forced. */
+ void updateTransitionEndTrack(int newtrack);
+ void setForcedTrack(bool force, int track);
+ bool forcedTrack() const;
+ Transition *clone();
+ bool isAutomatic() const;
+ void setAutomatic(bool automatic);
+ bool hasGeometry();
+ int defaultZValue() const;
+ /** @brief When a transition is resized, check if keyframes are out of the transition and fix if necessary.
+ * @param oldEnd the previous transition end, so that when we expand the transition, if there is a keyframe at end we move it
+ */
+ bool updateKeyframes(int oldEnd);
+
+protected:
+ virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
- bool m_singleClip;
+private:
+ QString m_name;
+ bool m_forceTransitionTrack;
- /** The track to which the transition is attached*/
- int m_track;
+ /** @brief True if the transition is attached to its clip. */
+ bool m_automaticTransition;
- /** The clip to which the transition is attached */
- ClipItem *m_referenceClip;
+ /** @brief Contains the transition parameters. */
+ QDomElement m_parameters;
- /** The 2nd clip to which the transition is attached */
- ClipItem *m_secondClip;
int m_transitionTrack;
- /** Return the display name for a transition type */
- QString getTransitionName(const TRANSITIONTYPE & type);
+ /** @brief Returns the display name for a transition type. */
+ QString getTransitionName(const TransitionType & type);
- /** Return the transition type for a given name */
- TRANSITIONTYPE getTransitionForName(const QString & type);
+ /** @brief Returns the transition type for a given name. */
+ TransitionType getTransitionForName(const QString & type);
};
#endif