summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-30 16:00:00 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-30 16:00:00 (GMT)
commit2087c0236360e0bf3387f0117c7a9c273ba199e8 (patch)
treedf7df7bc52b991f4c637cf6af75d5ebf68411ad0
parentba6dda5c5d7297b21b235874e6fdd8fd31a3c261 (diff)
Reloading a playlist clip in a project now checks for missing files in it and allows fixing
-rw-r--r--src/bin/bin.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index 322b3ff..37ee81a 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -863,6 +863,29 @@ void Bin::slotReloadClip()
ProjectClip *currentItem = qobject_cast<ProjectClip*>(item);
if (currentItem) {
emit openClip(NULL);
+ if (currentItem->clipType() == Playlist) {
+ //Check if a clip inside playlist is missing
+ QString path = currentItem->url().path();
+ QFile f(path);
+ QDomDocument doc;
+ doc.setContent(&f, false);
+ f.close();
+ DocumentChecker d(QUrl::fromLocalFile(path), doc);
+ if (!d.hasErrorInClips() && doc.documentElement().attribute(QStringLiteral("modified")) == QLatin1String("1")) {
+ QString backupFile = path + QStringLiteral(".backup");
+ KIO::FileCopyJob *copyjob = KIO::file_copy(QUrl::fromLocalFile(path), QUrl::fromLocalFile(backupFile));
+ if (copyjob->exec()) {
+ if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
+ } else {
+ QTextStream out(&f);
+ out << doc.toString();
+ f.close();
+ KMessageBox::information(this, i18n("Your project file was modified by Kdenlive.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile));
+ }
+ }
+ }
+ }
QDomDocument doc;
QDomElement xml = currentItem->toXml(doc);
qDebug()<<"*****************\n"<<doc.toString()<<"\n******************";