]> git.sesse.net Git - kdenlive/blob - src/transition.h
Merge branch 'master' into audioAlign
[kdenlive] / src / transition.h
1 /***************************************************************************
2                           transition.h  -  description
3                              -------------------
4     begin                : Tue Jan 24 2006
5     copyright            : (C) 2006 by Jean-Baptiste Mardelle
6     email                : jb@ader.ch
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
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.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 /**
19  * @class Transition
20  * @author Jean-Baptiste Mardelle
21  * @brief Describes a transition with a name, parameters, keyframes, etc.
22  */
23
24 #ifndef TRANSITION_H
25 #define TRANSITION_H
26
27 #include <QString>
28 #include <QGraphicsRectItem>
29 #include <QPixmap>
30 #include <QDomElement>
31 #include <QMap>
32
33 #include "gentime.h"
34 #include "definitions.h"
35 #include "abstractclipitem.h"
36
37 class ClipItem;
38
39 class Transition : public AbstractClipItem
40 {
41     Q_OBJECT
42 public:
43
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,
48                        QWidget *widget);
49     virtual int type() const;
50
51     /** @brief Returns an XML representation of this transition. */
52     QDomElement toXML();
53
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     QString transitionTag() const;
59     QStringList transitionInfo() const;
60     OPERATIONTYPE operationMode(QPointF pos);
61     static int itemHeight();
62     static int itemOffset();
63     //const QMap < QString, QString > transitionParameters() const;
64     void setTransitionParameters(const QDomElement params);
65     void setTransitionTrack(int track);
66
67     /** @brief Links the transition to another track.
68      *
69      * This happens only if the current track is not forced. */
70     void updateTransitionEndTrack(int newtrack);
71     void setForcedTrack(bool force, int track);
72     bool forcedTrack() const;
73     const ClipItem *referencedClip() const;
74     Transition *clone();
75     bool isAutomatic() const;
76     void setAutomatic(bool automatic);
77     bool hasGeometry();
78     int defaultZValue() const;
79     /** @brief When a transition is resized, check if keyframes are out of the transition and fix if necessary. */
80     bool updateKeyframes();
81
82 protected:
83     virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
84
85 private:
86     QString m_name;
87     bool m_forceTransitionTrack;
88
89     /** @brief True if the transition is attached to its clip. */
90     bool m_automaticTransition;
91
92     /** @brief Contains the transition parameters. */
93     QDomElement m_parameters;
94
95     /** @brief The clip to which the transition is attached. */
96     ClipItem *m_referenceClip;
97
98     /** @brief The second clip to which the transition is attached. */
99     ClipItem *m_secondClip;
100     int m_transitionTrack;
101
102     /** @brief Returns the display name for a transition type. */
103     QString getTransitionName(const TRANSITIONTYPE & type);
104
105     /** @brief Returns the transition type for a given name. */
106     TRANSITIONTYPE getTransitionForName(const QString & type);
107 };
108
109 #endif