]> git.sesse.net Git - kdenlive/blob - src/definitions.h
Cleaning code style of Definitions.
[kdenlive] / src / definitions.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef DEFINITIONS_H
22 #define DEFINITIONS_H
23
24 #include "gentime.h"
25 #include "effectslist.h"
26
27 #include <KLocalizedString>
28 #include <QDebug>
29
30 #include <QTreeWidgetItem>
31 #include <QtCore/QString>
32
33 const int MAXCLIPDURATION = 15000;
34
35 namespace Kdenlive {
36
37 enum MonitorId {
38     NoMonitor,
39     ClipMonitor,
40     ProjectMonitor,
41     RecordMonitor,
42     StopMotionMonitor,
43     DvdMonitor
44 };
45
46 const int DefaultThumbHeight = 100;
47 /*
48 const QString clipMonitor("clipMonitor");
49 const QString recordMonitor("recordMonitor");
50 const QString projectMonitor("projectMonitor");
51 const QString stopmotionMonitor("stopmotionMonitor");
52 */
53
54 }
55
56 enum OperationType {
57     None = 0,
58     MoveOperation = 1,
59     ResizeStart = 2,
60     ResizeEnd = 3,
61     FadeIn = 4,
62     FadeOut = 5,
63     TransitionStart = 6,
64     TransitionEnd = 7,
65     MoveGuide = 8,
66     KeyFrame = 9,
67     Seek = 10,
68     Spacer = 11,
69     RubberSelection = 12,
70     ScrollTimeline = 13
71 };
72
73 enum ClipType {
74     Unknown = 0,
75     Audio = 1,
76     Video = 2,
77     AV = 3,
78     Color = 4,
79     Image = 5,
80     Text = 6,
81     SlideShow = 7,
82     Virtual = 8,
83     Playlist = 9
84 };
85
86 enum ProjectItemType {
87     ProjectClipType = QTreeWidgetItem::UserType,
88     ProjectFoldeType,
89     ProjectSubclipType
90 };
91
92 enum GraphicsRectItem {
93     AVWidget = 70000,
94     LabelWidget,
95     TransitionWidget,
96     GroupWidget
97 };
98
99 enum ProjectTool {
100     SelectTool = 0,
101     RazorTool = 1,
102     SpacerTool = 2
103 };
104
105 enum TransitionType {
106     /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
107     LumaTransition = 0,
108     CompositeTransition = 1,
109     PipTransition = 2,
110     LumaFileTransition = 3,
111     MixTransition = 200
112 };
113
114 enum MessageType {
115     DefaultMessage,
116     OperationCompletedMessage,
117     InformationMessage,
118     ErrorMessage,
119     MltError
120 };
121
122 enum TrackType {
123     AudioTrack = 0,
124     VideoTrack = 1
125 };
126
127 enum ClipJobStatus {
128     NoJob = 0,
129     JobWaiting = -1,
130     JobWorking = -2,
131     JobDone = -3,
132     JobCrashed = -4,
133     JobAborted = -5
134 };
135
136 class TrackInfo {
137
138 public:
139     TrackType type;
140     QString trackName;
141     bool isMute;
142     bool isBlind;
143     bool isLocked;
144     EffectsList effectsList;
145     int duration;
146     TrackInfo() :
147         type(VideoTrack),
148         isMute(0),
149         isBlind(0),
150         isLocked(0),
151         duration(0) {}
152 };
153
154 typedef QMap<QString, QString> stringMap;
155 typedef QMap <int, QMap <int, QByteArray> > audioByteArray;
156
157 class ItemInfo {
158 public:
159     /** startPos is the position where the clip starts on the track */
160     GenTime startPos;
161     /** endPos is the duration where the clip ends on the track */
162     GenTime endPos;
163     /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
164     GenTime cropStart;
165     /** cropDuration is the duration of the clip */
166     GenTime cropDuration;
167     int track;
168     ItemInfo() : track(0) {}
169 };
170
171 class TransitionInfo {
172 public:
173     /** startPos is the position where the clip starts on the track */
174     GenTime startPos;
175     /** endPos is the duration where the clip ends on the track */
176     GenTime endPos;
177     /** the track on which the transition is (b_track)*/
178     int b_track;
179     /** the track on which the transition is applied (a_track)*/
180     int a_track;
181     /** Does the user request for a special a_track */
182     bool forceTrack;
183     TransitionInfo() :
184         b_track(0),
185         a_track(0),
186         forceTrack(0) {}
187 };
188
189 class MltVideoProfile {
190 public:
191     QString path;
192     QString description;
193     int frame_rate_num;
194     int frame_rate_den;
195     int width;
196     int height;
197     bool progressive;
198     int sample_aspect_num;
199     int sample_aspect_den;
200     int display_aspect_num;
201     int display_aspect_den;
202     int colorspace;
203     MltVideoProfile();
204     bool operator==(const MltVideoProfile& point) const;
205     bool operator!=(const MltVideoProfile &other) const;
206 };
207
208 /**)
209  * @class EffectInfo
210  * @brief A class holding some meta info for effects widgets, like state (collapsed or not, ...)
211  * @author Jean-Baptiste Mardelle
212  */
213
214 class EffectInfo
215 {
216 public:
217     EffectInfo();
218     bool isCollapsed;
219     bool groupIsCollapsed;
220     int groupIndex;
221     QString groupName;
222     QString toString() const;
223     void fromString(QString value);
224 };
225
226 class EffectParameter
227 {
228 public:
229     EffectParameter(const QString &name, const QString &value);
230     QString name()   const;
231     QString value() const;
232     void setValue(const QString &value);
233
234 private:
235     QString m_name;
236     QString m_value;
237 };
238
239 /** Use our own list for effect parameters so that they are not sorted in any ways, because
240     some effects like sox need a precise order
241 */
242 class EffectsParameterList: public QList < EffectParameter >
243 {
244 public:
245     EffectsParameterList();
246     bool hasParam(const QString &name) const;
247     void setParamValue(const QString &name, const QString &value);
248
249     QString paramValue(const QString &name, const QString &defaultValue = QString()) const;
250     void addParam(const QString &name, const QString &value);
251     void removeParam(const QString &name);
252 };
253
254 class CommentedTime
255 {
256 public:
257     CommentedTime();
258     CommentedTime(const GenTime &time, const QString& comment, int markerType = 0);
259
260     QString comment()   const;
261     GenTime time() const;
262     void    setComment(const QString &comm);
263     void setMarkerType(int t);
264     int markerType() const;
265     static QColor markerColor(int type);
266
267     /* Implementation of > operator; Works identically as with basic types. */
268     bool operator>(CommentedTime op) const;
269     /* Implementation of < operator; Works identically as with basic types. */
270     bool operator<(CommentedTime op) const;
271     /* Implementation of >= operator; Works identically as with basic types. */
272     bool operator>=(CommentedTime op) const;
273     /* Implementation of <= operator; Works identically as with basic types. */
274     bool operator<=(CommentedTime op) const;
275     /* Implementation of == operator; Works identically as with basic types. */
276     bool operator==(CommentedTime op) const;
277     /* Implementation of != operator; Works identically as with basic types. */
278     bool operator!=(CommentedTime op) const;
279
280 private:
281     GenTime t;
282     QString c;
283     int type;
284 };
285
286 QDebug operator << (QDebug qd, const ItemInfo &info);
287
288 #endif