]> git.sesse.net Git - kdenlive/blob - src/transition.h
Various fixes to improve general stability in Qt 4.5.2
[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
27 #include "gentime.h"
28 #include "definitions.h"
29 #include "abstractclipitem.h"
30
31
32 /**Describes a Transition, with a name, parameters keyframes, etc.
33   *@author Jean-Baptiste Mardelle
34   */
35
36 class ClipItem;
37
38 class Transition : public AbstractClipItem
39 {
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     //Transition *reparent(ClipItem * clip);
65     bool isValid() const;
66     /** Transition should be linked to another track */
67     void updateTransitionEndTrack(int newtrack);
68     void setForcedTrack(bool force, int track);
69     bool forcedTrack() const;
70     const ClipItem *referencedClip() const;
71     Transition *clone();
72     bool isAutomatic() const;
73     void setAutomatic(bool automatic);
74     bool hasGeometry();
75
76 protected:
77     virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
78
79 private:
80     QString m_name;
81     bool m_forceTransitionTrack;
82
83     /** true if the transition was added automatically and should be moved with its clip */
84     bool m_automaticTransition;
85     /** contains the transition parameters */
86     QDomElement m_parameters;
87     /** The clip to which the transition is attached */
88     ClipItem *m_referenceClip;
89
90     /** The 2nd clip to which the transition is attached */
91     ClipItem *m_secondClip;
92     int m_transitionTrack;
93
94     /** Return the display name for a transition type */
95     QString getTransitionName(const TRANSITIONTYPE & type);
96
97     /** Return the transition type for a given name */
98     TRANSITIONTYPE getTransitionForName(const QString & type);
99 };
100
101 #endif