DolphinQt: Use qOverload where applicable

Provides the same behvaior, but in a much more concise manner.
This commit is contained in:
Lioncash
2019-07-30 09:35:46 -04:00
committed by Léo Lam
parent 58de3c59ce
commit 19115c84dd
28 changed files with 96 additions and 127 deletions

View File

@ -171,12 +171,12 @@ void AudioPane::CreateWidgets()
void AudioPane::ConnectWidgets()
{
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &AudioPane::SaveSettings);
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&AudioPane::SaveSettings);
connect(m_volume_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings);
if (m_latency_control_supported)
{
connect(m_latency_spin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_latency_spin, qOverload<int>(&QSpinBox::valueChanged), this,
&AudioPane::SaveSettings);
}
connect(m_stretching_buffer_slider, &QSlider::valueChanged, this, &AudioPane::SaveSettings);
@ -188,8 +188,7 @@ void AudioPane::ConnectWidgets()
connect(m_dsp_interpreter, &QRadioButton::toggled, this, &AudioPane::SaveSettings);
#ifdef _WIN32
connect(m_wasapi_device_combo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_wasapi_device_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&AudioPane::SaveSettings);
#endif
}

View File

@ -130,15 +130,15 @@ void GameCubePane::ConnectWidgets()
{
// IPL Settings
connect(m_skip_main_menu, &QCheckBox::stateChanged, this, &GameCubePane::SaveSettings);
connect(m_language_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
connect(m_language_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GameCubePane::SaveSettings);
// Device Settings
for (int i = 0; i < SLOT_COUNT; i++)
{
connect(m_slot_combos[i], QOverload<int>::of(&QComboBox::currentIndexChanged), this,
connect(m_slot_combos[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
[this, i] { UpdateButton(i); });
connect(m_slot_combos[i], QOverload<int>::of(&QComboBox::currentIndexChanged), this,
connect(m_slot_combos[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
&GameCubePane::SaveSettings);
connect(m_slot_buttons[i], &QPushButton::clicked, [this, i] { OnConfigPressed(i); });
}

View File

@ -96,16 +96,14 @@ void GeneralPane::ConnectLayout()
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
{
connect(m_combobox_update_track,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_combobox_update_track, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GeneralPane::OnSaveConfig);
connect(&Settings::Instance(), &Settings::AutoUpdateTrackChanged, this,
&GeneralPane::LoadConfig);
}
// Advanced
connect(m_combobox_speedlimit,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_combobox_speedlimit, qOverload<int>(&QComboBox::currentIndexChanged),
[this]() { OnSaveConfig(); });
#if defined(USE_ANALYTICS) && USE_ANALYTICS

View File

@ -188,14 +188,11 @@ void InterfacePane::ConnectLayout()
connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme,
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
connect(m_combobox_theme, qOverload<const QString&>(&QComboBox::currentIndexChanged),
&Settings::Instance(), &Settings::SetThemeName);
connect(m_combobox_userstyle,
static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this,
connect(m_combobox_userstyle, qOverload<const QString&>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig);
connect(m_combobox_language,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_combobox_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig);
connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_confirm_on_stop, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);

View File

@ -64,11 +64,9 @@ void WiiPane::CreateLayout()
void WiiPane::ConnectLayout()
{
// Misc Settings
connect(m_aspect_ratio_choice,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_aspect_ratio_choice, qOverload<int>(&QComboBox::currentIndexChanged), this,
&WiiPane::OnSaveConfig);
connect(m_system_language_choice,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_system_language_choice, qOverload<int>(&QComboBox::currentIndexChanged), this,
&WiiPane::OnSaveConfig);
connect(m_screensaver_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
@ -87,8 +85,7 @@ void WiiPane::ConnectLayout()
&WiiPane::OnUSBWhitelistRemoveButton);
// Wii Remote Settings
connect(m_wiimote_ir_sensor_position,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_wiimote_ir_sensor_position, qOverload<int>(&QComboBox::currentIndexChanged), this,
&WiiPane::OnSaveConfig);
connect(m_wiimote_ir_sensitivity, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig);
connect(m_wiimote_speaker_volume, &QSlider::valueChanged, this, &WiiPane::OnSaveConfig);