]> git.sesse.net Git - kdenlive/blob - src/transition.h
dynamic read transition names and fill transitionlist
[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 <qdom.h>
25 #include <QMap>
26
27 #include "gentime.h"
28 #include "definitions.h"
29 #include "abstractclipitem.h"
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 : public AbstractClipItem {
38     Q_OBJECT
39 public:
40
41     Transition(const QRectF&, ClipItem * clipa, const QString& type, const GenTime &startTime, const GenTime &endTime, double fps, bool inverted = false);
42     Transition(const QRectF&, ClipItem * clip, QDomElement transitionElement, double fps, GenTime offset = GenTime());
43     virtual ~Transition();
44     virtual void paint(QPainter *painter,
45                        const QStyleOptionGraphicsItem *option,
46                        QWidget *widget);
47     virtual int type() const;
48     /** Returns an XML representation of this transition. */
49     QDomElement toXML();
50
51     GenTime transitionStartTime() const;
52     GenTime transitionEndTime() const;
53     /** Return the track number of transition in the playlist*/
54     int transitionStartTrack() const;
55     int transitionEndTrack() const;
56     Transition *clone();
57     bool hasClip(const ClipItem * clip) const;
58     bool belongsToClip(const ClipItem * clip) const;
59     void resizeTransitionEnd(GenTime time);
60     void resizeTransitionStart(GenTime time);
61     void moveTransition(GenTime time);
62     bool invertTransition() const;
63     QString transitionName() const;
64     OPERATIONTYPE operationMode(QPointF pos, double scale);
65     void setTransitionType(QString newType);
66     const QMap < QString, QString > transitionParameters() const;
67     void setTransitionParameters(const QMap < QString, QString > parameters);
68     void setTransitionDirection(bool inv);
69     int transitionTrack() const;
70     void setTransitionTrack(int track);
71     QPixmap transitionPixmap() const;
72     Transition *reparent(ClipItem * clip);
73     bool isValid() const;
74     GenTime transitionDuration() const;
75     const ClipItem *referencedClip() const;
76
77 private:
78
79     GenTime m_transitionStart;
80     GenTime m_transitionDuration;
81     QMap < QString, QString > m_transitionParameters;
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