summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/TAS/TASSpinBox.h
blob: 25e661c7ab1366ca23ae8974ead40e9b14607dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <QSpinBox>

#include "DolphinQt/TAS/TASControlState.h"

class TASInputWindow;

class TASSpinBox : public QSpinBox
{
  Q_OBJECT
public:
  explicit TASSpinBox(QWidget* parent = nullptr);

  // Can be called from the CPU thread
  int GetValue() const;
  // Must be called from the CPU thread
  void OnControllerValueChanged(int new_value);
  QValidator::State validate(QString& input, int& pos) const override;
  void fixup(QString& input) const override;

private slots:
  void OnUIValueChanged(int new_value);
  void ApplyControllerValueChange();

private:
  TASControlState m_state;
};