mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
Qt Mapping*: make logic around setting/loading settings more consistent
Changes: - signal for widget value changed: sets controller setting, saves settings - Update(): only updates widget from existing controller setting - Clear(): sets controller setting, saves settings, and calls Update()
This commit is contained in:
@ -11,7 +11,7 @@ MappingNumeric::MappingNumeric(MappingWidget* widget, ControllerEmu::NumericSett
|
||||
: m_parent(widget), m_setting(setting), m_range(setting->m_high - setting->m_low)
|
||||
{
|
||||
setRange(setting->m_low, setting->m_high);
|
||||
setValue(setting->m_low + setting->GetValue() * m_range);
|
||||
Update();
|
||||
Connect();
|
||||
}
|
||||
|
||||
@ -20,18 +20,18 @@ void MappingNumeric::Connect()
|
||||
connect(this, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this](int value) {
|
||||
m_setting->SetValue(static_cast<double>(value - m_setting->m_low) / m_range);
|
||||
Update();
|
||||
m_parent->SaveSettings();
|
||||
});
|
||||
}
|
||||
|
||||
void MappingNumeric::Clear()
|
||||
{
|
||||
setValue(m_setting->m_low + (m_setting->m_low + m_setting->m_high) / 2);
|
||||
m_setting->SetValue(m_setting->m_low + (m_setting->m_low + m_setting->m_high) / 2);
|
||||
m_parent->SaveSettings();
|
||||
Update();
|
||||
}
|
||||
|
||||
void MappingNumeric::Update()
|
||||
{
|
||||
setValue(m_setting->m_low + m_setting->GetValue() * m_range);
|
||||
m_parent->SaveSettings();
|
||||
}
|
||||
|
Reference in New Issue
Block a user