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

Don't allow importing a project cache folder (audio/video thumbs, proxy,...).

Fixes #1173
parent 33c812ac
......@@ -271,6 +271,27 @@ const QString ClipCreator::createClipsFromList(const QList<QUrl> &list, bool che
if (info.isDir()) {
// user dropped a folder, import its files
QDir dir(file.toLocalFile());
bool ok = false;
QDir thumbFolder = pCore->currentDoc()->getCacheDir(CacheAudio, &ok);
if (ok && thumbFolder == dir) {
// Do not try to import our thumbnail folder
continue;
}
thumbFolder = pCore->currentDoc()->getCacheDir(CacheThumbs, &ok);
if (ok && thumbFolder == dir) {
// Do not try to import our thumbnail folder
continue;
}
thumbFolder = pCore->currentDoc()->getCacheDir(CacheProxy, &ok);
if (ok && thumbFolder == dir) {
// Do not try to import our thumbnail folder
continue;
}
thumbFolder = pCore->currentDoc()->getCacheDir(CachePreview, &ok);
if (ok && thumbFolder == dir) {
// Do not try to import our thumbnail folder
continue;
}
QString folderId;
Fun local_undo = []() { return true; };
Fun local_redo = []() { return true; };
......
......@@ -288,7 +288,7 @@ void ClipLoadTask::generateThumbnail(std::shared_ptr<ProjectClip>binClip, std::s
p.setPen(Qt::white);
p.drawText(0, 0, fullWidth, imageHeight, Qt::AlignCenter, i18n("Invalid"));
QMetaObject::invokeMethod(binClip.get(), "setThumbnail", Qt::QueuedConnection, Q_ARG(QImage,result), Q_ARG(int,m_in), Q_ARG(int,m_out));
} else {
} else if (!m_isCanceled) {
qDebug()<<"=== GOT THUMB FOR: "<<m_in<<"x"<<m_out;
QMetaObject::invokeMethod(binClip.get(), "setThumbnail", Qt::QueuedConnection, Q_ARG(QImage,result), Q_ARG(int,m_in), Q_ARG(int,m_out));
ThumbnailCache::get()->storeThumbnail(QString::number(m_owner.second), frameNumber, result, true);
......
......@@ -243,6 +243,8 @@ void ProjectManager::newFile(QString profileName, bool showProjectSettings)
bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
{
// Disable autosave
m_autoSaveTimer.stop();
if ((m_project != nullptr) && m_project->isModified() && saveChanges) {
QString message;
if (m_project->url().fileName().isEmpty()) {
......@@ -268,7 +270,6 @@ bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
::mlt_pool_purge();
pCore->cleanup();
if (!quit && !qApp->isSavingSession()) {
m_autoSaveTimer.stop();
if (m_project) {
pCore->bin()->abortOperations();
}
......
Markdown is supported
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