resource = e.attribute("resource");
if (e.hasAttribute("proxy")) {
QString proxyresource = e.attribute("proxy");
- if (!KIO::NetAccess::exists(KUrl(proxyresource), KIO::NetAccess::SourceSide, 0)) {
+ if (!proxyresource.isEmpty() && proxyresource != "-" && !KIO::NetAccess::exists(KUrl(proxyresource), KIO::NetAccess::SourceSide, 0)) {
// Missing clip found
missingProxies.append(e);
}
item->setToolTip(0, i18n("Duration mismatch"));
}
-
- for (int i = 0; i < missingProxies.count(); i++) {
- e = missingProxies.at(i).toElement();
- QString clipType;
- int t = e.attribute("type").toInt();
+ if (missingProxies.count() > 0) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList() << i18n("Proxy clip"));
- item->setIcon(0, KIcon("dialog-close"));
- item->setText(1, e.attribute("proxy"));
+ item->setIcon(0, KIcon("dialog-warning"));
+ item->setText(1, i18n("%1 missing proxy clips, will be recreated on project opening", missingProxies.count()));
item->setData(0, hashRole, e.attribute("file_hash"));
item->setData(0, statusRole, PROXYMISSING);
- item->setData(0, typeRole, t);
- item->setData(0, idRole, e.attribute("id"));
item->setToolTip(0, i18n("Missing proxy"));
}
+
+ for (int i = 0; i < missingProxies.count(); i++) {
+ e = missingProxies.at(i).toElement();
+ QString clipType;
+ QString realPath = e.attribute("resource");
+ QString id = e.attribute("id");
+ // Replace proxy url with real clip in MLT producers
+ QDomNodeList properties;
+ QDomElement mltProd;
+ QDomElement property;
+ for (int j = 0; j < documentProducers.count(); j++) {
+ mltProd = documentProducers.at(j).toElement();
+ QString prodId = mltProd.attribute("id");
+ bool slowmotion = false;
+ if (prodId.startsWith("slowmotion")) {
+ slowmotion = true;
+ prodId = prodId.section(':', 1, 1);
+ }
+ if (prodId.contains('_')) prodId = prodId.section('_', 0, 0);
+ if (prodId == id) {
+ // Hit, we must replace url
+ properties = mltProd.childNodes();
+ for (int k = 0; k < properties.count(); ++k) {
+ property = properties.item(k).toElement();
+ if (property.attribute("name") == "resource") {
+ QString resource = property.firstChild().nodeValue();
+ QString suffix;
+ if (slowmotion) suffix = "?" + resource.section('?', -1);
+ property.firstChild().setNodeValue(realPath + suffix);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (missingProxies.count() > 0) {
+ // original doc was modified
+ QDomNode infoXmlNode = m_doc.elementsByTagName("kdenlivedoc").at(0);
+ QDomElement infoXml = infoXmlNode.toElement();
+ infoXml.setAttribute("modified", "1");
+ }
connect(m_ui.recursiveSearch, SIGNAL(pressed()), this, SLOT(slotSearchClips()));
connect(m_ui.usePlaceholders, SIGNAL(pressed()), this, SLOT(slotPlaceholders()));
if (m_ui.treeWidget->currentItem()) {
QTreeWidgetItem *item = m_ui.treeWidget->currentItem();
int t = item->data(0, typeRole).toInt();
- if (t == TITLE_FONT_ELEMENT || t == TITLE_IMAGE_ELEMENT) {
+ int s = item->data(0, statusRole).toInt();
+ if (t == TITLE_FONT_ELEMENT || t == TITLE_IMAGE_ELEMENT || s == PROXYMISSING) {
m_ui.removeSelected->setEnabled(false);
} else m_ui.removeSelected->setEnabled(true);
}