Slider: add label substitution for certain values
Allows "Threads" option in advanced export setting to show "Auto" when set to 0
This commit is contained in:
@@ -48,6 +48,7 @@ ExportAdvancedVideoDialog::ExportAdvancedVideoDialog(const QList<QString> &pix_f
|
|||||||
thread_slider_ = new IntegerSlider();
|
thread_slider_ = new IntegerSlider();
|
||||||
thread_slider_->SetMinimum(0);
|
thread_slider_->SetMinimum(0);
|
||||||
thread_slider_->SetDefaultValue(0);
|
thread_slider_->SetDefaultValue(0);
|
||||||
|
thread_slider_->InsertLabelSubstitution(0, tr("Auto"));
|
||||||
performance_layout->addWidget(thread_slider_, row, 1);
|
performance_layout->addWidget(thread_slider_, row, 1);
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
|
|||||||
@@ -251,7 +251,6 @@ void ExportVideoTab::VideoCodecChanged()
|
|||||||
} else {
|
} else {
|
||||||
pix_fmt_.clear();
|
pix_fmt_.clear();
|
||||||
}
|
}
|
||||||
qDebug() << "Set default pix fmt" << pix_fmt_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportVideoTab::SetTime(const rational &time)
|
void ExportVideoTab::SetTime(const rational &time)
|
||||||
|
|||||||
@@ -104,7 +104,17 @@ void SliderBase::changeEvent(QEvent *e)
|
|||||||
|
|
||||||
void SliderBase::UpdateLabel()
|
void SliderBase::UpdateLabel()
|
||||||
{
|
{
|
||||||
label_->setText(tristate_ ? tr("---") : GetFormattedValueToString());
|
QString s;
|
||||||
|
|
||||||
|
if (tristate_) {
|
||||||
|
s = tr("---");
|
||||||
|
} else if (label_substitutions_.contains(GetValueInternal())) {
|
||||||
|
s = label_substitutions_.value(GetValueInternal());
|
||||||
|
} else {
|
||||||
|
s = GetFormattedValueToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
label_->setText(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SliderBase::AdjustValue(const QVariant &value) const
|
QVariant SliderBase::AdjustValue(const QVariant &value) const
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ public:
|
|||||||
|
|
||||||
QString GetFormattedValueToString(const QVariant& v) const;
|
QString GetFormattedValueToString(const QVariant& v) const;
|
||||||
|
|
||||||
|
void InsertLabelSubstitution(const QVariant &value, const QString &label)
|
||||||
|
{
|
||||||
|
label_substitutions_.insert(value, label);
|
||||||
|
UpdateLabel();
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ShowEditor();
|
void ShowEditor();
|
||||||
|
|
||||||
@@ -92,6 +98,8 @@ private:
|
|||||||
|
|
||||||
bool format_plural_;
|
bool format_plural_;
|
||||||
|
|
||||||
|
QMap<QVariant, QString> label_substitutions_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void LineEditConfirmed();
|
void LineEditConfirmed();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user