// init default document properties
m_documentProperties["zoom"] = "7";
+ m_documentProperties["verticalzoom"] = "1";
m_documentProperties["zonein"] = "0";
m_documentProperties["zoneout"] = "100";
// TODO: backup the document or alert the user?
success = validator.validate(DOCUMENTVERSION);
if (success) { // Let the validator handle error messages
- setModified(validator.isModified());
QDomElement mlt = m_document.firstChildElement("mlt");
QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
profileName = infoXml.attribute("profile");
- m_projectFolder = infoXml.attribute("projectfolder");
+ m_projectFolder = KUrl(infoXml.attribute("projectfolder"));
QDomElement docproperties = infoXml.firstChildElement("documentproperties");
QDomNamedNodeMap props = docproperties.attributes();
for (int i = 0; i < props.count(); i++) {
infoXml.removeChild(markers);
}
setProfilePath(profileName);
+ setModified(validator.isModified());
kDebug() << "Reading file: " << url.path() << ", found clips: " << producers.count();
}
}
}
}
-void KdenliveDoc::setSceneList()
+int KdenliveDoc::setSceneList()
{
- m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt());
+ if (m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt()) == -1) {
+ // INVALID MLT Consumer, something is wrong
+ return -1;
+ }
m_documentProperties.remove("position");
// m_document xml is now useless, clear it
m_document.clear();
checkProjectClips();
+ return 0;
}
QDomDocument KdenliveDoc::createEmptyDocument(const int videotracks, const int audiotracks)
}
}
-void KdenliveDoc::setZoom(int factor)
+void KdenliveDoc::setZoom(int horizontal, int vertical)
{
- m_documentProperties["zoom"] = QString::number(factor);
+ m_documentProperties["zoom"] = QString::number(horizontal);
+ m_documentProperties["verticalzoom"] = QString::number(vertical);
}
-int KdenliveDoc::zoom() const
+QPoint KdenliveDoc::zoom() const
{
- return m_documentProperties.value("zoom").toInt();
+ return QPoint(m_documentProperties.value("zoom").toInt(), m_documentProperties.value("verticalzoom").toInt());
}
void KdenliveDoc::setZone(int start, int end)
kDebug() << "+++++++++++++ + + + + CHK PCLIPS";
if (m_render == NULL) return;
m_clipManager->resetProducersList(m_render->producersList());
- return;
-
- // Useless now...
- QList <Mlt::Producer *> prods = m_render->producersList();
- QString id ;
- QString prodId ;
- QString prodTrack ;
- for (int i = 0; i < prods.count(); i++) {
- id = prods.at(i)->get("id");
- prodId = id.section('_', 0, 0);
- prodTrack = id.section('_', 1, 1);
- DocClipBase *clip = m_clipManager->getClipById(prodId);
- if (clip) clip->setProducer(prods.at(i));
- if (clip && clip->clipType() == TEXT && !QFile::exists(clip->fileURL().path())) {
- // regenerate text clip image if required
- //kDebug() << "// TITLE: " << clip->getProperty("titlename") << " Preview file: " << clip->getProperty("resource") << " DOES NOT EXIST";
- QString titlename = clip->getProperty("name");
- QString titleresource;
- if (titlename.isEmpty()) {
- QStringList titleInfo = TitleWidget::getFreeTitleInfo(projectFolder());
- titlename = titleInfo.at(0);
- titleresource = titleInfo.at(1);
- clip->setProperty("name", titlename);
- kDebug() << "// New title set to: " << titlename;
- } else {
- titleresource = TitleWidget::getFreeTitleInfo(projectFolder()).at(1);
- //titleresource = TitleWidget::getTitleResourceFromName(projectFolder(), titlename);
- }
- TitleWidget *dia_ui = new TitleWidget(KUrl(), KUrl(titleresource).directory(), m_render, kapp->activeWindow());
- QDomDocument doc;
- doc.setContent(clip->getProperty("xmldata"));
- dia_ui->setXml(doc);
- QImage pix = dia_ui->renderedPixmap();
- pix.save(titleresource);
- clip->setProperty("resource", titleresource);
- delete dia_ui;
- clip->producer()->set("force_reload", 1);
- }
- }
}
void KdenliveDoc::updatePreviewSettings()
if (createClipItem) {
emit addProjectClip(clip);
qApp->processEvents();
- m_render->getFileProperties(clip->toXML(), clip->getId(), false);
+ m_render->getFileProperties(clip->toXML(), clip->getId(), true);
}
}
void KdenliveDoc::cachePixmap(const QString &fileId, const QPixmap &pix) const
{
- pix.save(m_projectFolder.path() + "/thumbs/" + fileId + ".png");
+ pix.save(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + fileId + ".png");
}
QString KdenliveDoc::getLadspaFile() const
{
int ct = 0;
QString counter = QString::number(ct).rightJustified(5, '0', false);
- while (QFile::exists(m_projectFolder.path() + "/ladspa/" + counter + ".ladspa")) {
+ while (QFile::exists(m_projectFolder.path(KUrl::AddTrailingSlash) + "ladspa/" + counter + ".ladspa")) {
ct++;
counter = QString::number(ct).rightJustified(5, '0', false);
}
- return m_projectFolder.path() + "/ladspa/" + counter + ".ladspa";
+ return m_projectFolder.path(KUrl::AddTrailingSlash) + "ladspa/" + counter + ".ladspa";
}
bool KdenliveDoc::checkDocumentClips(QDomNodeList infoproducers)
for (int i = 0; i < infoproducers.count(); i++) {
e = infoproducers.item(i).toElement();
clipType = e.attribute("type").toInt();
- if (clipType == TEXT || clipType == COLOR) continue;
+ if (clipType == COLOR) continue;
+ if (clipType == TEXT) {
+ //TODO: Check is clip template is missing (xmltemplate) or hash changed
+ continue;
+ }
id = e.attribute("id");
resource = e.attribute("resource");
if (clipType == SLIDESHOW) resource = KUrl(resource).directory();
if (!KIO::NetAccess::exists(KUrl(resource), KIO::NetAccess::SourceSide, 0)) {
// Missing clip found
missingClips.append(e);
+ } else {
+ // Check if the clip has changed
+ if (clipType != SLIDESHOW && e.hasAttribute("file_hash")) {
+ if (e.attribute("file_hash") != DocClipBase::getHash(e.attribute("resource")))
+ e.removeAttribute("file_hash");
+ }
}
}
if (missingClips.isEmpty()) return true;