CuteLogger
Fast and simple logging solution for Qt based applications
qmlmetadata.h
1/*
2 * Copyright (c) 2013-2022 Meltytech, LLC
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 3 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, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef QMLMETADATA_H
19#define QMLMETADATA_H
20
21#include <QObject>
22#include <QString>
23#include <QDir>
24#include <QUrl>
25#include <QQmlListProperty>
26
27class QmlKeyframesParameter : public QObject
28{
29 Q_OBJECT
30 Q_ENUMS(RangeType)
31 Q_PROPERTY(RangeType rangeType MEMBER m_rangeType NOTIFY changed)
32 Q_PROPERTY(QString name MEMBER m_name NOTIFY changed)
33 Q_PROPERTY(QString property MEMBER m_property NOTIFY changed)
34 Q_PROPERTY(QStringList gangedProperties MEMBER m_gangedProperties NOTIFY changed)
35 Q_PROPERTY(bool isCurve MEMBER m_isCurve NOTIFY changed)
36 Q_PROPERTY(double minimum MEMBER m_minimum NOTIFY changed)
37 Q_PROPERTY(double maximum MEMBER m_maximum NOTIFY changed)
38 Q_PROPERTY(QString units MEMBER m_units NOTIFY changed)
39 Q_PROPERTY(bool isRectangle MEMBER m_isRectangle NOTIFY changed)
40
41public:
42 enum RangeType {
43 MinMax,
44 ClipLength,
45 };
46 explicit QmlKeyframesParameter(QObject *parent = 0);
47
48 QString name() const
49 {
50 return m_name;
51 }
52 QString property() const
53 {
54 return m_property;
55 }
56 QStringList gangedProperties() const
57 {
58 return m_gangedProperties;
59 }
60 bool isCurve() const
61 {
62 return m_isCurve;
63 }
64 double minimum() const
65 {
66 return m_minimum;
67 }
68 double maximum() const
69 {
70 return m_maximum;
71 }
72 QString units() const
73 {
74 return m_units;
75 }
76 bool isRectangle() const
77 {
78 return m_isRectangle;
79 }
80 RangeType rangeType() const
81 {
82 return m_rangeType;
83 }
84
85signals:
86 void changed();
87
88private:
89 QString m_name;
90 QString m_property;
91 QStringList m_gangedProperties;
92 bool m_isCurve;
93 double m_minimum;
94 double m_maximum;
95 QString m_units;
96 bool m_isRectangle;
97 RangeType m_rangeType;
98};
99
100class QmlKeyframesMetadata : public QObject
101{
102 Q_OBJECT
103 Q_PROPERTY(bool allowTrim MEMBER m_allowTrim NOTIFY changed)
104 Q_PROPERTY(bool allowAnimateIn MEMBER m_allowAnimateIn NOTIFY changed)
105 Q_PROPERTY(bool allowAnimateOut MEMBER m_allowAnimateOut NOTIFY changed)
106 Q_PROPERTY(QQmlListProperty<QmlKeyframesParameter> parameters READ parameters NOTIFY changed)
108 Q_PROPERTY(QList<QString> simpleProperties MEMBER m_simpleProperties NOTIFY changed)
109 Q_PROPERTY(QString minimumVersion MEMBER m_minimumVersion NOTIFY changed)
110 Q_PROPERTY(bool enabled MEMBER m_enabled NOTIFY changed)
111 Q_PROPERTY(bool allowSmooth MEMBER m_allowSmooth NOTIFY changed)
112
113public:
114 explicit QmlKeyframesMetadata(QObject *parent = 0);
115
116 bool allowTrim() const
117 {
118 return m_allowTrim;
119 }
120 bool allowAnimateIn() const
121 {
122 return m_allowAnimateIn;
123 }
124 bool allowAnimateOut() const
125 {
126 return m_allowAnimateOut;
127 }
128 QList<QString> simpleProperties() const
129 {
130 return m_simpleProperties;
131 }
132
133 QQmlListProperty<QmlKeyframesParameter> parameters()
134 {
135 return QQmlListProperty<QmlKeyframesParameter>(this, &m_parameters);
136 }
137 int parameterCount() const
138 {
139 return m_parameters.count();
140 }
141 QmlKeyframesParameter *parameter(int index) const
142 {
143 return m_parameters[index];
144 }
145 void checkVersion(const QString &version);
146 void setDisabled();
147
148signals:
149 void changed();
150
151private:
152 bool m_allowTrim;
153 bool m_allowAnimateIn;
154 bool m_allowAnimateOut;
155 QList<QmlKeyframesParameter *> m_parameters;
156 QList<QString> m_simpleProperties;
157 QString m_minimumVersion;
158 bool m_enabled;
159 bool m_allowSmooth;
160};
161
162
163class QmlMetadata : public QObject
164{
165 Q_OBJECT
166 Q_ENUMS(PluginType)
167 Q_PROPERTY(PluginType type READ type WRITE setType NOTIFY changed)
168 Q_PROPERTY(QString name READ name WRITE setName NOTIFY changed)
169 Q_PROPERTY(QString mlt_service READ mlt_service WRITE set_mlt_service)
170 Q_PROPERTY(bool needsGPU READ needsGPU WRITE setNeedsGPU NOTIFY changed)
171 Q_PROPERTY(QString qml READ qmlFileName WRITE setQmlFileName)
172 Q_PROPERTY(QString vui READ vuiFileName WRITE setVuiFileName)
173 Q_PROPERTY(QUrl qmlFilePath READ qmlFilePath )
174 Q_PROPERTY(QUrl vuiFilePath READ vuiFilePath )
175 Q_PROPERTY(bool isAudio READ isAudio WRITE setIsAudio NOTIFY changed)
176 Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY changed)
177 Q_PROPERTY(bool isFavorite READ isFavorite WRITE setIsFavorite NOTIFY changed)
178 Q_PROPERTY(QString gpuAlt READ gpuAlt WRITE setGpuAlt NOTIFY changed)
179 Q_PROPERTY(bool allowMultiple READ allowMultiple WRITE setAllowMultiple)
180 Q_PROPERTY(bool isClipOnly READ isClipOnly WRITE setIsClipOnly)
181 Q_PROPERTY(bool isGpuCompatible READ isGpuCompatible() WRITE setIsGpuCompatible)
182 Q_PROPERTY(QmlKeyframesMetadata *keyframes READ keyframes NOTIFY changed)
183 Q_PROPERTY(bool isDeprecated READ isDeprecated WRITE setIsDeprecated)
184 Q_PROPERTY(QString minimumVersion MEMBER m_minimumVersion NOTIFY changed)
185 Q_PROPERTY(QString keywords MEMBER m_keywords NOTIFY changed)
186 Q_PROPERTY(QUrl icon READ iconFilePath WRITE setIconFileName NOTIFY changed)
187
188public:
189 enum PluginType {
190 Filter,
191 Producer,
192 Transition,
193 Link,
194 };
195 unsigned filterMask;
196
197 explicit QmlMetadata(QObject *parent = 0);
198 void loadSettings();
199
200 PluginType type() const
201 {
202 return m_type;
203 }
204 void setType(PluginType);
205 QString name() const
206 {
207 return m_name;
208 }
209 void setName(const QString &);
210 QString mlt_service() const
211 {
212 return m_mlt_service;
213 }
214 void set_mlt_service(const QString &);
215 QString uniqueId() const;
216 bool needsGPU() const
217 {
218 return m_needsGPU;
219 }
220 void setNeedsGPU(bool);
221 QString qmlFileName() const
222 {
223 return m_qmlFileName;
224 }
225 void setQmlFileName(const QString &);
226 QString vuiFileName() const
227 {
228 return m_vuiFileName;
229 }
230 void setVuiFileName(const QString &);
231 QDir path() const
232 {
233 return m_path;
234 }
235 void setPath(const QDir &path);
236 QUrl qmlFilePath() const;
237 QUrl vuiFilePath() const;
238 QUrl iconFilePath() const
239 {
240 return m_icon;
241 }
242 void setIconFileName(const QUrl &);
243 bool isAudio() const
244 {
245 return m_isAudio;
246 }
247 void setIsAudio(bool isAudio);
248 bool isHidden() const
249 {
250 return m_isHidden;
251 }
252 void setIsHidden(bool isHidden);
253 bool isFavorite() const
254 {
255 return m_isFavorite;
256 }
257 void setIsFavorite(bool isFavorite);
258 QString gpuAlt() const
259 {
260 return m_gpuAlt;
261 }
262 void setGpuAlt(const QString &);
263 bool allowMultiple() const
264 {
265 return m_allowMultiple;
266 }
267 void setAllowMultiple(bool allowMultiple);
268 bool isClipOnly() const
269 {
270 return m_isClipOnly;
271 }
272 void setIsClipOnly(bool isClipOnly);
273 bool isGpuCompatible() const
274 {
275 return m_isGpuCompatible;
276 }
277 void setIsGpuCompatible(bool isCompatible)
278 {
279 m_isGpuCompatible = isCompatible;
280 }
281 QmlKeyframesMetadata *keyframes()
282 {
283 return &m_keyframes;
284 }
285 const QmlKeyframesMetadata *keyframes() const
286 {
287 return &m_keyframes;
288 }
289 bool isDeprecated() const
290 {
291 return m_isDeprecated;
292 }
293 void setIsDeprecated(bool deprecated)
294 {
295 m_isDeprecated = deprecated;
296 }
297 bool isMltVersion(const QString &version);
298 QString keywords() const
299 {
300 return m_keywords;
301 }
302
303signals:
304 void changed();
305
306private:
307 PluginType m_type;
308 QString m_name;
309 QString m_mlt_service;
310 bool m_needsGPU;
311 QString m_qmlFileName;
312 QString m_vuiFileName;
313 QDir m_path;
314 bool m_isAudio;
315 bool m_isHidden;
316 bool m_isFavorite;
317 QString m_gpuAlt;
318 bool m_allowMultiple;
319 bool m_isClipOnly;
320 bool m_isGpuCompatible;
321 QmlKeyframesMetadata m_keyframes;
322 bool m_isDeprecated;
323 QString m_minimumVersion;
324 QString m_keywords;
325 QUrl m_icon;
326};
327
328#endif // QMLMETADATA_H