Commit 5060037f authored by Julius Künzel's avatar Julius Künzel
Browse files

[Render Widget] Allow more steps for quality slider

Related to #1393
parent 01ca6009
Pipeline #180068 passed with stage
in 7 minutes and 27 seconds
......@@ -1334,19 +1334,25 @@ void RenderWidget::refreshParams()
m_view.qualityGroup->setEnabled(false);
}
// historically qualities are sorted from best to worse for some reason
int vmin = preset->videoQualities().last().toInt();
int vmax = preset->videoQualities().first().toInt();
int vrange = abs(vmax - vmin);
int amin = preset->audioQualities().last().toInt();
int amax = preset->audioQualities().first().toInt();
int arange = abs(amax - amin);
m_view.quality->setMaximum(qMin(100, qMax(vrange, arange)));
double percent = double(m_view.quality->value()) / double(m_view.quality->maximum());
m_view.qualityPercent->setText(QStringLiteral("%1%").arg(qRound(percent * 100)));
// historically qualities are sorted from best to worse for some reason
int min = preset->videoQualities().last().toInt();
int max = preset->videoQualities().first().toInt();
int val = preset->defaultVQuality().toInt();
if (m_view.qualityGroup->isChecked()) {
if (min < max) {
int range = max - min;
val = min + int(range * percent);
if (vmin < vmax) {
val = vmin + int(vrange * percent);
} else {
int range = min - max;
val = min - int(range * percent);
val = vmin - int(vrange * percent);
}
}
params.replace(QStringLiteral("%quality"), QString::number(val));
......@@ -1361,17 +1367,12 @@ void RenderWidget::refreshParams()
// cvbr = Constrained Variable Bit Rate
params.replace(QStringLiteral("%cvbr"), QString::number(val));
// historically qualities are sorted from best to worse for some reason
min = preset->audioQualities().last().toInt();
max = preset->audioQualities().first().toInt();
val = preset->defaultAQuality().toInt();
if (m_view.qualityGroup->isChecked()) {
if (min < max) {
int range = max - min;
val = min + int(range * percent);
if (amin < amax) {
val = amin + int(arange * percent);
} else {
int range = min - max;
val = min - int(range * percent);
val = amin - int(arange * percent);
}
}
params.replace(QStringLiteral("%audioquality"), QString::number(val));
......
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