Fix issues on clip reload: slideshow clips broken and title duration reset

parent 605b3ba2
Pipeline #6355 passed with stage
in 13 minutes
......@@ -327,7 +327,7 @@ void ProjectClip::reloadProducer(bool refreshOnly, bool audioStreamChanged)
pCore->jobManager()->discardJobs(clipId(), AbstractClipJob::THUMBJOB);
m_thumbsProducer.reset();
ClipType::ProducerType type = clipType();
if (type != ClipType::Color && type != ClipType::Image) {
if (type != ClipType::Color && type != ClipType::Image && type != ClipType::SlideShow) {
xml.removeAttribute("out");
}
ThumbnailCache::get()->invalidateThumbsForClip(clipId());
......
......@@ -268,21 +268,40 @@ bool LoadJob::startJob()
break;
case ClipType::Text:
case ClipType::TextTemplate: {
QFile txtfile(m_resource);
QDomDocument txtdoc(QStringLiteral("titledocument"));
if (txtfile.open(QIODevice::ReadOnly) && txtdoc.setContent(&txtfile)) {
txtfile.close();
if (txtdoc.documentElement().hasAttribute(QStringLiteral("duration"))) {
duration = txtdoc.documentElement().attribute(QStringLiteral("duration")).toInt();
} else if (txtdoc.documentElement().hasAttribute(QStringLiteral("out"))) {
duration = txtdoc.documentElement().attribute(QStringLiteral("out")).toInt();
m_producer = loadResource(m_resource, QStringLiteral("kdenlivetitle:"));
bool ok;
QString pLength = Xml::getXmlProperty(m_xml, QStringLiteral("length"));
int producerLength = pLength.toInt(&ok);
if (!ok) {
producerLength = m_producer->time_to_frames(pLength.toUtf8().constData());
}
if (!m_resource.isEmpty()) {
// Title from .kdenlivetitle file
QFile txtfile(m_resource);
QDomDocument txtdoc(QStringLiteral("titledocument"));
if (txtfile.open(QIODevice::ReadOnly) && txtdoc.setContent(&txtfile)) {
txtfile.close();
if (txtdoc.documentElement().hasAttribute(QStringLiteral("duration"))) {
duration = txtdoc.documentElement().attribute(QStringLiteral("duration")).toInt();
} else if (txtdoc.documentElement().hasAttribute(QStringLiteral("out"))) {
duration = txtdoc.documentElement().attribute(QStringLiteral("out")).toInt();
}
}
} else {
QString xmlDuration = Xml::getXmlProperty(m_xml, QStringLiteral("kdenlive:duration"));
duration = xmlDuration.toInt(&ok);
if (!ok) {
// timecode duration
duration = m_producer->time_to_frames(xmlDuration.toUtf8().constData());
}
}
m_producer = loadResource(m_resource, QStringLiteral("kdenlivetitle:"));
if (duration <= 0) {
duration = pCore->currentDoc()->getFramePos(KdenliveSettings::title_duration()) - 1;
duration = pCore->currentDoc()->getFramePos(KdenliveSettings::title_duration());
}
if (producerLength <= 0) {
producerLength = duration;
}
m_producer->set("length", duration);
m_producer->set("length", producerLength);
m_producer->set("kdenlive:duration", duration);
m_producer->set("out", duration - 1);
}
......
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