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 ...@@ -134,9 +134,18 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_configEnv.libraryfolderurl->setMode(KFile::Directory); m_configEnv.libraryfolderurl->setMode(KFile::Directory);
m_configEnv.libraryfolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_libraryfolder")); m_configEnv.libraryfolderurl->lineEdit()->setObjectName(QStringLiteral("kcfg_libraryfolder"));
m_configEnv.libraryfolderurl->setEnabled(!KdenliveSettings::librarytodefaultfolder()); 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")); m_configEnv.kcfg_librarytodefaultfolder->setToolTip(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/library"));
connect(m_configEnv.kcfg_librarytodefaultfolder, &QAbstractButton::clicked, this, &KdenliveSettingsDialog::slotEnableLibraryFolder); 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 // Mime types
QStringList mimes = ClipCreationDialog::getExtensions(); QStringList mimes = ClipCreationDialog::getExtensions();
std::sort(mimes.begin(), mimes.end()); std::sort(mimes.begin(), mimes.end());
...@@ -599,6 +608,11 @@ void KdenliveSettingsDialog::slotEnableLibraryFolder() ...@@ -599,6 +608,11 @@ void KdenliveSettingsDialog::slotEnableLibraryFolder()
m_configEnv.libraryfolderurl->setEnabled(!m_configEnv.kcfg_librarytodefaultfolder->isChecked()); m_configEnv.libraryfolderurl->setEnabled(!m_configEnv.kcfg_librarytodefaultfolder->isChecked());
} }
void KdenliveSettingsDialog::slotEnableVideoFolder()
{
m_configEnv.videofolderurl->setEnabled(!m_configEnv.kcfg_videotodefaultfolder->isChecked());
}
void KdenliveSettingsDialog::initDevices() void KdenliveSettingsDialog::initDevices()
{ {
// Fill audio drivers // Fill audio drivers
......
...@@ -74,6 +74,7 @@ private slots: ...@@ -74,6 +74,7 @@ private slots:
void slotDialogModified(); void slotDialogModified();
void slotEnableCaptureFolder(); void slotEnableCaptureFolder();
void slotEnableLibraryFolder(); void slotEnableLibraryFolder();
void slotEnableVideoFolder();
void slotUpdatev4lDevice(); void slotUpdatev4lDevice();
void slotUpdatev4lCaptureProfile(); void slotUpdatev4lCaptureProfile();
void slotManageEncodingProfile(); void slotManageEncodingProfile();
......
...@@ -2677,9 +2677,18 @@ void RenderWidget::parseScriptFiles() ...@@ -2677,9 +2677,18 @@ void RenderWidget::parseScriptFiles()
QTreeWidgetItem *item; QTreeWidgetItem *item;
// List the project scripts // List the project scripts
QDir projectFolder(pCore->currentDoc()->projectDataFolder()); QDir projectFolder(pCore->currentDoc()->projectDataFolder());
projectFolder.mkpath(QStringLiteral("kdenlive-renderqueue")); if (!projectFolder.exists(QStringLiteral("kdenlive-renderqueue"))) {
return;
}
projectFolder.cd(QStringLiteral("kdenlive-renderqueue")); projectFolder.cd(QStringLiteral("kdenlive-renderqueue"));
QStringList scriptFiles = projectFolder.entryList(scriptsFilter, QDir::Files); 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) { for (int i = 0; i < scriptFiles.size(); ++i) {
QUrl scriptpath = QUrl::fromLocalFile(projectFolder.absoluteFilePath(scriptFiles.at(i))); QUrl scriptpath = QUrl::fromLocalFile(projectFolder.absoluteFilePath(scriptFiles.at(i)));
QFile f(scriptpath.toLocalFile()); QFile f(scriptpath.toLocalFile());
......
...@@ -646,7 +646,10 @@ QString KdenliveDoc::projectDataFolder() const ...@@ -646,7 +646,10 @@ QString KdenliveDoc::projectDataFolder() const
if (KdenliveSettings::customprojectfolder()) { if (KdenliveSettings::customprojectfolder()) {
return KdenliveSettings::defaultprojectfolder(); return KdenliveSettings::defaultprojectfolder();
} }
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); if (KdenliveSettings::videotodefaultfolder() || KdenliveSettings::videofolder().isEmpty()) {
return QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
}
return KdenliveSettings::videofolder();
} }
return m_projectFolder; return m_projectFolder;
} }
......
...@@ -488,11 +488,21 @@ ...@@ -488,11 +488,21 @@
<label>Open Library in default system folder.</label> <label>Open Library in default system folder.</label>
<default>true</default> <default>true</default>
</entry> </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"> <entry name="libraryfolder" type="Path">
<label>Default folder for library.</label> <label>Default folder for library.</label>
<default></default> <default></default>
</entry> </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"> <entry name="defaultimageapp" type="String">
<label>Default image editing application.</label> <label>Default image editing application.</label>
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>514</width> <width>662</width>
<height>379</height> <height>468</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
...@@ -17,10 +17,39 @@ ...@@ -17,10 +17,39 @@
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </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"> <item row="1" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
...@@ -97,25 +126,15 @@ ...@@ -97,25 +126,15 @@
<string>Default folders</string> <string>Default folders</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Library folder</string> <string>Temporary files</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2"> <item row="0" column="1">
<spacer name="verticalSpacer_3"> <widget class="KUrlRequester" name="tmppathurl"/>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
...@@ -124,10 +143,20 @@ ...@@ -124,10 +143,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="1">
<widget class="QLabel" name="label_3"> <widget class="QCheckBox" name="kcfg_capturetoprojectfolder">
<property name="text"> <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> </property>
</widget> </widget>
</item> </item>
...@@ -138,21 +167,38 @@ ...@@ -138,21 +167,38 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1" colspan="2"> <item row="4" column="1">
<widget class="KUrlRequester" name="libraryfolderurl"/> <widget class="KUrlRequester" name="libraryfolderurl"/>
</item> </item>
<item row="0" column="1" colspan="2"> <item row="5" column="0">
<widget class="KUrlRequester" name="tmppathurl"/> <widget class="QLabel" name="label_16">
<property name="text">
<string>Folder for titles, scripts</string>
</property>
</widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="5" column="1">
<widget class="QCheckBox" name="kcfg_capturetoprojectfolder"> <widget class="QCheckBox" name="kcfg_videotodefaultfolder">
<property name="text"> <property name="text">
<string>Use project folder</string> <string>Use default folder</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="2"> <item row="6" column="1">
<widget class="KUrlRequester" name="capturefolderurl"/> <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> </item>
</layout> </layout>
</widget> </widget>
...@@ -255,35 +301,6 @@ ...@@ -255,35 +301,6 @@
</widget> </widget>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<customwidgets> <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