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

Add option to add custom mime types for allowed clips

CCBUG: 364269
parent be600967
......@@ -74,6 +74,22 @@ QStringList ClipCreationDialog::getExtensions()
allExtensions.append(mime.globPatterns());
}
}
// process custom user extensions
QStringList customs = KdenliveSettings::addedExtensions().split(' ', QString::SkipEmptyParts);
if (!customs.isEmpty()) {
foreach(const QString &ext, customs) {
if (ext.startsWith(QLatin1String("*."))) {
allExtensions << ext;
} else if (ext.startsWith(QLatin1String("."))) {
allExtensions << QStringLiteral("*") + ext;
} else if (!ext.contains(QStringLiteral("."))) {
allExtensions << QStringLiteral("*.") + ext;
} else {
//Unrecognized format
qDebug()<<"Unrecognized custom format: "<<ext;
}
}
}
allExtensions.removeDuplicates();
return allExtensions;
}
......
......@@ -24,6 +24,7 @@
#include "utils/KoIconUtils.h"
#include "dialogs/profilesdialog.h"
#include "kdenlivesettings.h"
#include "clipcreationdialog.h"
#include "renderer.h"
#ifdef USE_V4L
......@@ -116,6 +117,11 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
m_configEnv.kcfg_librarytodefaultfolder->setToolTip(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/library"));
connect(m_configEnv.kcfg_librarytodefaultfolder, SIGNAL(clicked()), this, SLOT(slotEnableLibraryFolder()));
// Mime types
QStringList mimes = ClipCreationDialog::getExtensions();
qSort(mimes);
m_configEnv.supportedmimes->setPlainText(mimes.join(QStringLiteral(" ")));
m_page2 = addPage(p2, i18n("Environment"));
m_page2->setIcon(KoIconUtils::themedIcon(QStringLiteral("application-x-executable-script")));
......@@ -866,6 +872,15 @@ void KdenliveSettingsDialog::updateSettings()
}
}
// Mimes
if (m_configEnv.kcfg_addedExtensions->text() != KdenliveSettings::addedExtensions()) {
// Update list
KdenliveSettings::setAddedExtensions(m_configEnv.kcfg_addedExtensions->text());
QStringList mimes = ClipCreationDialog::getExtensions();
qSort(mimes);
m_configEnv.supportedmimes->setPlainText(mimes.join(QStringLiteral(" ")));
}
KConfigDialog::settingsChangedSlot();
//KConfigDialog::updateSettings();
if (resetProfile) emit doResetProfile();
......
......@@ -16,6 +16,10 @@
<label>Bin default zoom.</label>
<default>4</default>
</entry>
<entry name="addedExtensions" type="String">
<label>User added clip file extensions.</label>
<default></default>
</entry>
</group>
<group name="misc">
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>446</width>
<height>438</height>
<width>566</width>
<height>441</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......@@ -17,48 +17,6 @@
<property name="topMargin">
<number>0</number>
</property>
<item row="2" column="0">
<spacer name="verticalSpacer">
<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 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>
<item row="1" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
......@@ -287,6 +245,70 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Mime types</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Additional clip mime types</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="kcfg_addedExtensions">
<property name="placeholderText">
<string notr="true">*.mp4 *.mov</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Supported clip mime types</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPlainTextEdit" name="supportedmimes">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</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>
......
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