Commit b992f596 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix moving tmp data when changing project tmp folder, fix location of global...

Fix moving tmp data when changing project tmp folder, fix location of global tmp data in widget when using custom location in current project
parent 572b994f
......@@ -166,6 +166,7 @@ enum ClipJobStatus {
};
enum CacheType {
SystemCacheRoot = -1,
CacheRoot = 0,
CacheBase = 1,
CachePreview = 2,
......
......@@ -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;
......
......@@ -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());
}
}
}
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment