2023-03-07 11:22:09 -07:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#include "DolphinQt/TAS/TASSpinBox.h"
|
|
|
|
|
|
|
|
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
|
|
|
|
|
|
|
TASSpinBox::TASSpinBox(QWidget* parent) : QSpinBox(parent)
|
|
|
|
{
|
2023-11-04 15:01:39 -06:00
|
|
|
connect(this, &TASSpinBox::valueChanged, this, &TASSpinBox::OnUIValueChanged);
|
2023-03-07 11:22:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int TASSpinBox::GetValue() const
|
|
|
|
{
|
|
|
|
return m_state.GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TASSpinBox::OnControllerValueChanged(int new_value)
|
|
|
|
{
|
2022-10-04 13:24:33 -06:00
|
|
|
if (m_state.OnControllerValueChanged(new_value))
|
2023-03-07 11:22:09 -07:00
|
|
|
QueueOnObject(this, &TASSpinBox::ApplyControllerValueChange);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TASSpinBox::OnUIValueChanged(int new_value)
|
|
|
|
{
|
2022-10-04 13:24:33 -06:00
|
|
|
m_state.OnUIValueChanged(new_value);
|
2023-03-07 11:22:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void TASSpinBox::ApplyControllerValueChange()
|
|
|
|
{
|
|
|
|
setValue(m_state.ApplyControllerValueChange());
|
|
|
|
}
|