]> git.sesse.net Git - kdenlive/blob - src/transition.h
copy / paste clips and transitions, move several clips
[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 scale, double fps, QDomElement params = QDomElement());
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     Transition *clone();
55     bool hasClip(const ClipItem * clip) const;
56     bool belongsToClip(const ClipItem * clip) const;
57     bool invertedTransition() const;
58     QString transitionName() const;
59     QString transitionTag() const;
60     OPERATIONTYPE operationMode(QPointF pos, double scale);
61     //const QMap < QString, QString > transitionParameters() const;
62     void setTransitionParameters(const QDomElement params);
63     void setTransitionDirection(bool inv);
64     void setTransitionTrack(int track);
65     QPixmap transitionPixmap() const;
66     //Transition *reparent(ClipItem * clip);
67     bool isValid() const;
68     /** Transition should be linked to another track */
69     void updateTransitionEndTrack(int newtrack);
70     const ClipItem *referencedClip() const;
71     Transition *clone(double scale);
72 private:
73     bool m_singleClip;
74     QLinearGradient m_gradient;
75     QString m_name;
76     /** contains the transition parameters */
77     QDomElement m_parameters;
78     /** The clip to which the transition is attached */
79     ClipItem *m_referenceClip;
80
81     /** The 2nd clip to which the transition is attached */
82     ClipItem *m_secondClip;
83     int m_transitionTrack;
84
85     /** Return the display name for a transition type */
86     QString getTransitionName(const TRANSITIONTYPE & type);
87
88     /** Return the transition type for a given name */
89     TRANSITIONTYPE getTransitionForName(const QString & type);
90 };
91
92 #endif