Fix missing clips incorrectly recovered on project open

parent 43da76dd
...@@ -893,11 +893,15 @@ void DocumentChecker::fixProxyClip(const QString &id, const QString &oldUrl, con ...@@ -893,11 +893,15 @@ void DocumentChecker::fixProxyClip(const QString &id, const QString &oldUrl, con
QDomNodeList properties; QDomNodeList properties;
for (int i = 0; i < producers.count(); ++i) { for (int i = 0; i < producers.count(); ++i) {
e = producers.item(i).toElement(); e = producers.item(i).toElement();
QString parentId = Xml::getXmlProperty(e, QStringLiteral("kdenlive:id"));
if (parentId.isEmpty()) {
// This is probably an old project file
QString sourceId = e.attribute(QStringLiteral("id")); QString sourceId = e.attribute(QStringLiteral("id"));
QString parentId = sourceId.section(QLatin1Char('_'), 0, 0); parentId = sourceId.section(QLatin1Char('_'), 0, 0);
if (parentId.startsWith(QLatin1String("slowmotion"))) { if (parentId.startsWith(QLatin1String("slowmotion"))) {
parentId = parentId.section(QLatin1Char(':'), 1, 1); parentId = parentId.section(QLatin1Char(':'), 1, 1);
} }
}
if (parentId == id) { if (parentId == id) {
// Fix clip // Fix clip
QString resource = Xml::getXmlProperty(e, QStringLiteral("resource")); QString resource = Xml::getXmlProperty(e, QStringLiteral("resource"));
...@@ -908,7 +912,7 @@ void DocumentChecker::fixProxyClip(const QString &id, const QString &oldUrl, con ...@@ -908,7 +912,7 @@ void DocumentChecker::fixProxyClip(const QString &id, const QString &oldUrl, con
if (resource == oldUrl) { if (resource == oldUrl) {
Xml::setXmlProperty(e, QStringLiteral("resource"), newUrl); Xml::setXmlProperty(e, QStringLiteral("resource"), newUrl);
} }
if (sourceId == id) { if (!Xml::getXmlProperty(e, QStringLiteral("kdenlive:proxy")).isEmpty()) {
// Only set originalurl on master producer // Only set originalurl on master producer
Xml::setXmlProperty(e, QStringLiteral("kdenlive:proxy"), newUrl); Xml::setXmlProperty(e, QStringLiteral("kdenlive:proxy"), newUrl);
} }
...@@ -925,11 +929,15 @@ void DocumentChecker::fixSourceClipItem(QTreeWidgetItem *child, const QDomNodeLi ...@@ -925,11 +929,15 @@ void DocumentChecker::fixSourceClipItem(QTreeWidgetItem *child, const QDomNodeLi
QString id = child->data(0, idRole).toString(); QString id = child->data(0, idRole).toString();
for (int i = 0; i < producers.count(); ++i) { for (int i = 0; i < producers.count(); ++i) {
e = producers.item(i).toElement(); e = producers.item(i).toElement();
QString parentId = Xml::getXmlProperty(e, QStringLiteral("kdenlive:id"));
if (parentId.isEmpty()) {
// This is probably an old project file
QString sourceId = e.attribute(QStringLiteral("id")); QString sourceId = e.attribute(QStringLiteral("id"));
QString parentId = sourceId.section(QLatin1Char('_'), 0, 0); parentId = sourceId.section(QLatin1Char('_'), 0, 0);
if (parentId.startsWith(QLatin1String("slowmotion"))) { if (parentId.startsWith(QLatin1String("slowmotion"))) {
parentId = parentId.section(QLatin1Char(':'), 1, 1); parentId = parentId.section(QLatin1Char(':'), 1, 1);
} }
}
if (parentId == id) { if (parentId == id) {
// Fix clip // Fix clip
QString resource = Xml::getXmlProperty(e, QStringLiteral("resource")); QString resource = Xml::getXmlProperty(e, QStringLiteral("resource"));
...@@ -937,7 +945,7 @@ void DocumentChecker::fixSourceClipItem(QTreeWidgetItem *child, const QDomNodeLi ...@@ -937,7 +945,7 @@ void DocumentChecker::fixSourceClipItem(QTreeWidgetItem *child, const QDomNodeLi
if (resource.contains(QRegExp(QStringLiteral("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$")))) { if (resource.contains(QRegExp(QStringLiteral("\\?[0-9]+\\.[0-9]+(&amp;strobe=[0-9]+)?$")))) {
fixedResource.append(QLatin1Char('?') + resource.section(QLatin1Char('?'), -1)); fixedResource.append(QLatin1Char('?') + resource.section(QLatin1Char('?'), -1));
} }
if (sourceId == id) { if (!Xml::getXmlProperty(e, QStringLiteral("kdenlive:originalurl")).isEmpty()) {
// Only set originalurl on master producer // Only set originalurl on master producer
Xml::setXmlProperty(e, QStringLiteral("kdenlive:originalurl"), fixedResource); Xml::setXmlProperty(e, QStringLiteral("kdenlive:originalurl"), fixedResource);
} }
...@@ -962,7 +970,16 @@ void DocumentChecker::fixClipItem(QTreeWidgetItem *child, const QDomNodeList &pr ...@@ -962,7 +970,16 @@ void DocumentChecker::fixClipItem(QTreeWidgetItem *child, const QDomNodeList &pr
// edit images embedded in titles // edit images embedded in titles
for (int i = 0; i < producers.count(); ++i) { for (int i = 0; i < producers.count(); ++i) {
e = producers.item(i).toElement(); e = producers.item(i).toElement();
if (e.attribute(QStringLiteral("id")).section(QLatin1Char('_'), 0, 0) == id) { QString parentId = Xml::getXmlProperty(e, QStringLiteral("kdenlive:id"));
if (parentId.isEmpty()) {
// This is probably an old project file
QString sourceId = e.attribute(QStringLiteral("id"));
parentId = sourceId.section(QLatin1Char('_'), 0, 0);
if (parentId.startsWith(QLatin1String("slowmotion"))) {
parentId = parentId.section(QLatin1Char(':'), 1, 1);
}
}
if (parentId == id) {
// Fix clip // Fix clip
properties = e.childNodes(); properties = e.childNodes();
for (int j = 0; j < properties.count(); ++j) { for (int j = 0; j < properties.count(); ++j) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment