dolphin/Source/Core/DolphinQt/TAS/TASSpinBox.cpp
JosJuice 4d34f86121 DolphinQt: Add MotionPlus support to TAS input
Will manually controlling both an accelerometer and a gyroscope at the
same time be reasonable to do? No idea. Was this easy to implement
thanks to the input override system? Yes.

Fixes https://bugs.dolphin-emu.org/issues/12443.
2023-03-10 19:36:17 +01:00

34 lines
816 B
C++

// 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)
{
connect(this, QOverload<int>::of(&TASSpinBox::valueChanged), this, &TASSpinBox::OnUIValueChanged);
}
int TASSpinBox::GetValue() const
{
return m_state.GetValue();
}
void TASSpinBox::OnControllerValueChanged(int new_value)
{
if (m_state.OnControllerValueChanged(new_value))
QueueOnObject(this, &TASSpinBox::ApplyControllerValueChange);
}
void TASSpinBox::OnUIValueChanged(int new_value)
{
m_state.OnUIValueChanged(new_value);
}
void TASSpinBox::ApplyControllerValueChange()
{
const QSignalBlocker blocker(this);
setValue(m_state.ApplyControllerValueChange());
}