mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
DolphinQt: Rework TAS input threading, part 2 (analog inputs)
This commit is contained in:
33
Source/Core/DolphinQt/TAS/TASSpinBox.cpp
Normal file
33
Source/Core/DolphinQt/TAS/TASSpinBox.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// 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(static_cast<u16>(new_value)))
|
||||
QueueOnObject(this, &TASSpinBox::ApplyControllerValueChange);
|
||||
}
|
||||
|
||||
void TASSpinBox::OnUIValueChanged(int new_value)
|
||||
{
|
||||
m_state.OnUIValueChanged(static_cast<u16>(new_value));
|
||||
}
|
||||
|
||||
void TASSpinBox::ApplyControllerValueChange()
|
||||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
setValue(m_state.ApplyControllerValueChange());
|
||||
}
|
Reference in New Issue
Block a user