]> git.sesse.net Git - kdenlive/blob - src/transition.h
start implementing transitions. buttons in statusbar to show / hide thumbnails
[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.h>
24 #include <qdom.h>
25 #include <qmap.h>
26
27 #include "gentime.h"
28 #include "definitions.h"
29
30
31 /**Describes a Transition, with a name, parameters keyframes, etc.
32   *@author Jean-Baptiste Mardelle
33   */
34
35 class ClipItem;
36
37 class Transition {
38 public:
39
40     Transition(ClipItem * clipa, const TRANSITIONTYPE & type, const GenTime &startTime, const GenTime &endTime, bool inverted = false);
41     Transition(ClipItem * clip, QDomElement transitionElement, GenTime offset = GenTime());
42     ~Transition();
43
44     /** Returns an XML representation of this transition. */
45     QDomElement toXML();
46
47     GenTime transitionStartTime() const;
48     GenTime transitionEndTime() const;
49     /** Return the track number of transition in the playlist*/
50     int transitionStartTrack() const;
51     int transitionEndTrack() const;
52     Transition *clone();
53     bool hasClip(const ClipItem * clip) const;
54     bool belongsToClip(const ClipItem * clip) const;
55     void resizeTransitionEnd(GenTime time);
56     void resizeTransitionStart(GenTime time);
57     void moveTransition(GenTime time);
58     bool invertTransition() const;
59     TRANSITIONTYPE transitionType() const;
60     QString transitionTag() const;
61     QString transitionName() const;
62     void setTransitionType(TRANSITIONTYPE newType);
63     const QMap < QString, QString > transitionParameters() const;
64     void setTransitionParameters(const QMap < QString, QString > parameters);
65     void setTransitionDirection(bool inv);
66     int transitionTrack() const;
67     void setTransitionTrack(int track);
68     QPixmap transitionPixmap() const;
69     Transition *reparent(ClipItem * clip);
70     bool isValid() const;
71     GenTime transitionDuration() const;
72     const ClipItem *referencedClip() const;
73
74 private:
75
76     GenTime m_transitionStart;
77     GenTime m_transitionDuration;
78     QMap < QString, QString > m_transitionParameters;
79
80     /** The name of the transition used by mlt (composite, luma,...)*/
81     TRANSITIONTYPE m_transitionType;
82
83     /** The name of the transition to be displayed to user */
84     QString m_transitionName;
85
86     /** Should the transition be reversed */
87     bool m_invertTransition;
88
89     bool m_singleClip;
90
91     /** The track to which the transition is attached*/
92     int m_track;
93
94     /** The clip to which the transition is attached */
95     ClipItem *m_referenceClip;
96
97     /** The 2nd clip to which the transition is attached */
98     ClipItem *m_secondClip;
99     int m_transitionTrack;
100
101     /** Return the display name for a transition type */
102     QString getTransitionName(const TRANSITIONTYPE & type);
103
104     /** Return the transition type for a given name */
105     TRANSITIONTYPE getTransitionForName(const QString & type);
106 };
107
108 #endif