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

Fix render url sometimes pointing to incorrect location.

Related to #1458
parent 10f9e386
Pipeline #190548 passed with stage
in 7 minutes and 6 seconds
......@@ -344,13 +344,13 @@ void KdenliveSettingsDialog::initEnviromentPage()
}
}
// Script rendering folder
// Script rendering files folder
m_configEnv.videofolderurl->setMode(KFile::Directory);
m_configEnv.videofolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_videofolder"));
m_configEnv.videofolderurl->setEnabled(!KdenliveSettings::videotodefaultfolder());
m_configEnv.videofolderurl->setEnabled(KdenliveSettings::videotodefaultfolder() == 2);
m_configEnv.videofolderurl->setPlaceholderText(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
m_configEnv.kcfg_videotodefaultfolder->setToolTip(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
connect(m_configEnv.kcfg_videotodefaultfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableVideoFolder);
connect(m_configEnv.kcfg_videotodefaultfolder, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &KdenliveSettingsDialog::slotEnableVideoFolder);
// Mime types
QStringList mimes = ClipCreationDialog::getExtensions();
......@@ -655,9 +655,9 @@ void KdenliveSettingsDialog::slotEnableLibraryFolder()
m_configEnv.libraryfolderurl->setEnabled(!m_configEnv.kcfg_librarytodefaultfolder->isChecked());
}
void KdenliveSettingsDialog::slotEnableVideoFolder()
void KdenliveSettingsDialog::slotEnableVideoFolder(int ix)
{
m_configEnv.videofolderurl->setEnabled(!m_configEnv.kcfg_videotodefaultfolder->isChecked());
m_configEnv.videofolderurl->setEnabled(ix == 2);
}
void KdenliveSettingsDialog::initDevices()
......
......@@ -81,7 +81,7 @@ private slots:
void slotDialogModified();
void slotEnableCaptureFolder();
void slotEnableLibraryFolder();
void slotEnableVideoFolder();
void slotEnableVideoFolder(int ix);
void slotUpdatev4lDevice();
void slotUpdatev4lCaptureProfile();
void slotEditVideo4LinuxProfile();
......
......@@ -2026,7 +2026,8 @@ void RenderWidget::resetRenderPath(const QString &path)
} else {
extension = m_view.out_file->url().toLocalFile().section(QLatin1Char('.'), -1);
}
QString fileName = QDir(pCore->currentDoc()->projectDataFolder()).absoluteFilePath(path + extension);
QFileInfo updatedPath(path);
QString fileName = QDir(pCore->currentDoc()->projectDataFolder(updatedPath.absolutePath())).absoluteFilePath(updatedPath.fileName());
QString url = filenameWithExtension(QUrl::fromLocalFile(fileName), extension).toLocalFile();
if (QFileInfo(url).isRelative()) {
url.prepend(pCore->currentDoc()->documentRoot());
......
......@@ -630,18 +630,27 @@ QString KdenliveDoc::projectTempFolder() const
return m_projectFolder;
}
QString KdenliveDoc::projectDataFolder() const
QString KdenliveDoc::projectDataFolder(const QString &newPath) const
{
if (KdenliveSettings::videotodefaultfolder() == 2 && !KdenliveSettings::videofolder().isEmpty()) {
return KdenliveSettings::videofolder();
}
if (!newPath.isEmpty() && (KdenliveSettings::videotodefaultfolder() == 1 || m_sameProjectFolder)) {
// Always render to project folder
return newPath;
}
if (m_projectFolder.isEmpty()) {
// Project has not been saved yet
if (KdenliveSettings::customprojectfolder()) {
return KdenliveSettings::defaultprojectfolder();
}
if (KdenliveSettings::videotodefaultfolder() || KdenliveSettings::videofolder().isEmpty()) {
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
}
return KdenliveSettings::videofolder();
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
}
return m_projectFolder;
if (KdenliveSettings::videotodefaultfolder() == 1 || m_sameProjectFolder) {
// Always render to project folder
return QFileInfo(m_url.toLocalFile()).absolutePath();
}
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
}
void KdenliveDoc::setProjectFolder(const QUrl &url)
......
......@@ -79,7 +79,7 @@ public:
/** @brief Returns the project folder, used to store project temporary files. */
QString projectTempFolder() const;
/** @brief Returns the folder used to store project data files (titles, etc). */
QString projectDataFolder() const;
QString projectDataFolder(const QString &newPath = QString()) const;
void setZoom(int horizontal, int vertical = -1);
QPoint zoom() const;
double dar() const;
......
......@@ -582,9 +582,9 @@
<default>true</default>
</entry>
<entry name="videotodefaultfolder" type="Bool">
<entry name="videotodefaultfolder" type="Int">
<label>Save titles, scripted renderings in default system folder.</label>
<default>true</default>
<default>0</default>
</entry>
<entry name="libraryfolder" type="Path">
......
......@@ -389,6 +389,7 @@ bool ProjectManager::saveFileAs(const QString &outputFileName, bool saveACopy)
pCore->window()->setWindowTitle(m_project->description());
m_project->setModified(false);
}
m_recentFilesAction->addUrl(url);
// remember folder for next project opening
KRecentDirs::add(QStringLiteral(":KdenliveProjectsFolder"), saveFolder);
......
......@@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>662</width>
<height>468</height>
<width>506</width>
<height>446</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
......@@ -36,17 +42,17 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_nice_tasks">
<property name="text">
<string>Concurrent threads:</string>
<string>Use lower CPU priority for proxy and transcode tasks</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_nice_tasks">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Use lower CPU priority for proxy and transcode tasks</string>
<string>Concurrent threads:</string>
</property>
</widget>
</item>
......@@ -143,33 +149,16 @@
<string>Default Folders</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Temporary files:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KUrlRequester" name="tmppathurl"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<item row="5" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Capture folder:</string>
<string>Folder for rendering, titles, scripts:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_capturetoprojectfolder">
<property name="text">
<string>Use project folder</string>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KUrlRequester" name="capturefolderurl"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
......@@ -177,46 +166,98 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="kcfg_librarytodefaultfolder">
<property name="text">
<string>Use default folder</string>
<item row="7" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="KUrlRequester" name="libraryfolderurl"/>
<item row="5" column="1">
<widget class="QComboBox" name="kcfg_videotodefaultfolder">
<item>
<property name="text">
<string>Use default folder</string>
</property>
</item>
<item>
<property name="text">
<string>Always use project folder</string>
</property>
</item>
<item>
<property name="text">
<string>Always use custom folder</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_16">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Folder for titles, scripts:</string>
<string>Temporary files:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="kcfg_videotodefaultfolder">
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Use default folder</string>
<string>Capture folder:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="KUrlRequester" name="videofolderurl"/>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_3">
<item row="5" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1" colspan="2">
<widget class="KUrlRequester" name="videofolderurl">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="KUrlRequester" name="libraryfolderurl"/>
</item>
<item row="3" column="1" colspan="2">
<widget class="QCheckBox" name="kcfg_librarytodefaultfolder">
<property name="text">
<string>Use default folder</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="KUrlRequester" name="capturefolderurl"/>
</item>
<item row="1" column="1" colspan="2">
<widget class="QCheckBox" name="kcfg_capturetoprojectfolder">
<property name="text">
<string>Use project folder</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="KUrlRequester" name="tmppathurl"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
......
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