+
+ // prepare transitions
+ QDomNodeList trans = m_doc.elementsByTagName("transition");
+
+ QTreeWidgetItem *child = treeWidget->topLevelItem(ix);
+ while (child) {
+ if (child->data(0, statusRole).toInt() == CLIPOK) {
+ QString id = child->data(0, idRole).toString();
+ for (int i = 0; i < infoproducers.count(); i++) {
+ e = infoproducers.item(i).toElement();
+ if (e.attribute("id") == id) {
+ // Fix clip
+ e.setAttribute("resource", child->text(1));
+ e.setAttribute("name", KUrl(child->text(1)).fileName());
+ break;
+ }
+ }
+ for (int i = 0; i < producers.count(); i++) {
+ e = producers.item(i).toElement();
+ if (e.attribute("id").section('_', 0, 0) == id) {
+ // Fix clip
+ properties = e.childNodes();
+ for (int j = 0; j < properties.count(); ++j) {
+ property = properties.item(j).toElement();
+ if (property.attribute("name") == "resource") {
+ property.firstChild().setNodeValue(child->text(1));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ } else if (child->data(0, statusRole).toInt() == CLIPPLACEHOLDER) {
+ QString id = child->data(0, idRole).toString();
+ for (int i = 0; i < infoproducers.count(); i++) {
+ e = infoproducers.item(i).toElement();
+ if (e.attribute("id") == id) {
+ // Fix clip
+ e.setAttribute("placeholder", '1');
+ break;
+ }
+ }
+ } else if (child->data(0, statusRole).toInt() == LUMAOK) {
+ for (int i = 0; i < trans.count(); i++) {
+ QString luma = getProperty(trans.at(i).toElement(), "luma");
+ kDebug() << "luma: " << luma;
+ if (!luma.isEmpty() && luma == child->data(0, idRole).toString()) {
+ setProperty(trans.at(i).toElement(), "luma", child->text(1));
+ kDebug() << "replace with; " << child->text(1);
+ }
+ }
+ } else if (child->data(0, statusRole).toInt() == LUMAMISSING) {
+ for (int i = 0; i < trans.count(); i++) {
+ QString luma = getProperty(trans.at(i).toElement(), "luma");
+ if (!luma.isEmpty() && luma == child->data(0, idRole).toString()) {
+ setProperty(trans.at(i).toElement(), "luma", QString());
+ }
+ }
+ }
+ ix++;
+ child = treeWidget->topLevelItem(ix);
+ }
+ QDialog::accept();
+}
+
+void DocumentChecker::slotPlaceholders()
+{
+ int ix = 0;
+ QTreeWidgetItem *child = treeWidget->topLevelItem(ix);
+ while (child) {
+ if (child->data(0, statusRole).toInt() == CLIPMISSING) {
+ child->setData(0, statusRole, CLIPPLACEHOLDER);
+ child->setIcon(0, KIcon("dialog-ok"));
+ } else if (child->data(0, statusRole).toInt() == LUMAMISSING) {
+ child->setData(0, statusRole, LUMAPLACEHOLDER);
+ child->setIcon(0, KIcon("dialog-ok"));
+ }
+ ix++;
+ child = treeWidget->topLevelItem(ix);
+ }
+ checkStatus();
+}
+
+
+void DocumentChecker::checkStatus()
+{
+ bool status = true;
+ int ix = 0;
+ QTreeWidgetItem *child = treeWidget->topLevelItem(ix);
+ while (child) {
+ if (child->data(0, statusRole).toInt() == CLIPMISSING || child->data(0, statusRole).toInt() == LUMAMISSING) {
+ status = false;
+ break;
+ }
+ ix++;
+ child = treeWidget->topLevelItem(ix);
+ }
+ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(status);
+}
+
+
+void DocumentChecker::slotDeleteSelected()
+{
+ if (KMessageBox::warningContinueCancel(this, i18n("This will remove the selected clips from this project"), i18n("Remove clips")) == KMessageBox::Cancel) return;
+ int ix = 0;
+ QStringList deletedIds;
+ QTreeWidgetItem *child = treeWidget->topLevelItem(ix);
+ QDomNodeList playlists = m_doc.elementsByTagName("playlist");
+
+ while (child) {
+ int id = child->data(0, statusRole).toInt();
+ if (child->isSelected() && id < 10) {
+ QString id = child->data(0, idRole).toString();
+ deletedIds.append(id);
+ for (int j = 0; j < playlists.count(); j++)
+ deletedIds.append(id + '_' + QString::number(j));
+ delete child;
+ } else ix++;
+ child = treeWidget->topLevelItem(ix);
+ }
+ kDebug() << "// Clips to delete: " << deletedIds;
+
+ if (!deletedIds.isEmpty()) {
+ QDomElement e;
+ QDomNodeList producers = m_doc.elementsByTagName("producer");
+ QDomNodeList infoproducers = m_doc.elementsByTagName("kdenlive_producer");
+
+ QDomElement mlt = m_doc.firstChildElement("mlt");
+ QDomElement kdenlivedoc = mlt.firstChildElement("kdenlivedoc");
+