}
}
}
- QString titleData = txtdoc.toString();
- prod.setAttribute("xmldata", titleData);
prod.setAttribute("transparency", 1);
prod.setAttribute("in", 0);
- int out = txtdoc.documentElement().attribute("out").toInt();
- if (out > 0)
- prod.setAttribute("out", out);
- else
- prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
+ if (!txtdoc.documentElement().hasAttribute("out")) {
+ prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
+ txtdoc.documentElement().setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
+ }
+ else {
+ int out = txtdoc.documentElement().attribute("out").toInt();
+ if (out >= 0)
+ prod.setAttribute("out", out);
+ else {
+ prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
+ txtdoc.documentElement().setAttribute("out", m_doc->getFramePos(KdenliveSettings::title_duration()) - 1);
+ }
+ }
+ QString titleData = txtdoc.toString();
+ prod.setAttribute("xmldata", titleData);
} else
txtfile.close();
}
prod.setAttribute("transparency", "1");
prod.setAttribute("in", "0");
- int out = 0;
+ int duration = 0;
QDomDocument titledoc;
QFile txtfile(path.path());
if (txtfile.open(QIODevice::ReadOnly) && titledoc.setContent(&txtfile)) {
txtfile.close();
- out = titledoc.documentElement().attribute("out").toInt();
+ if (titledoc.documentElement().hasAttribute("duration")) {
+ duration = titledoc.documentElement().attribute("duration").toInt();
+ }
+ else {
+ // keep some time for backwards compatibility - 26/12/12
+ duration = titledoc.documentElement().attribute("out").toInt();
+ }
} else txtfile.close();
- if (out == 0) out = m_doc->getFramePos(KdenliveSettings::image_duration());
- prod.setAttribute("out", out);
+ if (duration == 0) duration = m_doc->getFramePos(KdenliveSettings::title_duration());
+ prod.setAttribute("out", duration - 1);
AddClipCommand *command = new AddClipCommand(m_doc, doc.documentElement(), QString::number(id), true);
m_doc->commandStack()->push(command);