X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdocumentchecker.cpp;h=2cdd9325e573aff485dd6ad5a3338740b36b2460;hb=e8d7fcdcf399fe74a40a14db5d989d774e6f1d09;hp=adfb592e096b6be6b6d9d7fd25b998e57c1b59a5;hpb=c7c21fd4cd2147de1670c782df81cc2323035ab5;p=kdenlive diff --git a/src/documentchecker.cpp b/src/documentchecker.cpp index adfb592e..2cdd9325 100644 --- a/src/documentchecker.cpp +++ b/src/documentchecker.cpp @@ -81,7 +81,7 @@ bool DocumentChecker::hasErrorInClips() e = m_info.item(i).toElement(); clipType = e.attribute("type").toInt(); if (clipType == COLOR) continue; - if (clipType != TEXT && clipType != IMAGE) { + if (clipType != TEXT && clipType != IMAGE && clipType != SLIDESHOW) { QString id = e.attribute("id"); int duration = e.attribute("duration").toInt(); int mltDuration = -1; @@ -393,9 +393,10 @@ void DocumentChecker::slotSearchClips() bool fixed = false; m_ui.recursiveSearch->setEnabled(false); QTreeWidgetItem *child = m_ui.treeWidget->topLevelItem(ix); + QDir searchDir(newpath); while (child) { if (child->data(0, statusRole).toInt() == CLIPMISSING) { - QString clipPath = searchFileRecursively(QDir(newpath), child->data(0, sizeRole).toString(), child->data(0, hashRole).toString()); + QString clipPath = searchFileRecursively(searchDir, child->data(0, sizeRole).toString(), child->data(0, hashRole).toString()); if (!clipPath.isEmpty()) { fixed = true; child->setText(1, clipPath); @@ -411,6 +412,18 @@ void DocumentChecker::slotSearchClips() child->setData(0, statusRole, LUMAOK); } } + else if (child->data(0, typeRole).toInt() == TITLE_IMAGE_ELEMENT && child->data(0, statusRole).toInt() == CLIPPLACEHOLDER) { + // Search missing title images + QString missingFileName = KUrl(child->text(1)).fileName(); + QString newPath = searchPathRecursively(searchDir, missingFileName); + if (!newPath.isEmpty()) { + // File found + fixed = true; + child->setText(1, newPath); + child->setIcon(0, KIcon("dialog-ok")); + child->setData(0, statusRole, CLIPOK); + } + } ix++; child = m_ui.treeWidget->topLevelItem(ix); } @@ -445,6 +458,24 @@ QString DocumentChecker::searchLuma(QString file) const return QString(); } +QString DocumentChecker::searchPathRecursively(const QDir &dir, const QString &fileName) const +{ + QString foundFileName; + QStringList filters; + filters << fileName; + QDir searchDir(dir); + searchDir.setNameFilters(filters); + QStringList filesAndDirs = searchDir.entryList(QDir::Files | QDir::Readable); + if (!filesAndDirs.isEmpty()) return searchDir.absoluteFilePath(filesAndDirs.at(0)); + searchDir.setNameFilters(QStringList()); + filesAndDirs = searchDir.entryList(QDir::Dirs | QDir::Readable | QDir::Executable | QDir::NoDotAndDotDot); + for (int i = 0; i < filesAndDirs.size() && foundFileName.isEmpty(); i++) { + foundFileName = searchPathRecursively(searchDir.absoluteFilePath(filesAndDirs.at(i)), fileName); + if (!foundFileName.isEmpty()) + break; + } + return foundFileName; +} QString DocumentChecker::searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const {