#include <mlt++/Mlt.h>
-const double DOCUMENTVERSION = 0.86;
+const double DOCUMENTVERSION = 0.87;
KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, QMap <QString, QString> properties, const QPoint tracks, Render *render, KTextEdit *notes, bool *openBackup, MainWindow *parent, KProgressDialog *progressDialog) :
QObject(parent),
QDomElement mlt = m_document.firstChildElement("mlt");
QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
+ // Set profile, fps, etc for the document
+ setProfilePath(infoXml.attribute("profile"));
+
// Check embedded effects
QDomElement customeffects = infoXml.firstChildElement("customeffects");
if (!customeffects.isNull() && customeffects.hasChildNodes()) {
QDomNamedNodeMap props = docproperties.attributes();
for (int i = 0; i < props.count(); i++)
m_documentProperties.insert(props.item(i).nodeName(), props.item(i).nodeValue());
- setProfilePath(infoXml.attribute("profile"));
+
if (validator.isModified()) setModified(true);
kDebug() << "Reading file: " << url.path() << ", found clips: " << producers.count();
}
}
}
}
-
+
// Something went wrong, or a new file was requested: create a new project
if (!success) {
m_url.clear();
m_document = createEmptyDocument(tracks.x(), tracks.y());
}
- // Set the video profile (empty == default)
- KdenliveSettings::setCurrent_profile(profilePath());
-
// Ask to create the project directory if it does not exist
if (!QFile::exists(m_projectFolder.path())) {
int create = KMessageBox::questionYesNo(parent, i18n("Project directory %1 does not exist. Create it?", m_projectFolder.path()));
int KdenliveDoc::setSceneList()
{
- m_render->resetProfile(KdenliveSettings::current_profile());
+ m_render->resetProfile(KdenliveSettings::current_profile(), true);
if (m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt()) == -1) {
// INVALID MLT Consumer, something is wrong
return -1;
QDomDocument doc;
QDomElement mlt = doc.createElement("mlt");
doc.appendChild(mlt);
-
-
+
// Create black producer
// For some unknown reason, we have to build the black producer here and not in renderer.cpp, otherwise
// the composite transitions with the black track are corrupted.
property = doc.createElement("property");
property.setAttribute("name", "aspect_ratio");
- value = doc.createTextNode(QString::number(0.0));
+ value = doc.createTextNode(QString::number(0));
property.appendChild(value);
blk.appendChild(property);
m_height = m_profile.height;
kDebug() << "Kdenlive document, init timecode from path: " << path << ", " << m_fps;
m_timecode.setFormat(m_fps);
+ KdenliveSettings::setCurrent_profile(m_profile.path);
return (current_fps != m_fps);
}
void KdenliveDoc::setModified(bool mod)
{
+ if (isReadOnly()) return;
if (!m_url.isEmpty() && mod && KdenliveSettings::crashrecovery()) {
m_autoSaveTimer->start(3000);
}
QDomElement e = params.item(i).toElement();
// Check if this effect has a variable parameter
- if (e.attribute("default").startsWith('%')) {
+ if (e.attribute("default").contains('%')) {
double evaluatedValue = ProfilesDialog::getStringEval(m_profile, e.attribute("default"));
e.setAttribute("default", evaluatedValue);
if (e.hasAttribute("value") && e.attribute("value").startsWith('%')) {
}
}
+bool KdenliveDoc::isReadOnly() const
+{
+ return m_documentProperties.contains("readonly");
+}
+
void KdenliveDoc::cleanupBackupFiles()
{
KUrl backupFile = m_projectFolder;