mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
DolphinQ: Mapping UI cleanups.
This commit is contained in:
@ -10,23 +10,20 @@
|
||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
MappingBool::MappingBool(MappingWidget* widget, ControllerEmu::BooleanSetting* setting)
|
||||
: QCheckBox(tr(setting->m_ui_name.c_str())), m_parent(widget), m_setting(setting)
|
||||
MappingBool::MappingBool(MappingWidget* parent, ControllerEmu::BooleanSetting* setting)
|
||||
: QCheckBox(tr(setting->m_ui_name.c_str())), m_setting(*setting)
|
||||
{
|
||||
Update();
|
||||
Connect();
|
||||
}
|
||||
|
||||
void MappingBool::Connect()
|
||||
{
|
||||
connect(this, &QCheckBox::stateChanged, this, [this](int value) {
|
||||
m_setting->SetValue(value);
|
||||
m_parent->SaveSettings();
|
||||
m_parent->GetController()->UpdateReferences(g_controller_interface);
|
||||
connect(this, &QCheckBox::stateChanged, this, [this, parent](int value) {
|
||||
m_setting.SetValue(value);
|
||||
parent->SaveSettings();
|
||||
});
|
||||
|
||||
connect(parent, &MappingWidget::ConfigChanged, this, &MappingBool::ConfigChanged);
|
||||
}
|
||||
|
||||
void MappingBool::Update()
|
||||
void MappingBool::ConfigChanged()
|
||||
{
|
||||
setChecked(m_setting->GetValue());
|
||||
const bool old_state = blockSignals(true);
|
||||
setChecked(m_setting.GetValue());
|
||||
blockSignals(old_state);
|
||||
}
|
||||
|
Reference in New Issue
Block a user