2018-07-02 15:16:43 +02:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2018-07-07 00:40:15 +02:00
|
|
|
#include "DolphinQt/Config/Mapping/MappingRadio.h"
|
2018-07-02 15:16:43 +02:00
|
|
|
|
2018-07-07 00:40:15 +02:00
|
|
|
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
2018-07-02 15:16:43 +02:00
|
|
|
|
|
|
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
|
|
|
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
|
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
|
|
|
|
2019-03-14 20:27:49 -05:00
|
|
|
MappingRadio::MappingRadio(MappingWidget* parent, ControllerEmu::BooleanSetting* setting)
|
|
|
|
: QRadioButton(tr(setting->m_ui_name.c_str())), m_setting(*setting)
|
2018-07-02 15:16:43 +02:00
|
|
|
{
|
2019-03-14 20:27:49 -05:00
|
|
|
connect(this, &QRadioButton::toggled, this, [this, parent](int value) {
|
|
|
|
m_setting.SetValue(value);
|
|
|
|
parent->SaveSettings();
|
2018-07-02 15:16:43 +02:00
|
|
|
});
|
2019-03-14 20:27:49 -05:00
|
|
|
|
|
|
|
connect(parent, &MappingWidget::ConfigChanged, this, &MappingRadio::ConfigChanged);
|
2018-07-02 15:16:43 +02:00
|
|
|
}
|
|
|
|
|
2019-03-14 20:27:49 -05:00
|
|
|
void MappingRadio::ConfigChanged()
|
2018-07-02 15:16:43 +02:00
|
|
|
{
|
2019-03-14 20:27:49 -05:00
|
|
|
const bool old_state = blockSignals(true);
|
|
|
|
setChecked(m_setting.GetValue());
|
|
|
|
blockSignals(old_state);
|
2018-07-02 15:16:43 +02:00
|
|
|
}
|