Commit 0ce89866 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix slideshow clips displayed as invalid when re-opening project

BUG: 374916
parent 00e86964
......@@ -1617,6 +1617,23 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
}
}
}
if (version < 0.96) {
// Check image sequences with buggy begin frame number
QDomNodeList producers = m_doc.elementsByTagName(QStringLiteral("producer"));
int max = producers.count();
for (int i = 0; i < max; ++i) {
QDomElement prod = producers.at(i).toElement();
if (prod.isNull()) continue;
const QString service = EffectsList::property(prod, QStringLiteral("mlt_service"));
if (service == QLatin1String("pixbuf") || service == QLatin1String("qimage")) {
QString resource = EffectsList::property(prod, QStringLiteral("resource"));
if (resource.contains(QStringLiteral("?begin:"))) {
resource.replace(QStringLiteral("?begin:"), QStringLiteral("?begin="));
EffectsList::setProperty(prod, "resource", resource.toUtf8().constData());
}
}
}
}
m_modified = true;
return true;
......
......@@ -244,7 +244,12 @@ void SlideshowClip::parseFolder()
// find pattern
if (path.contains('?')) {
// New MLT syntax
offset = path.section(':', -1).toInt();
if (path.section('?',1).contains(QLatin1Char(':'))) {
// Old deprecated format
offset = path.section(':', -1).toInt();
} else {
offset = path.section('=', -1).toInt();
}
path = path.section('?', 0, 0);
}
QString filter = QFileInfo(path).fileName();
......@@ -398,7 +403,7 @@ QString SlideshowClip::selectedPath(const QUrl &url, bool isMime, QString extens
}
}
extension = filter + "%0" + QString::number(precision) + 'd' + ext;
if (firstFrame > 0) extension.append(QStringLiteral("?begin:%1").arg(firstFrame));
if (firstFrame > 0) extension.append(QStringLiteral("?begin=%1").arg(firstFrame));
}
//qDebug() << "// FOUND " << (*list).count() << " items for " << url.toLocalFile();
return folder + extension;
......
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