[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdenlive/Applications/16.12] src/bin: Reloading a playlist clip in a project now checks for missing
From:       Jean-Baptiste Mardelle <jb () kdenlive ! org>
Date:       2016-11-30 16:00:18
Message-ID: E1cC7Iw-00039p-4W () code ! kde ! org
[Download RAW message or body]

Git commit 2087c0236360e0bf3387f0117c7a9c273ba199e8 by Jean-Baptiste Mardelle.
Committed on 30/11/2016 at 16:00.
Pushed by mardelle into branch 'Applications/16.12'.

Reloading a playlist clip in a project now checks for missing files in it and allows \
fixing

M  +23   -0    src/bin/bin.cpp

https://commits.kde.org/kdenlive/2087c0236360e0bf3387f0117c7a9c273ba199e8

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******************";


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic