DolphinQ: Mapping UI cleanups.

This commit is contained in:
Jordan Woyak
2019-03-14 20:27:49 -05:00
parent 011ecd92e8
commit 9cb17b062c
16 changed files with 185 additions and 224 deletions

View File

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