From 837100fd7ffe8ddf178214d1aaf5b8bf45a48fa4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sun, 28 Aug 2011 16:57:51 +0000 Subject: [PATCH] Move all cached data in one operation, so that user does not get one dialog box for each file in case of duplicates: http://kdenlive.org/mantis/view.php?id=2297 svn path=/trunk/kdenlive/; revision=5842 --- src/kdenlivedoc.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index 86a73e61..ddc79e29 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -766,6 +767,7 @@ void KdenliveDoc::setProjectFolder(KUrl url) void KdenliveDoc::moveProjectData(KUrl url) { QList list = m_clipManager->documentClipList(); + KUrl::List cacheUrls; for (int i = 0; i < list.count(); i++) { DocClipBase *clip = list.at(i); if (clip->clipType() == TEXT) { @@ -779,16 +781,17 @@ void KdenliveDoc::moveProjectData(KUrl url) KUrl oldVideoThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".png"); KUrl oldAudioThumbUrl = KUrl(m_projectFolder.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".thumb"); if (KIO::NetAccess::exists(oldVideoThumbUrl, KIO::NetAccess::SourceSide, 0)) { - KUrl newUrl = KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".png"); - KIO::Job *job = KIO::copy(oldVideoThumbUrl, newUrl); - KIO::NetAccess::synchronousRun(job, 0); + cacheUrls << oldVideoThumbUrl; } if (KIO::NetAccess::exists(oldAudioThumbUrl, KIO::NetAccess::SourceSide, 0)) { - KUrl newUrl = KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/" + hash + ".thumb"); - KIO::Job *job = KIO::copy(oldAudioThumbUrl, newUrl); - if (KIO::NetAccess::synchronousRun(job, 0)) clip->refreshThumbUrl(); + cacheUrls << oldAudioThumbUrl; } } + if (!cacheUrls.isEmpty()) { + KIO::Job *job = KIO::copy(cacheUrls, KUrl(url.path(KUrl::AddTrailingSlash) + "thumbs/")); + job->ui()->setWindow(kapp->activeWindow()); + KIO::NetAccess::synchronousRun(job, 0); + } } const QString &KdenliveDoc::profilePath() const -- 2.39.2