Commit e628768b authored by Julius Künzel's avatar Julius Künzel
Browse files

Enable "save temporary files next to project file" for new projects too

Related to #1106
parent cba0ddbc
Pipeline #68535 passed with stage
in 8 minutes and 24 seconds
......@@ -72,6 +72,8 @@ public:
QUrl url() const;
QUuid uuid;
KAutoSaveFile *m_autosave;
/** @brief Whether the project folder should be in the same folder as the project file (var is only used for new projects)*/
bool m_sameProjectFolder;
Timecode timecode() const;
std::shared_ptr<DocUndoStack> commandStack();
......
......@@ -161,12 +161,6 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap<QString, QString> metada
custom_folder->setChecked(KdenliveSettings::customprojectfolder());
project_folder->setUrl(QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)));
same_folder->setChecked(KdenliveSettings::sameprojectfolder());
/* creating a new project we can't use the same folder option as we don't know the path of the project yet.
* If the the option is enabled in the default projec settings, we have disable the custom folder option
* and move the files to the new location as soon as the project is saved for the first time
*/
same_folder->setEnabled(false);
custom_folder->setEnabled(!KdenliveSettings::sameprojectfolder());
}
// Select profile
......
......@@ -159,6 +159,7 @@ void ProjectManager::newFile(QString profileName, bool showProjectSettings)
pCore->monitorManager()->resetDisplay();
QString documentId = QString::number(QDateTime::currentMSecsSinceEpoch());
documentProperties.insert(QStringLiteral("documentid"), documentId);
bool sameProjectFolder = KdenliveSettings::sameprojectfolder();
if (!showProjectSettings) {
if (!closeCurrentDocument()) {
return;
......@@ -210,6 +211,7 @@ void ProjectManager::newFile(QString profileName, bool showProjectSettings)
}
documentProperties.insert(QStringLiteral("storagefolder"), projectFolder + documentId);
}
sameProjectFolder = w->docFolderAsStorageFolder();
documentMetadata = w->metadata();
delete w;
}
......@@ -218,6 +220,7 @@ void ProjectManager::newFile(QString profileName, bool showProjectSettings)
pCore->bin()->cleanDocument();
KdenliveDoc *doc = new KdenliveDoc(QUrl(), projectFolder, pCore->window()->m_commandStack, profileName, documentProperties, documentMetadata, projectTracks, audioChannels, &openBackup, pCore->window());
doc->m_autosave = new KAutoSaveFile(startFile, doc);
doc->m_sameProjectFolder = sameProjectFolder;
ThumbnailCache::get()->clearCache();
pCore->bin()->setDocument(doc);
m_project = doc;
......@@ -352,7 +355,7 @@ bool ProjectManager::saveFileAs(const QString &outputFileName, bool saveACopy)
m_fileRevert->setEnabled(true);
pCore->window()->m_undoView->stack()->setClean();
QString newProjectFolder(saveFolder + QStringLiteral("/cachefiles"));
if(((oldProjectFolder.isEmpty() && KdenliveSettings::sameprojectfolder()) || m_project->projectTempFolder() == oldProjectFolder) && newProjectFolder != m_project->projectTempFolder()) {
if(((oldProjectFolder.isEmpty() && m_project->m_sameProjectFolder) || m_project->projectTempFolder() == oldProjectFolder) && newProjectFolder != m_project->projectTempFolder()) {
KMessageBox::ButtonCode answer = KMessageBox::warningContinueCancel(
pCore->window(), i18n("The location of the project file changed. You selected to use the location of the project file to save temporary files. "
"This will move all temporary files from <b>%1</b> to <b>%2</b>, the project file will then be reloaded",
......
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