m_properties.insert(attributes.item(i).nodeName(), attributes.item(i).nodeValue());
}
+ if (xml.hasAttribute("cutzones")) {
+ QStringList cuts = xml.attribute("cutzones").split(";", QString::SkipEmptyParts);
+ for (int i = 0; i < cuts.count(); i++) {
+ QString z = cuts.at(i);
+ addCutZone(z.section('-', 0, 0).toInt(), z.section('-', 1, 1).toInt());
+ }
+ }
+
KUrl url = KUrl(xml.attribute("resource"));
if (!m_properties.contains("file_hash") && !url.isEmpty()) getFileHash(url.path());
if (!i.value().isEmpty()) clip.setAttribute(i.key(), i.value());
}
doc.appendChild(clip);
+ if (!m_cutZones.isEmpty()) {
+ QStringList cuts;
+ for (int i = 0; i < m_cutZones.size(); i++) {
+ cuts << QString::number(m_cutZones.at(i).x()) + "-" + QString::number(m_cutZones.at(i).y());
+ }
+ clip.setAttribute("cutzones", cuts.join(";"));
+ }
//kDebug() << "/// CLIP XML: " << doc.toString();
return doc.documentElement();
}
QList < GenTime > markers;
for (int count = 0; count < m_snapMarkers.count(); ++count) {
- markers.append(m_snapMarkers[count].time());
+ markers.append(m_snapMarkers.at(count).time());
}
return markers;
{
int it;
for (it = 0; it < m_snapMarkers.count(); it++) {
- if (m_snapMarkers[it].time() >= currTime)
+ if (m_snapMarkers.at(it).time() >= currTime)
break;
}
if (it == 0) return GenTime();
- else if (it == m_snapMarkers.count() - 1 && m_snapMarkers[it].time() < currTime)
- return m_snapMarkers[it].time();
- else return m_snapMarkers[it-1].time();
+ else if (it == m_snapMarkers.count() - 1 && m_snapMarkers.at(it).time() < currTime)
+ return m_snapMarkers.at(it).time();
+ else return m_snapMarkers.at(it -1).time();
}
GenTime DocClipBase::findNextSnapMarker(const GenTime & currTime)
{
int it;
for (it = 0; it < m_snapMarkers.count(); it++) {
- if (m_snapMarkers[it].time() > currTime)
+ if (m_snapMarkers.at(it).time() > currTime)
break;
}
- if (it < m_snapMarkers.count() && m_snapMarkers[it].time() > currTime) return m_snapMarkers[it].time();
+ if (it < m_snapMarkers.count() && m_snapMarkers.at(it).time() > currTime) return m_snapMarkers.at(it).time();
return duration();
}
deleteProducers();
}
QString id = producer->get("id");
- kDebug() << "// set prod: " << id;
if (id.contains('_')) {
// this is a subtrack producer, insert it at correct place
id = id.section('_', 1);
} else if (key == "force_aspect_ratio") {
if (value.isEmpty()) {
m_properties.remove("force_aspect_ratio");
+ //TODO: find a was to remove the "force_aspect_ratio" property from producer, currently does not work
setProducerProperty("force_aspect_ratio", 0);
} else setProducerProperty("force_aspect_ratio", value.toDouble());
} else if (key == "threads") {
return m_placeHolder;
}
+void DocClipBase::addCutZone(int in, int out)
+{
+ if (!m_cutZones.contains(QPoint(in, out))) {
+ m_cutZones.append(QPoint(in, out));
+ }
+}
+
+bool DocClipBase::hasCutZone(QPoint p) const
+{
+ return m_cutZones.contains(p);
+}
+
+
+void DocClipBase::removeCutZone(int in, int out)
+{
+ m_cutZones.removeAll(QPoint(in, out));
+}
+
+void DocClipBase::updateCutZone(int oldin, int oldout, int in, int out)
+{
+ QPoint old(oldin, oldout);
+ for (int i = 0; i < m_cutZones.size(); ++i) {
+ if (m_cutZones.at(i) == old) {
+ m_cutZones.replace(i, QPoint(in, out));
+ break;
+ }
+ }
+}
+
+QList <QPoint> DocClipBase::cutZones() const
+{
+ return m_cutZones;
+}
+