]> git.sesse.net Git - kdenlive/blob - src/transition.h
start work on automatic transitions
[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 #ifndef TRANSITION_H
19 #define TRANSITION_H
20
21 #include <QString>
22 #include <QGraphicsRectItem>
23 #include <QPixmap>
24 #include <QDomElement>
25 #include <QMap>
26 #include <QLinearGradient>
27
28 #include "gentime.h"
29 #include "definitions.h"
30 #include "abstractclipitem.h"
31
32
33 /**Describes a Transition, with a name, parameters keyframes, etc.
34   *@author Jean-Baptiste Mardelle
35   */
36
37 class ClipItem;
38
39 class Transition : public AbstractClipItem {
40     Q_OBJECT
41 public:
42
43     Transition(const ItemInfo info, int transitiontrack, double fps, QDomElement params = QDomElement(), bool automaticTransition = false);
44     virtual ~Transition();
45     virtual void paint(QPainter *painter,
46                        const QStyleOptionGraphicsItem *option,
47                        QWidget *widget);
48     virtual int type() const;
49     /** Returns an XML representation of this transition. */
50     QDomElement toXML();
51
52     /** Return the track number of transition in the playlist*/
53     int transitionEndTrack() const;
54     bool hasClip(const ClipItem * clip) const;
55     bool belongsToClip(const ClipItem * clip) const;
56     bool invertedTransition() const;
57     QString transitionName() const;
58     QString transitionTag() const;
59     OPERATIONTYPE operationMode(QPointF pos);
60     //const QMap < QString, QString > transitionParameters() const;
61     void setTransitionParameters(const QDomElement params);
62     void setTransitionDirection(bool inv);
63     void setTransitionTrack(int track);
64     QPixmap transitionPixmap() const;
65     //Transition *reparent(ClipItem * clip);
66     bool isValid() const;
67     /** Transition should be linked to another track */
68     void updateTransitionEndTrack(int newtrack);
69     void setForcedTrack(bool force, int track);
70     bool forcedTrack() const;
71     const ClipItem *referencedClip() const;
72     Transition *clone();
73     bool isAutomatic() const;
74     void setAutomatic(bool automatic);
75
76 protected:
77     virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
78
79 private:
80     bool m_singleClip;
81     QLinearGradient m_gradient;
82     QString m_name;
83     bool m_forceTransitionTrack;
84
85     /** true if the transition was added automatically and should be moved with its clip */
86     bool m_automaticTransition;
87     /** contains the transition parameters */
88     QDomElement m_parameters;
89     /** The clip to which the transition is attached */
90     ClipItem *m_referenceClip;
91
92     /** The 2nd clip to which the transition is attached */
93     ClipItem *m_secondClip;
94     int m_transitionTrack;
95
96     /** Return the display name for a transition type */
97     QString getTransitionName(const TRANSITIONTYPE & type);
98
99     /** Return the transition type for a given name */
100     TRANSITIONTYPE getTransitionForName(const QString & type);
101 };
102
103 #endif