configuration_shared: Simplify name lookup in highlighting functions

We can query the given object name directly from the widget itself. This
removes any potential for forgetting to change the name if the widget
gets renamed and makes the API much simpler (just pass in the widget,
and not worry about its name).
This commit is contained in:
Lioncash
2020-08-14 14:02:37 -04:00
parent f482b4b40d
commit fe86109877
7 changed files with 74 additions and 90 deletions

View File

@ -59,7 +59,7 @@ void ConfigureAudio::SetConfiguration() {
ui->volume_combo_box->setCurrentIndex(1);
ui->volume_slider->setEnabled(true);
}
ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout",
ConfigurationShared::SetHighlight(ui->volume_layout,
!Settings::values.volume.UsingGlobal());
}
SetVolumeIndicatorText(ui->volume_slider->sliderPosition());
@ -173,14 +173,13 @@ void ConfigureAudio::SetupPerGameUI() {
return;
}
ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching",
ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching,
Settings::values.enable_audio_stretching,
enable_audio_stretching);
connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, [this](int index) {
ui->volume_slider->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", index == 1);
});
connect(ui->volume_combo_box, qOverload<int>(&QComboBox::activated), this, [this](int index) {
ui->volume_slider->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->volume_layout, index == 1);
});
ui->output_sink_combo_box->setVisible(false);
ui->output_sink_label->setVisible(false);