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

Render profiles: make text parameters read-only, and add a button to switch to...

Render profiles: make text parameters read-only, and add a button to switch to text edit only as mixing manual editing with presets is unreliable.
Related to #1441
parent de8d9046
Pipeline #211675 passed with stage
in 7 minutes and 45 seconds
This diff is collapsed.
......@@ -33,6 +33,7 @@ private:
QStringList m_uiParams;
Monitor *m_monitor;
double m_fixedResRatio;
bool m_manualPreset;
void setPixelAspectRatio(int num, int den);
void updateDisplayAspectRatio();
......
......@@ -43,6 +43,7 @@ RenderPresetModel::RenderPresetModel(QDomElement preset, const QString &presetFi
m_params = docConvert.toPlainText().simplified();
m_extension = preset.attribute(QStringLiteral("extension"));
m_manual = preset.attribute(QStringLiteral("manual")) == QLatin1String("1");
if (getParam(QStringLiteral("f")).isEmpty() && !m_extension.isEmpty() && RenderPresetRepository::supportedFormats().contains(m_extension)) {
m_params.append(QStringLiteral(" f=%1").arg(m_extension));
......@@ -68,6 +69,7 @@ RenderPresetModel::RenderPresetModel(QDomElement preset, const QString &presetFi
RenderPresetModel::RenderPresetModel(const QString &groupName, const QString &path, QString presetName, const QString &params, bool codecInName)
: m_editable(false)
, m_params(params)
, m_manual(false)
, m_groupName(groupName)
, m_renderer(QStringLiteral("avformat"))
, m_defaultSpeedIndex(-1)
......@@ -100,7 +102,7 @@ RenderPresetModel::RenderPresetModel(const QString &groupName, const QString &pa
RenderPresetModel::RenderPresetModel(const QString &name, const QString &groupName, const QString &params, const QString &extension,
const QString &defaultVBitrate, const QString &defaultVQuality, const QString &defaultABitrate,
const QString &defaultAQuality, const QString &speedsString)
const QString &defaultAQuality, const QString &speedsString, bool manualPreset)
: m_presetFile()
, m_editable()
, m_name(name)
......@@ -127,6 +129,7 @@ RenderPresetModel::RenderPresetModel(const QString &name, const QString &groupNa
}
m_defaultSpeedIndex = (speeds().count() - 1) * 0.75;
m_manual = manualPreset;
checkPreset();
}
......@@ -213,6 +216,9 @@ QDomElement RenderPresetModel::toXml()
if (!m_extension.isEmpty()) {
profileElement.setAttribute(QStringLiteral("extension"), m_extension);
}
if (m_manual) {
profileElement.setAttribute(QStringLiteral("manual"), QStringLiteral("1"));
}
profileElement.setAttribute(QStringLiteral("args"), m_params);
if (!m_defaultVBitrate.isEmpty()) {
profileElement.setAttribute(QStringLiteral("defaultbitrate"), m_defaultVBitrate);
......@@ -352,6 +358,11 @@ QString RenderPresetModel::getParam(const QString &name) const
return {};
}
bool RenderPresetModel::isManual() const
{
return m_manual;
}
bool RenderPresetModel::hasParam(const QString &name) const
{
return !getParam(name).isEmpty();
......
......@@ -25,7 +25,8 @@ public:
const QString &renderer = QStringLiteral("avformat"));
RenderPresetModel(const QString &groupName, const QString &path, QString presetName, const QString &params, bool codecInName);
RenderPresetModel(const QString &name, const QString &groupName, const QString &params, const QString &extension, const QString &defaultVBitrate,
const QString &defaultVQuality, const QString &defaultABitrate, const QString &defaultAQuality, const QString &speedsString);
const QString &defaultVQuality, const QString &defaultABitrate, const QString &defaultAQuality, const QString &speedsString,
bool manualPreset);
enum InstallType { BuildIn, Custom, Download };
......@@ -54,6 +55,7 @@ public:
QStringList videoQualities() const;
QString defaultVQuality() const;
bool editable() const;
bool isManual() const;
QString getParam(const QString &name) const;
bool hasParam(const QString &name) const;
......@@ -76,6 +78,7 @@ private:
QString m_standard;
QString m_params;
QString m_extension;
bool m_manual;
QString m_groupName;
QString m_renderer;
QString m_url;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>622</height>
<width>556</width>
<height>817</height>
</rect>
</property>
<property name="windowTitle">
......@@ -63,7 +63,7 @@
<widget class="QLineEdit" name="preset_name"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_container">
<property name="text">
<string>Container:</string>
</property>
......@@ -155,8 +155,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>522</width>
<height>322</height>
<width>536</width>
<height>471</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
......@@ -173,8 +173,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>489</width>
<height>580</height>
<width>519</width>
<height>730</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
......@@ -1014,7 +1014,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="other_tab">
<attribute name="title">
<string>Other</string>
</attribute>
......@@ -1072,12 +1072,42 @@
</property>
</widget>
</item>
<item>
<widget class="KMessageWidget" name="kmessagewidget">
<property name="text">
<string>Enabling manual editing is for advanced users, you will only be able to edit the settings for this preset in a text box.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="closeButtonVisible">
<bool>false</bool>
</property>
<property name="messageType">
<enum>KMessageWidget::Warning</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_manual">
<property name="text">
<string>Enable manual editing</string>
</property>
<property name="icon">
<iconset theme="data-warning"/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="parameters"/>
<widget class="QPlainTextEdit" name="parameters">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
......
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