mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
38 lines
965 B
C++
38 lines
965 B
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#include "DolphinQt2/Config/Mapping/MappingNumeric.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/MappingWidget.h"
|
|
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
|
|
|
MappingNumeric::MappingNumeric(MappingWidget* widget, ControllerEmu::NumericSetting* setting)
|
|
: m_parent(widget), m_setting(setting)
|
|
{
|
|
setRange(setting->m_low, setting->m_high);
|
|
Update();
|
|
Connect();
|
|
}
|
|
|
|
void MappingNumeric::Connect()
|
|
{
|
|
connect(this, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
|
[this](int value) {
|
|
m_setting->SetValue(static_cast<double>(value) / 100);
|
|
m_parent->SaveSettings();
|
|
});
|
|
}
|
|
|
|
void MappingNumeric::Clear()
|
|
{
|
|
m_setting->SetValue(m_setting->m_default_value);
|
|
m_parent->SaveSettings();
|
|
Update();
|
|
}
|
|
|
|
void MappingNumeric::Update()
|
|
{
|
|
setValue(m_setting->GetValue() * 100);
|
|
}
|