TASSpinBox.cpp 758 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2019 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "DolphinQt/TAS/TASSpinBox.h"
  4. #include "DolphinQt/QtUtils/QueueOnObject.h"
  5. TASSpinBox::TASSpinBox(QWidget* parent) : QSpinBox(parent)
  6. {
  7. connect(this, &TASSpinBox::valueChanged, this, &TASSpinBox::OnUIValueChanged);
  8. }
  9. int TASSpinBox::GetValue() const
  10. {
  11. return m_state.GetValue();
  12. }
  13. void TASSpinBox::OnControllerValueChanged(int new_value)
  14. {
  15. if (m_state.OnControllerValueChanged(new_value))
  16. QueueOnObject(this, &TASSpinBox::ApplyControllerValueChange);
  17. }
  18. void TASSpinBox::OnUIValueChanged(int new_value)
  19. {
  20. m_state.OnUIValueChanged(new_value);
  21. }
  22. void TASSpinBox::ApplyControllerValueChange()
  23. {
  24. setValue(m_state.ApplyControllerValueChange());
  25. }