1 #include "definitions.h"
3 QDebug operator << (QDebug qd, const ItemInfo &info)
5 qd << "ItemInfo " << &info;
6 qd << "\tTrack" << info.track;
7 qd << "\tStart pos: " << info.startPos.toString();
8 qd << "\tEnd pos: " << info.endPos.toString();
9 qd << "\tCrop start: " << info.cropStart.toString();
10 qd << "\tCrop duration: " << info.cropDuration.toString();
11 return qd.maybeSpace();
15 MltVideoProfile::MltVideoProfile() :
23 display_aspect_num(0),
24 display_aspect_den(0),
29 bool MltVideoProfile::operator==(const MltVideoProfile &point) const
31 if (!description.isEmpty() && point.description == description) {
34 return point.frame_rate_num == frame_rate_num &&
35 point.frame_rate_den == frame_rate_den &&
36 point.width == width &&
37 point.height == height &&
38 point.progressive == progressive &&
39 point.sample_aspect_num == sample_aspect_num &&
40 point.sample_aspect_den == sample_aspect_den &&
41 point.display_aspect_den == display_aspect_den &&
42 point.colorspace == colorspace;
45 bool MltVideoProfile::operator!=(const MltVideoProfile &other) const {
46 return !(*this == other);
50 EffectInfo::EffectInfo() {isCollapsed = false; groupIndex = -1; groupIsCollapsed = false;}
52 QString EffectInfo::toString() const {
54 // effect collapsed state: 0 = effect not collapsed, 1 = effect collapsed,
55 // 2 = group collapsed - effect not, 3 = group and effect collapsed
56 int collapsedState = (int) isCollapsed;
57 if (groupIsCollapsed) collapsedState += 2;
58 data << QString::number(collapsedState) << QString::number(groupIndex) << groupName;
59 return data.join(QLatin1String("/"));
62 void EffectInfo::fromString(QString value) {
63 if (value.isEmpty()) return;
64 QStringList data = value.split(QLatin1String("/"));
65 isCollapsed = data.at(0).toInt() == 1 || data.at(0).toInt() == 3;
66 groupIsCollapsed = data.at(0).toInt() >= 2;
67 if (data.count() > 1) groupIndex = data.at(1).toInt();
68 if (data.count() > 2) groupName = data.at(2);
72 EffectParameter::EffectParameter(const QString &name, const QString &value): m_name(name), m_value(value) {}
74 QString EffectParameter::name() const {
78 QString EffectParameter::value() const {
82 void EffectParameter::setValue(const QString &value) {
87 EffectsParameterList::EffectsParameterList(): QList < EffectParameter >() {}
89 bool EffectsParameterList::hasParam(const QString &name) const {
90 for (int i = 0; i < size(); ++i)
91 if (at(i).name() == name) return true;
95 void EffectsParameterList::setParamValue(const QString &name, const QString &value) {
97 for (int i = 0; i < size(); ++i)
98 if (at(i).name() == name) {
100 replace(i, EffectParameter(name, value));
103 if (!found) addParam(name, value);
106 QString EffectsParameterList::paramValue(const QString &name, const QString &defaultValue) const {
107 for (int i = 0; i < size(); ++i) {
108 if (at(i).name() == name) return at(i).value();
113 void EffectsParameterList::addParam(const QString &name, const QString &value) {
114 if (name.isEmpty()) return;
115 append(EffectParameter(name, value));
118 void EffectsParameterList::removeParam(const QString &name) {
119 for (int i = 0; i < size(); ++i)
120 if (at(i).name() == name) {
127 CommentedTime::CommentedTime(): t(GenTime(0)), type(0) {}
130 CommentedTime::CommentedTime(const GenTime &time, const QString &comment, int markerType)
131 : t(time), c(comment), type(markerType) { }
133 QString CommentedTime::comment() const {
134 return (c.isEmpty() ? i18n("Marker") : c);
137 GenTime CommentedTime::time() const {
141 void CommentedTime::setComment(const QString &comm) {
145 void CommentedTime::setMarkerType(int t) {
149 int CommentedTime::markerType() const {
153 QColor CommentedTime::markerColor(int type) {
173 bool CommentedTime::operator>(CommentedTime op) const {
174 return t > op.time();
177 bool CommentedTime::operator<(CommentedTime op) const {
178 return t < op.time();
181 bool CommentedTime::operator>=(CommentedTime op) const {
182 return t >= op.time();
185 bool CommentedTime::operator<=(CommentedTime op) const {
186 return t <= op.time();
189 bool CommentedTime::operator==(CommentedTime op) const {
190 return t == op.time();
193 bool CommentedTime::operator!=(CommentedTime op) const {
194 return t != op.time();