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

@ -260,20 +260,16 @@ void ControllersWindow::ConnectWidgets()
for (size_t i = 0; i < m_wiimote_groups.size(); i++)
{
connect(m_wiimote_boxes[i],
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_wiimote_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::SaveSettings);
connect(m_wiimote_boxes[i],
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_wiimote_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::OnWiimoteModeChanged);
connect(m_wiimote_buttons[i], &QPushButton::clicked, this,
&ControllersWindow::OnWiimoteConfigure);
connect(m_gc_controller_boxes[i],
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_gc_controller_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::SaveSettings);
connect(m_gc_controller_boxes[i],
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_gc_controller_boxes[i], qOverload<int>(&QComboBox::currentIndexChanged), this,
&ControllersWindow::OnGCTypeChanged);
connect(m_gc_buttons[i], &QPushButton::clicked, this, &ControllersWindow::OnGCPadConfigure);
}

View File

@ -135,8 +135,8 @@ void GameConfigEdit::ConnectWidgets()
{
connect(m_edit, &QTextEdit::textChanged, this, &GameConfigEdit::SaveFile);
connect(m_edit, &QTextEdit::selectionChanged, this, &GameConfigEdit::OnSelectionChanged);
connect(m_completer, static_cast<void (QCompleter::*)(const QString&)>(&QCompleter::activated),
this, &GameConfigEdit::OnAutoComplete);
connect(m_completer, qOverload<const QString&>(&QCompleter::activated), this,
&GameConfigEdit::OnAutoComplete);
}
void GameConfigEdit::OnSelectionChanged()

View File

@ -210,12 +210,11 @@ void GameConfigWidget::ConnectWidgets()
m_enable_fast_disc, m_use_dsp_hle, m_use_monoscopic_shadows})
connect(box, &QCheckBox::stateChanged, this, &GameConfigWidget::SaveSettings);
connect(m_deterministic_dual_core,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_deterministic_dual_core, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GameConfigWidget::SaveSettings);
connect(m_depth_slider, static_cast<void (QSlider::*)(int)>(&QSlider::valueChanged), this,
connect(m_depth_slider, qOverload<int>(&QSlider::valueChanged), this,
&GameConfigWidget::SaveSettings);
connect(m_convergence_spin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_convergence_spin, qOverload<int>(&QSpinBox::valueChanged), this,
&GameConfigWidget::SaveSettings);
}

View File

@ -144,18 +144,17 @@ void EnhancementsWidget::CreateWidgets()
void EnhancementsWidget::ConnectWidgets()
{
connect(m_aa_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_aa_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_pp_effect, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_pp_effect, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_3d_mode, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this] {
m_block_save = true;
LoadPPShaders();
m_block_save = false;
connect(m_3d_mode, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
m_block_save = true;
LoadPPShaders();
m_block_save = false;
SaveSettings();
});
SaveSettings();
});
connect(m_configure_pp_effect, &QPushButton::clicked, this,
&EnhancementsWidget::ConfigurePostProcessingShader);
}

View File

@ -138,13 +138,12 @@ void GeneralWidget::CreateWidgets()
void GeneralWidget::ConnectWidgets()
{
// Video Backend
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &GeneralWidget::SaveSettings);
connect(m_adapter_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, [](int index) {
g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
});
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&GeneralWidget::SaveSettings);
connect(m_adapter_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, [](int index) {
g_Config.iAdapter = index;
Config::SetBaseOrCurrent(Config::GFX_ADAPTER, index);
});
}
void GeneralWidget::LoadSettings()

View File

@ -14,8 +14,7 @@ GraphicsChoice::GraphicsChoice(const QStringList& options, const Config::ConfigI
: m_setting(setting)
{
addItems(options);
connect(this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GraphicsChoice::Update);
connect(this, qOverload<int>(&QComboBox::currentIndexChanged), this, &GraphicsChoice::Update);
setCurrentIndex(Config::Get(m_setting));
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {

View File

@ -20,9 +20,7 @@ GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigI
setValue(Config::Get(setting));
connect(this, static_cast<void (GraphicsInteger::*)(int)>(&GraphicsInteger::valueChanged), this,
&GraphicsInteger::Update);
connect(this, qOverload<int>(&GraphicsInteger::valueChanged), this, &GraphicsInteger::Update);
connect(&Settings::Instance(), &Settings::ConfigChanged, [this] {
QFont bf = font();
bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base);

View File

@ -111,11 +111,11 @@ void SoftwareRendererWidget::CreateWidgets()
void SoftwareRendererWidget::ConnectWidgets()
{
connect(m_backend_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(m_backend_combo, qOverload<int>(&QComboBox::currentIndexChanged),
[this](int) { SaveSettings(); });
connect(m_object_range_min, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
connect(m_object_range_min, qOverload<int>(&QSpinBox::valueChanged),
[this](int) { SaveSettings(); });
connect(m_object_range_max, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
connect(m_object_range_max, qOverload<int>(&QSpinBox::valueChanged),
[this](int) { SaveSettings(); });
}

View File

@ -175,8 +175,7 @@ void InfoWidget::CreateLanguageSelector()
if (m_language_selector->count() == 1)
m_language_selector->setDisabled(true);
connect(m_language_selector,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_language_selector, qOverload<int>(&QComboBox::currentIndexChanged), this,
&InfoWidget::ChangeLanguage);
}

View File

@ -167,7 +167,7 @@ void LogWidget::ConnectWidgets()
m_log_ring_buffer.clear();
});
connect(m_log_wrap, &QCheckBox::toggled, this, &LogWidget::SaveSettings);
connect(m_log_font, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_log_font, qOverload<int>(&QComboBox::currentIndexChanged), this,
&LogWidget::SaveSettings);
connect(this, &QDockWidget::topLevelChanged, this, &LogWidget::SaveSettings);
connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, &LogWidget::setVisible);

View File

@ -386,9 +386,7 @@ void IOWindow::ConnectWidgets()
connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed);
connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged);
connect(m_range_spinbox, static_cast<void (QSpinBox::*)(int value)>(&QSpinBox::valueChanged),
this, &IOWindow::OnRangeChanged);
connect(m_range_slider, static_cast<void (QSlider::*)(int value)>(&QSlider::valueChanged), this,
connect(m_range_spinbox, qOverload<int>(&QSpinBox::valueChanged), this,
&IOWindow::OnRangeChanged);
connect(m_expression_text, &QPlainTextEdit::textChanged, [this] {
@ -396,7 +394,7 @@ void IOWindow::ConnectWidgets()
m_apply_button->setText(m_apply_button->text() + QStringLiteral("*"));
});
connect(m_operators_combo, QOverload<int>::of(&QComboBox::activated), [this](int index) {
connect(m_operators_combo, qOverload<int>(&QComboBox::activated), [this](int index) {
if (0 == index)
return;
@ -405,7 +403,7 @@ void IOWindow::ConnectWidgets()
m_operators_combo->setCurrentIndex(0);
});
connect(m_functions_combo, QOverload<int>::of(&QComboBox::activated), [this](int index) {
connect(m_functions_combo, qOverload<int>(&QComboBox::activated), [this](int index) {
if (0 == index)
return;

View File

@ -19,7 +19,7 @@ MappingDouble::MappingDouble(MappingWidget* parent, ControllerEmu::NumericSettin
if (const auto ui_description = m_setting.GetUIDescription())
setToolTip(tr(ui_description));
connect(this, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
connect(this, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
[this, parent](double value) {
m_setting.SetValue(value);
ConfigChanged();

View File

@ -101,7 +101,7 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
indicator_layout->setAlignment(Qt::AlignCenter);
form_layout->addRow(indicator_layout);
connect(this, &MappingWidget::Update, indicator, QOverload<>::of(&MappingIndicator::update));
connect(this, &MappingWidget::Update, indicator, qOverload<>(&MappingIndicator::update));
const bool need_calibration = group->type == ControllerEmu::GroupType::Cursor ||
group->type == ControllerEmu::GroupType::Stick ||

View File

@ -153,8 +153,8 @@ void MappingWindow::ConnectWidgets()
connect(&Settings::Instance(), &Settings::DevicesChanged, this,
&MappingWindow::OnGlobalDevicesChanged);
connect(this, &MappingWindow::ConfigChanged, this, &MappingWindow::OnGlobalDevicesChanged);
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &MappingWindow::OnSelectDevice);
connect(m_devices_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&MappingWindow::OnSelectDevice);
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);

View File

@ -77,9 +77,9 @@ void WiimoteEmuGeneral::CreateMainLayout()
void WiimoteEmuGeneral::Connect()
{
connect(m_extension_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
connect(m_extension_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&WiimoteEmuGeneral::OnAttachmentChanged);
connect(m_extension_combo, QOverload<int>::of(&QComboBox::activated), this,
connect(m_extension_combo, qOverload<int>(&QComboBox::activated), this,
&WiimoteEmuGeneral::OnAttachmentSelected);
connect(this, &MappingWidget::ConfigChanged, this, &WiimoteEmuGeneral::ConfigChanged);
connect(this, &MappingWidget::Update, this, &WiimoteEmuGeneral::Update);

View File

@ -68,7 +68,7 @@ void NewPatchDialog::CreateWidgets()
void NewPatchDialog::ConnectWidgets()
{
connect(m_name_edit, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
connect(m_name_edit, qOverload<const QString&>(&QLineEdit::textEdited),
[this](const QString& name) { m_patch.name = name.toStdString(); });
connect(m_add_button, &QPushButton::clicked, this, &NewPatchDialog::AddEntry);
@ -130,7 +130,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry)
layout->addWidget(remove, 3, 0, 1, -1);
box->setLayout(layout);
connect(offset, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
connect(offset, qOverload<const QString&>(&QLineEdit::textEdited),
[&entry, offset](const QString& text) {
bool okay = true;
entry.address = text.toUInt(&okay, 16);
@ -147,7 +147,7 @@ QGroupBox* NewPatchDialog::CreateEntry(PatchEngine::PatchEntry& entry)
offset->setPalette(palette);
});
connect(value, static_cast<void (QLineEdit::*)(const QString&)>(&QLineEdit::textEdited),
connect(value, qOverload<const QString&>(&QLineEdit::textEdited),
[&entry, value](const QString& text) {
bool okay;
entry.value = text.toUInt(&okay, 16);

View File

@ -169,14 +169,14 @@ void FIFOPlayerWindow::ConnectWidgets()
connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::reject);
connect(m_early_memory_updates, &QCheckBox::toggled, this,
&FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged);
connect(m_frame_range_from, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged);
connect(m_frame_range_to, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_frame_range_to, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged);
connect(m_object_range_from, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_object_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged);
connect(m_object_range_to, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_object_range_to, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged);
}

View File

@ -126,8 +126,8 @@ void NetPlayBrowser::CreateWidgets()
void NetPlayBrowser::ConnectWidgets()
{
connect(m_region_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &NetPlayBrowser::Refresh);
connect(m_region_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&NetPlayBrowser::Refresh);
connect(m_button_box, &QDialogButtonBox::accepted, this, &NetPlayBrowser::accept);
connect(m_button_box, &QDialogButtonBox::rejected, this, &NetPlayBrowser::reject);

View File

@ -255,7 +255,7 @@ void NetPlayDialog::CreatePlayersLayout()
void NetPlayDialog::ConnectWidgets()
{
// Players
connect(m_room_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(m_room_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
&NetPlayDialog::UpdateGUI);
connect(m_hostcode_action_button, &QPushButton::clicked, [this] {
if (m_is_copy_button_retry && m_room_box->currentIndex() == 0)
@ -286,18 +286,17 @@ void NetPlayDialog::ConnectWidgets()
[this] { m_chat_send_button->setEnabled(!m_chat_type_edit->text().isEmpty()); });
// Other
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
[this](int value) {
if (value == m_buffer_size)
return;
connect(m_buffer_size_box, qOverload<int>(&QSpinBox::valueChanged), [this](int value) {
if (value == m_buffer_size)
return;
auto client = Settings::Instance().GetNetPlayClient();
auto server = Settings::Instance().GetNetPlayServer();
if (server && !m_host_input_authority)
server->AdjustPadBufferSize(value);
else
client->AdjustPadBufferSize(value);
});
auto client = Settings::Instance().GetNetPlayClient();
auto server = Settings::Instance().GetNetPlayServer();
if (server && !m_host_input_authority)
server->AdjustPadBufferSize(value);
else
client->AdjustPadBufferSize(value);
});
const auto hia_function = [this](bool enable) {
if (m_host_input_authority != enable)
@ -345,7 +344,7 @@ void NetPlayDialog::ConnectWidgets()
// SaveSettings() - Save Hosting-Dialog Settings
connect(m_buffer_size_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_buffer_size_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlayDialog::SaveSettings);
connect(m_save_sd_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings);
connect(m_load_wii_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings);

View File

@ -199,22 +199,21 @@ void NetPlaySetupDialog::CreateMainLayout()
void NetPlaySetupDialog::ConnectWidgets()
{
connect(m_connection_type, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &NetPlaySetupDialog::OnConnectionTypeChanged);
connect(m_connection_type, qOverload<int>(&QComboBox::currentIndexChanged), this,
&NetPlaySetupDialog::OnConnectionTypeChanged);
connect(m_nickname_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings);
// Connect widget
connect(m_ip_edit, &QLineEdit::textChanged, this, &NetPlaySetupDialog::SaveSettings);
connect(m_connect_port_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_connect_port_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings);
// Host widget
connect(m_host_port_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_host_port_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings);
connect(m_host_games, static_cast<void (QListWidget::*)(int)>(&QListWidget::currentRowChanged),
[this](int index) {
Settings::GetQSettings().setValue(QStringLiteral("netplay/hostgame"),
m_host_games->item(index)->text());
});
connect(m_host_games, qOverload<int>(&QListWidget::currentRowChanged), [this](int index) {
Settings::GetQSettings().setValue(QStringLiteral("netplay/hostgame"),
m_host_games->item(index)->text());
});
connect(m_host_games, &QListWidget::itemDoubleClicked, this, &NetPlaySetupDialog::accept);
@ -224,8 +223,7 @@ void NetPlaySetupDialog::ConnectWidgets()
m_host_chunked_upload_limit_box->setEnabled(value);
SaveSettings();
});
connect(m_host_chunked_upload_limit_box,
static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
connect(m_host_chunked_upload_limit_box, qOverload<int>(&QSpinBox::valueChanged), this,
&NetPlaySetupDialog::SaveSettings);
connect(m_host_server_browser, &QCheckBox::toggled, this, &NetPlaySetupDialog::SaveSettings);

View File

@ -48,11 +48,11 @@ void PadMappingDialog::CreateWidgets()
void PadMappingDialog::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::accepted, this, &QDialog::accept);
for (auto& combo_group : {m_gc_boxes, m_wii_boxes})
for (const auto& combo_group : {m_gc_boxes, m_wii_boxes})
{
for (auto& combo : combo_group)
for (const auto& combo : combo_group)
{
connect(combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
connect(combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
&PadMappingDialog::OnMappingChanged);
}
}

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);

View File

@ -54,10 +54,8 @@ QGroupBox* TASInputWindow::CreateStickInputs(QString name, QSpinBox*& x_value, Q
y_value->setMaximumWidth(60);
auto* visual = new StickWidget(this, max_x, max_y);
connect(x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
&StickWidget::SetX);
connect(y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
&StickWidget::SetY);
connect(x_value, qOverload<int>(&QSpinBox::valueChanged), visual, &StickWidget::SetX);
connect(y_value, qOverload<int>(&QSpinBox::valueChanged), visual, &StickWidget::SetY);
connect(visual, &StickWidget::ChangedX, x_value, &QSpinBox::setValue);
connect(visual, &StickWidget::ChangedY, y_value, &QSpinBox::setValue);
@ -105,19 +103,17 @@ QSpinBox* TASInputWindow::CreateSliderValuePair(QBoxLayout* layout, u16 max,
{
auto* value = new QSpinBox();
value->setRange(0, 99999);
connect(value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
[value, max](int i) {
if (i > max)
value->setValue(max);
});
connect(value, qOverload<int>(&QSpinBox::valueChanged), [value, max](int i) {
if (i > max)
value->setValue(max);
});
auto* slider = new QSlider(orientation);
slider->setRange(0, max);
slider->setFocusPolicy(Qt::ClickFocus);
slider->setInvertedAppearance(invert);
connect(slider, &QSlider::valueChanged, value, &QSpinBox::setValue);
connect(value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), slider,
&QSlider::setValue);
connect(value, qOverload<int>(&QSpinBox::valueChanged), slider, &QSlider::setValue);
auto* shortcut = new QShortcut(shortcut_key_sequence, shortcut_widget);
connect(shortcut, &QShortcut::activated, [value] {

View File

@ -58,10 +58,8 @@ WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(
m_ir_y_value->setMaximumWidth(60);
auto* visual = new IRWidget(this);
connect(m_ir_x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
&IRWidget::SetX);
connect(m_ir_y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
&IRWidget::SetY);
connect(m_ir_x_value, qOverload<int>(&QSpinBox::valueChanged), visual, &IRWidget::SetX);
connect(m_ir_y_value, qOverload<int>(&QSpinBox::valueChanged), visual, &IRWidget::SetY);
connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue);
connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue);