2017-05-20 15:53:17 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "DolphinQt2/Config/Mapping/MappingBool.h"
|
|
|
|
|
|
|
|
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
|
|
|
|
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
|
|
|
|
|
|
MappingBool::MappingBool(MappingWidget* widget, ControllerEmu::BooleanSetting* setting)
|
|
|
|
: QCheckBox(QString::fromStdString(setting->m_ui_name)), m_parent(widget), m_setting(setting)
|
|
|
|
{
|
2017-11-03 20:28:45 +00:00
|
|
|
Update();
|
2017-05-20 15:53:17 +00:00
|
|
|
Connect();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingBool::Connect()
|
|
|
|
{
|
|
|
|
connect(this, &QCheckBox::stateChanged, this, [this](int value) {
|
|
|
|
m_setting->SetValue(value);
|
2017-11-03 20:28:45 +00:00
|
|
|
m_parent->SaveSettings();
|
2017-05-20 15:53:17 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingBool::Clear()
|
|
|
|
{
|
2017-11-03 20:28:45 +00:00
|
|
|
m_setting->SetValue(false);
|
|
|
|
m_parent->SaveSettings();
|
2017-05-20 15:53:17 +00:00
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingBool::Update()
|
|
|
|
{
|
|
|
|
setChecked(m_setting->GetValue());
|
|
|
|
}
|