]> git.sesse.net Git - kdenlive/blobdiff - src/transition.h
Fix indent
[kdenlive] / src / transition.h
index b52817d0a30305f4bf5133c4af1a5ad9bbaf13b7..90e690e4ea3e5c928bdb7673aa71e0c82474f400 100644 (file)
  *                                                                         *
  ***************************************************************************/
 
+/**
+ * @class Transition
+ * @author Jean-Baptiste Mardelle
+ * @brief Describes a transition with a name, parameters, keyframes, etc.
+ */
+
 #ifndef TRANSITION_H
 #define TRANSITION_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 ItemInfo info, int transitiontrack, double scale, double fps, QMap <QString, QString> desc, QDomElement params = QDomElement());
+    Transition(const ItemInfo &info, int transitiontrack, double fps, const QDomElement &params = 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. */
-    //QDomElement toXML();
 
-    /** Return the track number of transition in the playlist*/
+    /** @brief Returns an XML representation of this transition. */
+    QDomElement toXML();
+
+    /** @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;
-    bool invertedTransition() const;
-    QString transitionName() const;
     QString transitionTag() const;
-    OPERATIONTYPE operationMode(QPointF pos, double scale);
+    QStringList transitionInfo() const;
+    OPERATIONTYPE operationMode(const QPointF &pos);
+    static int itemHeight();
+    static int itemOffset();
     //const QMap < QString, QString > transitionParameters() const;
-    void setTransitionParameters(const QDomElement params);
-    void setTransitionDirection(bool inv);
+    void setTransitionParameters(const QDomElement &params);
     void setTransitionTrack(int track);
-    QPixmap transitionPixmap() const;
-    //Transition *reparent(ClipItem * clip);
-    bool isValid() const;
 
-    const ClipItem *referencedClip() const;
+    /** @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);
 
 private:
-    bool m_singleClip;
-    /** contains the transition description (name, tag, description) */
-    QMap <QString, QString> m_description;
-    /** contains the transition parameters */
+    QString m_name;
+    bool m_forceTransitionTrack;
+
+    /** @brief True if the transition is attached to its clip. */
+    bool m_automaticTransition;
+
+    /** @brief Contains the transition parameters. */
     QDomElement m_parameters;
-    /** The clip to which the transition is attached */
-    ClipItem *m_referenceClip;
 
-    /** The 2nd clip to which the transition is attached */
-    ClipItem *m_secondClip;
     int m_transitionTrack;
 
-    /** Return the display name for a transition type */
+    /** @brief Returns the display name for a transition type. */
     QString getTransitionName(const TRANSITIONTYPE & type);
 
-    /** Return the transition type for a given name */
+    /** @brief Returns the transition type for a given name. */
     TRANSITIONTYPE getTransitionForName(const QString & type);
 };