Allow selection of a default timeline preview profile

CCBUG: 364936
parent c10f66e0
......@@ -282,7 +282,17 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
act->setData(1);
connect(act, SIGNAL(triggered(bool)), this, SLOT(slotManageEncodingProfile()));
m_configTimeline.tl_manageprofile->setDefaultAction(act);
m_configProject.preview_manageprofile->setDefaultAction(act);
connect(m_configProject.kcfg_preview_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatePreviewProfile()));
connect(m_configProject.preview_showprofileinfo, SIGNAL(clicked(bool)), m_configProject.previewparams, SLOT(setVisible(bool)));
m_configProject.previewparams->setVisible(false);
m_configProject.previewparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 3);
m_configProject.previewparams->setPlainText(KdenliveSettings::previewparams());
m_configProject.preview_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
m_configProject.preview_showprofileinfo->setToolTip(i18n("Show default timeline preview parameters"));
m_configProject.preview_manageprofile->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
m_configProject.preview_manageprofile->setToolTip(i18n("Manage timeline preview profiles"));
m_configProject.kcfg_preview_profile->setToolTip(i18n("Select default timeline preview profile"));
// Project profile management
m_configProject.manage_profiles->setIcon(KoIconUtils::themedIcon("configure"));
......@@ -296,7 +306,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
m_configProject.proxy_manageprofile->setToolTip(i18n("Manage proxy profiles"));
m_configProject.kcfg_proxy_profile->setToolTip(i18n("Select default proxy profile"));
m_configProject.proxyparams->setVisible(false);
m_configProject.proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4);
m_configProject.proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 3);
m_configProject.proxyparams->setPlainText(KdenliveSettings::proxyparams());
act = new QAction(KoIconUtils::themedIcon(QStringLiteral("configure")), i18n("Configure profiles"), this);
......@@ -800,6 +810,13 @@ void KdenliveSettingsDialog::updateSettings()
KdenliveSettings::setProxyextension(data.section(';', 1, 1));
}
// timeline preview
data = m_configProject.kcfg_preview_profile->itemData(m_configProject.kcfg_preview_profile->currentIndex()).toString();
if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::previewparams() || data.section(';', 1, 1) != KdenliveSettings::previewextension())) {
KdenliveSettings::setPreviewparams(data.section(';', 0, 0));
KdenliveSettings::setPreviewextension(data.section(';', 1, 1));
}
if (updateCapturePath) emit updateCaptureFolder();
if (updateLibrary) emit updateLibraryFolder();
......@@ -1219,6 +1236,27 @@ void KdenliveSettingsDialog::loadEncodingProfiles()
}
m_configCapture.kcfg_decklink_profile->blockSignals(false);
if (!currentItem.isEmpty()) m_configCapture.kcfg_decklink_profile->setCurrentIndex(m_configCapture.kcfg_decklink_profile->findText(currentItem));
// Load Timeline Preview profiles
m_configProject.kcfg_preview_profile->blockSignals(true);
currentItem = m_configProject.kcfg_preview_profile->currentText();
m_configProject.kcfg_preview_profile->clear();
KConfigGroup group5(&conf, "timelinepreview");
values = group5.entryMap();
m_configProject.kcfg_preview_profile->addItem(i18n("Automatic"));
QMapIterator<QString, QString> l(values);
while (l.hasNext()) {
l.next();
if (!l.key().isEmpty()) m_configProject.kcfg_preview_profile->addItem(l.key(), l.value());
}
if (!currentItem.isEmpty()) m_configProject.kcfg_preview_profile->setCurrentIndex(m_configProject.kcfg_preview_profile->findText(currentItem));
m_configProject.kcfg_preview_profile->blockSignals(false);
QString data = m_configProject.kcfg_preview_profile->itemData(m_configProject.kcfg_preview_profile->currentIndex()).toString();
if (data.isEmpty()) {
m_configProject.previewparams->clear();
} else {
m_configProject.previewparams->setPlainText(data.section(';', 0, 0));
}
// Load Proxy profiles
m_configProject.kcfg_proxy_profile->blockSignals(true);
......@@ -1226,14 +1264,19 @@ void KdenliveSettingsDialog::loadEncodingProfiles()
m_configProject.kcfg_proxy_profile->clear();
KConfigGroup group4(&conf, "proxy");
values = group4.entryMap();
QMapIterator<QString, QString> l(values);
while (l.hasNext()) {
l.next();
if (!l.key().isEmpty()) m_configProject.kcfg_proxy_profile->addItem(l.key(), l.value());
QMapIterator<QString, QString> m(values);
while (m.hasNext()) {
m.next();
if (!m.key().isEmpty()) m_configProject.kcfg_proxy_profile->addItem(m.key(), m.value());
}
if (!currentItem.isEmpty()) m_configProject.kcfg_proxy_profile->setCurrentIndex(m_configProject.kcfg_proxy_profile->findText(currentItem));
m_configProject.kcfg_proxy_profile->blockSignals(false);
slotUpdateProxyProfile();
data = m_configProject.kcfg_proxy_profile->itemData(m_configProject.kcfg_proxy_profile->currentIndex()).toString();
if (data.isEmpty()) {
m_configProject.proxyparams->clear();
} else {
m_configProject.proxyparams->setPlainText(data.section(';', 0, 0));
}
}
void KdenliveSettingsDialog::slotUpdateDecklinkProfile(int ix)
......@@ -1268,13 +1311,22 @@ void KdenliveSettingsDialog::slotUpdateGrabProfile(int ix)
void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix)
{
if (ix == -1) ix = KdenliveSettings::v4l_profile();
if (ix == -1) ix = KdenliveSettings::proxy_profile();
else ix = m_configProject.kcfg_proxy_profile->currentIndex();
QString data = m_configProject.kcfg_proxy_profile->itemData(ix).toString();
if (data.isEmpty()) return;
m_configProject.proxyparams->setPlainText(data.section(';', 0, 0));
}
void KdenliveSettingsDialog::slotUpdatePreviewProfile(int ix)
{
if (ix == -1) ix = KdenliveSettings::preview_profile();
else ix = m_configProject.kcfg_preview_profile->currentIndex();
QString data = m_configProject.kcfg_preview_profile->itemData(ix).toString();
if (data.isEmpty()) return;
m_configProject.previewparams->setPlainText(data.section(';', 0, 0));
}
void KdenliveSettingsDialog::slotEditVideo4LinuxProfile()
{
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
......
......@@ -77,6 +77,7 @@ private slots:
void slotManageEncodingProfile();
void slotUpdateDecklinkProfile(int ix = 0);
void slotUpdateProxyProfile(int ix = 0);
void slotUpdatePreviewProfile(int ix = 0);
void slotUpdateV4lProfile(int ix = 0);
void slotUpdateGrabProfile(int ix = 0);
void slotEditVideo4LinuxProfile();
......
......@@ -130,6 +130,8 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup
m_documentProperties[QStringLiteral("enableproxy")] = QString::number((int) KdenliveSettings::enableproxy());
m_documentProperties[QStringLiteral("proxyparams")] = KdenliveSettings::proxyparams();
m_documentProperties[QStringLiteral("proxyextension")] = KdenliveSettings::proxyextension();
m_documentProperties[QStringLiteral("previewparams")] = KdenliveSettings::previewparams();
m_documentProperties[QStringLiteral("previewextension")] = KdenliveSettings::previewextension();
m_documentProperties[QStringLiteral("generateproxy")] = QString::number((int) KdenliveSettings::generateproxy());
m_documentProperties[QStringLiteral("proxyminsize")] = QString::number(KdenliveSettings::proxyminsize());
m_documentProperties[QStringLiteral("generateimageproxy")] = QString::number((int) KdenliveSettings::generateimageproxy());
......@@ -1539,6 +1541,11 @@ void KdenliveDoc::displayMessage(const QString text, MessageType type, int timeO
void KdenliveDoc::selectPreviewProfile()
{
// Read preview profiles and find the best match
if (!KdenliveSettings::previewparams().isEmpty()) {
setDocumentProperty(QStringLiteral("previewparameters"), KdenliveSettings::previewparams());
setDocumentProperty(QStringLiteral("previewextension"), KdenliveSettings::previewextension());
return;
}
KConfig conf(QStringLiteral("encodingprofiles.rc"), KConfig::CascadeConfig, QStandardPaths::DataLocation);
KConfigGroup group(&conf, "timelinepreview");
QMap< QString, QString > values = group.entryMap();
......
......@@ -156,6 +156,20 @@
<default></default>
</entry>
<entry name="previewextension" type="String">
<label>File extension for timeline preview.</label>
<default></default>
</entry>
<entry name="preview_profile" type="UInt">
<label>default preview encoding profile.</label>
<default>0</default>
</entry>
<entry name="previewparams" type="String">
<label>Timeline preview encoding parameters.</label>
<default></default>
</entry>
</group>
<group name="timeline">
......
......@@ -91,7 +91,7 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap <QString, QString> metad
generate_imageproxy->setChecked(doc->getDocumentProperty(QStringLiteral("generateimageproxy")).toInt());
proxy_imageminsize->setValue(doc->getDocumentProperty(QStringLiteral("proxyimageminsize")).toInt());
m_proxyextension = doc->getDocumentProperty(QStringLiteral("proxyextension"));
m_previewparams = doc->getDocumentProperty(QStringLiteral("previewparameters"));
m_previewparams = doc->getDocumentProperty(QStringLiteral("previewparams"));
m_previewextension = doc->getDocumentProperty(QStringLiteral("previewextension"));
TemporaryData *cacheWidget = new TemporaryData(doc, true, this);
connect(cacheWidget, SIGNAL(disableProxies()), this, SIGNAL(disableProxies()));
......@@ -107,6 +107,8 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap <QString, QString> metad
generate_imageproxy->setChecked(KdenliveSettings::generateimageproxy());
proxy_imageminsize->setValue(KdenliveSettings::proxyimageminsize());
m_proxyextension = KdenliveSettings::proxyextension();
m_previewparams = KdenliveSettings::previewparams();
m_previewextension = KdenliveSettings::previewextension();
}
// Select profile
......
......@@ -6,17 +6,11 @@
<rect>
<x>0</x>
<y>0</y>
<width>478</width>
<height>516</height>
<width>505</width>
<height>654</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="5">
<widget class="QGroupBox" name="properties">
<property name="title">
......@@ -254,7 +248,64 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<item row="3" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_25">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Timeline Preview</string>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="kcfg_preview_profile">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="preview_showprofileinfo">
<property name="text">
<string>...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="preview_manageprofile">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="5">
<widget class="QPlainTextEdit" name="previewparams">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......
......@@ -11,6 +11,57 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="4">
<widget class="QCheckBox" name="kcfg_ffmpegaudiothumbnails">
<property name="text">
<string>Use FFmpeg for audio thumbnails (faster)</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_showmarkers">
<property name="text">
<string>Display clip markers comments</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Track height</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="kcfg_trackheight">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_splitaudio">
<property name="text">
......@@ -18,6 +69,20 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_autoscroll">
<property name="text">
<string>Autoscroll while playing</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_verticalzoom">
<property name="text">
<string>Zoom using vertical drag in ruler</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox">
<property name="title">
......@@ -68,21 +133,7 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_autoscroll">
<property name="text">
<string>Autoscroll while playing</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QCheckBox" name="kcfg_ffmpegaudiothumbnails">
<property name="text">
<string>Use FFmpeg for audio thumbnails (faster)</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -95,77 +146,6 @@
</property>
</spacer>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_verticalzoom">
<property name="text">
<string>Zoom using vertical drag in ruler</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Track height</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="kcfg_trackheight">
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_showmarkers">
<property name="text">
<string>Display clip markers comments</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QToolButton" name="tl_manageprofile">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QLabel" name="label_24">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Timeline preview profiles</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
......
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