summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-20 13:51:37 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-11-20 14:45:01 (GMT)
commitb992f5962a6e09a4dd0ef6cee90db0b83a0a1f08 (patch)
tree4692909614e8bc8c2095ce067a7c905a73a56bfc
parent572b994fd3d1fef5822822e0bb1c077d5cfa2878 (diff)
Fix moving tmp data when changing project tmp folder, fix location of global tmp data in widget when using custom location in current project
-rw-r--r--src/definitions.h1
-rw-r--r--src/doc/kdenlivedoc.cpp7
-rw-r--r--src/mainwindow.cpp2
-rw-r--r--src/project/dialogs/temporarydata.cpp2
-rw-r--r--src/project/projectmanager.cpp9
-rw-r--r--src/project/projectmanager.h2
6 files changed, 16 insertions, 7 deletions
diff --git a/src/definitions.h b/src/definitions.h
index a724373..8b51bfa 100644
--- a/src/definitions.h
+++ b/src/definitions.h
@@ -166,6 +166,7 @@ enum ClipJobStatus {
};
enum CacheType {
+ SystemCacheRoot = -1,
CacheRoot = 0,
CacheBase = 1,
CachePreview = 2,
diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp
index 8e89212..328d102 100644
--- a/src/doc/kdenlivedoc.cpp
+++ b/src/doc/kdenlivedoc.cpp
@@ -754,12 +754,7 @@ void KdenliveDoc::setProjectFolder(QUrl url)
void KdenliveDoc::moveProjectData(const QString &src, const QString &dest)
{
- // Move tmp folder (thumbnails, timeline preview)
- KIO::CopyJob *copyJob = KIO::move(QUrl::fromLocalFile(src),QUrl::fromLocalFile(dest));
- connect(copyJob, SIGNAL(result(KJob *)), this, SLOT(slotMoveFinished(KJob *)));
- connect(copyJob, SIGNAL(percent(KJob *, unsigned long)), this, SLOT(slotMoveProgress(KJob *, unsigned long)));
// Move proxies
-
QList <ClipController*> list = pCore->binController()->getControllerList();
QList<QUrl> cacheUrls;
for (int i = 0; i < list.count(); ++i) {
@@ -1710,6 +1705,8 @@ QDir KdenliveDoc::getCacheDir(CacheType type, bool *ok) const
}
basePath = kdenliveCacheDir + QStringLiteral("/") + documentId;
switch (type) {
+ case SystemCacheRoot:
+ return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
case CacheRoot:
basePath = kdenliveCacheDir;
break;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6acc708..00ec65f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1728,7 +1728,7 @@ void MainWindow::slotEditProjectSettings()
KMessageBox::sorry(this, i18n("Cannot perform operation, target directory already exists: %1", newDir.absoluteFilePath(documentId)));
} else {
// Proceed with the move
- project->moveProjectData(oldDir.absoluteFilePath(documentId), newDir.absolutePath());
+ pCore->projectManager()->moveProjectData(oldDir.absoluteFilePath(documentId), newDir.absolutePath());
}
}
}
diff --git a/src/project/dialogs/temporarydata.cpp b/src/project/dialogs/temporarydata.cpp
index 25c2542..0abffb7 100644
--- a/src/project/dialogs/temporarydata.cpp
+++ b/src/project/dialogs/temporarydata.cpp
@@ -488,7 +488,7 @@ void TemporaryData::updateGlobalInfo()
m_totalGlobal = 0;
m_listWidget->clear();
bool ok = false;
- QDir preview = m_doc->getCacheDir(CacheRoot, &ok);
+ QDir preview = m_doc->getCacheDir(SystemCacheRoot, &ok);
if (!ok) {
m_globalPage->setEnabled(false);
return;
diff --git a/src/project/projectmanager.cpp b/src/project/projectmanager.cpp
index 704f387..6b1d184 100644
--- a/src/project/projectmanager.cpp
+++ b/src/project/projectmanager.cpp
@@ -793,6 +793,15 @@ void ProjectManager::saveZone(QStringList info, QDir dir)
pCore->bin()->saveZone(info, dir);
}
+void ProjectManager::moveProjectData(const QString &src, const QString &dest)
+{
+ // Move tmp folder (thumbnails, timeline preview)
+ KIO::CopyJob *copyJob = KIO::move(QUrl::fromLocalFile(src),QUrl::fromLocalFile(dest));
+ connect(copyJob, SIGNAL(result(KJob *)), this, SLOT(slotMoveFinished(KJob *)));
+ connect(copyJob, SIGNAL(percent(KJob *, unsigned long)), this, SLOT(slotMoveProgress(KJob *, unsigned long)));
+ m_project->moveProjectData(src, dest);
+}
+
void ProjectManager::slotMoveProgress(KJob *, unsigned long progress)
{
pCore->window()->slotGotProgressInfo(i18n("Moving project folder"), progress, ProcessingJobMessage);
diff --git a/src/project/projectmanager.h b/src/project/projectmanager.h
index c54bb59..dd67883 100644
--- a/src/project/projectmanager.h
+++ b/src/project/projectmanager.h
@@ -64,6 +64,8 @@ public:
/** @brief returns a default hd profile depending on timezone*/
static QString getDefaultProjectFormat();
void saveZone(QStringList info, QDir dir);
+ /** @brief Move project data files to new url */
+ void moveProjectData(const QString &src, const QString &dest);
public slots:
void newFile(bool showProjectSettings = true, bool force = false);