Make folder to store titles and scripts configurable in Kdenlive Settings

Don't create the kdenlive-renderqueue folder if not necessary, and delete it if no script is stored.
Fixes #812
parent 76d87f66
Pipeline #37856 failed with stage
in 60 minutes and 23 seconds
......@@ -134,9 +134,18 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_configEnv.libraryfolderurl->setMode(KFile::Directory);
m_configEnv.libraryfolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_libraryfolder"));
m_configEnv.libraryfolderurl->setEnabled(!KdenliveSettings::librarytodefaultfolder());
m_configEnv.libraryfolderurl->setPlaceholderText(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/library"));
m_configEnv.kcfg_librarytodefaultfolder->setToolTip(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/library"));
connect(m_configEnv.kcfg_librarytodefaultfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableLibraryFolder);
// Script rendering folder
m_configEnv.videofolderurl->setMode(KFile::Directory);
m_configEnv.videofolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_videofolder"));
m_configEnv.videofolderurl->setEnabled(!KdenliveSettings::videotodefaultfolder());
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);
// Mime types
QStringList mimes = ClipCreationDialog::getExtensions();
std::sort(mimes.begin(), mimes.end());
......@@ -599,6 +608,11 @@ void KdenliveSettingsDialog::slotEnableLibraryFolder()
m_configEnv.libraryfolderurl->setEnabled(!m_configEnv.kcfg_librarytodefaultfolder->isChecked());
}
void KdenliveSettingsDialog::slotEnableVideoFolder()
{
m_configEnv.videofolderurl->setEnabled(!m_configEnv.kcfg_videotodefaultfolder->isChecked());
}
void KdenliveSettingsDialog::initDevices()
{
// Fill audio drivers
......
......@@ -74,6 +74,7 @@ private slots:
void slotDialogModified();
void slotEnableCaptureFolder();
void slotEnableLibraryFolder();
void slotEnableVideoFolder();
void slotUpdatev4lDevice();
void slotUpdatev4lCaptureProfile();
void slotManageEncodingProfile();
......
......@@ -2677,9 +2677,18 @@ void RenderWidget::parseScriptFiles()
QTreeWidgetItem *item;
// List the project scripts
QDir projectFolder(pCore->currentDoc()->projectDataFolder());
projectFolder.mkpath(QStringLiteral("kdenlive-renderqueue"));
if (!projectFolder.exists(QStringLiteral("kdenlive-renderqueue"))) {
return;
}
projectFolder.cd(QStringLiteral("kdenlive-renderqueue"));
QStringList scriptFiles = projectFolder.entryList(scriptsFilter, QDir::Files);
if (scriptFiles.isEmpty()) {
// No scripts, delete directory
if (projectFolder.dirName() == QStringLiteral("kdenlive-renderqueue") && projectFolder.entryList(scriptsFilter, QDir::AllEntries | QDir::NoDotAndDotDot).isEmpty()) {
projectFolder.removeRecursively();
return;
}
}
for (int i = 0; i < scriptFiles.size(); ++i) {
QUrl scriptpath = QUrl::fromLocalFile(projectFolder.absoluteFilePath(scriptFiles.at(i)));
QFile f(scriptpath.toLocalFile());
......
......@@ -646,8 +646,11 @@ QString KdenliveDoc::projectDataFolder() const
if (KdenliveSettings::customprojectfolder()) {
return KdenliveSettings::defaultprojectfolder();
}
if (KdenliveSettings::videotodefaultfolder() || KdenliveSettings::videofolder().isEmpty()) {
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
}
return KdenliveSettings::videofolder();
}
return m_projectFolder;
}
......
......@@ -489,11 +489,21 @@
<default>true</default>
</entry>
<entry name="videotodefaultfolder" type="Bool">
<label>Save titles, scripted renderings in default system folder.</label>
<default>true</default>
</entry>
<entry name="libraryfolder" type="Path">
<label>Default folder for library.</label>
<default></default>
</entry>
<entry name="videofolder" type="Path">
<label>Default folder for various stored files, like titles, scripted rendering.</label>
<default></default>
</entry>
<entry name="defaultimageapp" type="String">
<label>Default image editing application.</label>
<default></default>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>379</height>
<width>662</width>
<height>468</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......@@ -17,10 +17,39 @@
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Proxy clips</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="1">
<widget class="QSpinBox" name="kcfg_proxythreads">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Concurrent threads</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
......@@ -97,25 +126,15 @@
<string>Default folders</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<widget class="QLabel" name="label_15">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Library folder</string>
<string>Temporary files</string>
</property>
</widget>
</item>
<item row="5" column="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<item row="0" column="1">
<widget class="KUrlRequester" name="tmppathurl"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
......@@ -124,10 +143,20 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_capturetoprojectfolder">
<property name="text">
<string>Temporary files</string>
<string>Use project folder</string>
</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">
<string>Library folder</string>
</property>
</widget>
</item>
......@@ -138,21 +167,38 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<item row="4" column="1">
<widget class="KUrlRequester" name="libraryfolderurl"/>
</item>
<item row="0" column="1" colspan="2">
<widget class="KUrlRequester" name="tmppathurl"/>
<item row="5" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Folder for titles, scripts</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QCheckBox" name="kcfg_capturetoprojectfolder">
<item row="5" column="1">
<widget class="QCheckBox" name="kcfg_videotodefaultfolder">
<property name="text">
<string>Use project folder</string>
<string>Use default folder</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="KUrlRequester" name="capturefolderurl"/>
<item row="6" column="1">
<widget class="KUrlRequester" name="videofolderurl"/>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
......@@ -255,35 +301,6 @@
</widget>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Proxy clips</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Concurrent threads</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="kcfg_proxythreads">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
......
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