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

Fix freeze copying proxy clips.

Related to #1453
parent a658c805
......@@ -695,14 +695,21 @@ void KdenliveDoc::moveProjectData(const QString & /*src*/, const QString &dest)
QDir proxyDir(dest + QStringLiteral("/proxy/"));
if (proxyDir.mkpath(QStringLiteral("."))) {
KIO::CopyJob *job = KIO::move(cacheUrls, QUrl::fromLocalFile(proxyDir.absolutePath()));
KJobWidgets::setWindow(job, QApplication::activeWindow());
if (!job->exec()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Moving proxy clips failed: %1", job->errorText()));
connect(job, &KJob::result, this, &KdenliveDoc::slotMoveFinished);
if (job->uiDelegate()) {
KJobWidgets::setWindow(job, pCore->window());
}
}
}
}
void KdenliveDoc::slotMoveFinished(KJob *job)
{
if (job->error() != 0) {
KMessageBox::sorry(pCore->window(), i18n("Error moving project folder: %1", job->errorText()));
}
}
bool KdenliveDoc::profileChanged(const QString &profile) const
{
return pCore->getCurrentProfile() != ProfileRepository::get()->getProfile(profile);
......@@ -1815,14 +1822,12 @@ QString& KdenliveDoc::modifiedDecimalPoint() {
const QString KdenliveDoc::subTitlePath(bool final)
{
QString path;
QString documentId = QDir::cleanPath(getDocumentProperty(QStringLiteral("documentid")));
if (m_url.isValid() && final) {
return QFileInfo(m_url.toLocalFile()).dir().absoluteFilePath(QString("%1.srt").arg(m_url.fileName()));
} else {
path = QDir::temp().absoluteFilePath(QString("%1.srt").arg(documentId));
return QDir::temp().absoluteFilePath(QString("%1.srt").arg(documentId));
}
return path;
}
void KdenliveDoc::initializeSubtitles(std::shared_ptr<SubtitleModel> m_subtitle)
......
......@@ -252,6 +252,8 @@ private slots:
void checkPreviewStack(int ix);
/** @brief Guides were changed, save to MLT. */
void guidesChanged();
/** @brief Display error message on failed move. */
void slotMoveFinished(KJob *job);
signals:
void resetProjectList();
......
......@@ -30,6 +30,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include <KActionCollection>
#include <KJob>
#include <KJobWidgets>
#include <KMessageBox>
#include <KRecentDirs>
#include <kcoreaddons_version.h>
......@@ -416,13 +417,12 @@ bool ProjectManager::saveFileAs(const QString &outputFileName, bool saveACopy)
KMessageBox::sorry(pCore->window(), i18n("Cannot perform operation, target directory already exists: %1", newDir.absoluteFilePath(documentId)));
} else {
// Proceed with the move
pCore->projectManager()->moveProjectData(oldDir.absoluteFilePath(documentId), newDir.absolutePath());
moveProjectData(oldDir.absoluteFilePath(documentId), newDir.absolutePath());
}
}
}
}
}
return true;
}
......@@ -941,7 +941,10 @@ void ProjectManager::moveProjectData(const QString &src, const QString &dest)
{
// Move tmp folder (thumbnails, timeline preview)
m_project->moveProjectData(src, dest);
KIO::CopyJob *copyJob = KIO::move(QUrl::fromLocalFile(src), QUrl::fromLocalFile(dest));
KIO::CopyJob *copyJob = KIO::move(QUrl::fromLocalFile(src), QUrl::fromLocalFile(dest), KIO::DefaultFlags);
if (copyJob->uiDelegate()) {
KJobWidgets::setWindow(copyJob, pCore->window());
}
connect(copyJob, &KJob::result, this, &ProjectManager::slotMoveFinished);
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5,80,0)
connect(copyJob, SIGNAL(percent(KJob*,ulong)), this, SLOT(slotMoveProgress(KJob*,ulong)));
......
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