]> git.sesse.net Git - kdenlive/blob - src/definitions.h
Make project folders have a smaller icon, disable titles if the MLT kdenlivetitle...
[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
26 #include <QTreeWidgetItem>
27 #include <KLocale>
28
29 const int FRAME_SIZE = 90;
30 const int MAXCLIPDURATION = 15000;
31
32 enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5, TRANSITIONSTART = 6, TRANSITIONEND = 7, MOVEGUIDE = 8, KEYFRAME = 9, SEEK = 10, SPACER = 11, RUBBERSELECTION = 12};
33 enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9 };
34
35 enum PROJECTITEMTYPE { PROJECTCLIPTYPE = QTreeWidgetItem::UserType, PROJECTFOLDERTYPE, PROJECTSUBCLIPTYPE };
36
37 enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET  , GROUPWIDGET};
38
39 enum PROJECTTOOL { SELECTTOOL = 0 , RAZORTOOL = 1 , SPACERTOOL = 2 };
40
41 enum TRANSITIONTYPE {
42     /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
43     LUMA_TRANSITION = 0,
44     COMPOSITE_TRANSITION = 1,
45     PIP_TRANSITION = 2,
46     LUMAFILE_TRANSITION = 3,
47     MIX_TRANSITION = 200
48 };
49
50 enum MessageType {
51     DefaultMessage,
52     OperationCompletedMessage,
53     InformationMessage,
54     ErrorMessage,
55     MltError
56 };
57
58 enum TRACKTYPE { AUDIOTRACK = 0, VIDEOTRACK = 1 };
59
60 struct TrackInfo {
61     TRACKTYPE type;
62     QString trackName;
63     bool isMute;
64     bool isBlind;
65     bool isLocked;
66 };
67
68 struct ItemInfo {
69     /** startPos is the position where the clip starts on the track */
70     GenTime startPos;
71     /** endPos is the duration where the clip ends on the track */
72     GenTime endPos;
73     /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
74     GenTime cropStart;
75     /** cropDuration is the duration of the clip */
76     GenTime cropDuration;
77     int track;
78 };
79
80 struct MltVideoProfile {
81     QString path;
82     QString description;
83     int frame_rate_num;
84     int frame_rate_den;
85     int width;
86     int height;
87     bool progressive;
88     int sample_aspect_num;
89     int sample_aspect_den;
90     int display_aspect_num;
91     int display_aspect_den;
92 };
93
94
95 class EffectParameter
96 {
97 public:
98     EffectParameter(const QString name, const QString value): m_name(name), m_value(value) {}
99     QString name()   const          {
100         return m_name;
101     }
102     QString value() const          {
103         return m_value;
104     }
105     void setValue(const QString value) {
106         m_value = value;
107     }
108
109 private:
110     QString m_name;
111     QString m_value;
112 };
113
114 /** Use our own list for effect parameters so that they are not sorted in any ways, because
115     some effects like sox need a precise order
116 */
117 class EffectsParameterList: public QList < EffectParameter >
118 {
119 public:
120     EffectsParameterList(): QList < EffectParameter >() {}
121     bool hasParam(const QString name) const {
122         for (int i = 0; i < size(); i++)
123             if (at(i).name() == name) return true;
124         return false;
125     }
126     QString paramValue(const QString name, QString defaultValue = QString()) const {
127         for (int i = 0; i < size(); i++) {
128             if (at(i).name() == name) return at(i).value();
129         }
130         return defaultValue;
131     }
132     void addParam(const QString &name, const QString &value) {
133         if (name.isEmpty()) return;
134         append(EffectParameter(name, value));
135     }
136     void removeParam(const QString name) {
137         for (int i = 0; i < size(); i++)
138             if (at(i).name() == name) {
139                 removeAt(i);
140                 break;
141             }
142     }
143 };
144
145 class CommentedTime
146 {
147 public:
148     CommentedTime(): t(GenTime(0)) {}
149     CommentedTime(const GenTime time, QString comment)
150             : t(time), c(comment) { }
151
152     QString comment()   const          {
153         return (c.isEmpty() ? i18n("Marker") : c);
154     }
155     GenTime time() const          {
156         return t;
157     }
158     void    setComment(QString comm) {
159         c = comm;
160     }
161
162     /* Implementation of > operator; Works identically as with basic types. */
163     bool operator>(CommentedTime op) const {
164         return t > op.time();
165     }
166     /* Implementation of < operator; Works identically as with basic types. */
167     bool operator<(CommentedTime op) const {
168         return t < op.time();
169     }
170     /* Implementation of >= operator; Works identically as with basic types. */
171     bool operator>=(CommentedTime op) const {
172         return t >= op.time();
173     }
174     /* Implementation of <= operator; Works identically as with basic types. */
175     bool operator<=(CommentedTime op) const {
176         return t <= op.time();
177     }
178     /* Implementation of == operator; Works identically as with basic types. */
179     bool operator==(CommentedTime op) const {
180         return t == op.time();
181     }
182     /* Implementation of != operator; Works identically as with basic types. */
183     bool operator!=(CommentedTime op) const {
184         return t != op.time();
185     }
186
187 private:
188     GenTime t;
189     QString c;
190
191
192 };
193
194
195 #endif