Debian Codegraph @

Source/Core/DolphinQt/Config/Mapping/IOWindow.h

raw symbols SCIP
1 // Copyright 2017 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <memory>
7 #include <mutex>
8 #include <string>
9
10 #include <QComboBox>
11 #include <QDialog>
12 #include <QString>
13
14 #include "InputCommon/ControllerInterface/CoreDevice.h"
15
16 class ControlReference;
17 class MappingWindow;
18 class QAbstractButton;
19 class QDialogButtonBox;
20 class QLineEdit;
21 class QTableWidget;
22 class QVBoxLayout;
23 class QWidget;
24 class QPlainTextEdit;
25 class QPushButton;
26 class QSlider;
27 class QSpinBox;
28 class QTextDocument;
29
30 namespace ControllerEmu
31 {
32 class EmulatedController;
33 }
34
35 class InputStateLineEdit;
36
37 class ControlExpressionSyntaxHighlighter final : public QObject
38 {
39 Q_OBJECT
40 public:
41 explicit ControlExpressionSyntaxHighlighter(QTextDocument* parent);
42
43 private:
44 void Highlight(QTextDocument* text_edit);
45 };
46
47 class QComboBoxWithMouseWheelDisabled : public QComboBox
48 {
49 Q_OBJECT
50 public:
51 explicit QComboBoxWithMouseWheelDisabled(QWidget* parent = nullptr) : QComboBox(parent) {}
52
53 protected:
54 // Consumes event while doing nothing
55 void wheelEvent(QWheelEvent* event) override;
56 };
57
58 class IOWindow final : public QDialog
59 {
60 Q_OBJECT
61 public:
62 enum class Type
63 {
64 Input,
65 Output
66 };
67
68 explicit IOWindow(MappingWindow* window, ControllerEmu::EmulatedController* m_controller,
69 ControlReference* ref, Type type);
70
71 signals:
72 void DetectInputComplete();
73 void TestOutputComplete();
74
75 private:
76 std::shared_ptr<ciface::Core::Device> GetSelectedDevice() const;
77
78 void CreateMainLayout();
79 void ConnectWidgets();
80 void ConfigChanged();
81 void Update();
82
83 void OnDialogButtonPressed(QAbstractButton* button);
84 void OnDeviceChanged();
85 void OnRangeChanged(int range);
86
87 void AppendSelectedOption();
88 void UpdateOptionList();
89 void UpdateDeviceList();
90 void ReleaseDevices();
91
92 enum class UpdateMode
93 {
94 Normal,
95 Force,
96 };
97
98 void UpdateExpression(std::string new_expression, UpdateMode mode = UpdateMode::Normal);
99
100 // Main Layout
101 QVBoxLayout* m_main_layout;
102
103 // Devices
104 QComboBox* m_devices_combo;
105
106 // Options
107 QTableWidget* m_option_list;
108
109 // Scalar
110 QSpinBox* m_scalar_spinbox;
111
112 // Shared actions
113 QPushButton* m_select_button;
114 QComboBox* m_operators_combo;
115 QComboBox* m_variables_combo;
116
117 // Input actions
118 QPushButton* m_detect_button;
119 std::unique_ptr<ciface::Core::InputDetector> m_input_detector;
120 QComboBox* m_functions_combo;
121
122 // Output actions
123 QPushButton* m_test_button;
124 QTimer* m_output_test_timer;
125
126 // Textarea
127 QPlainTextEdit* m_expression_text;
128 InputStateLineEdit* m_parse_text;
129
130 // Buttonbox
131 QDialogButtonBox* m_button_box;
132 QPushButton* m_clear_button;
133
134 ControlReference* m_reference;
135 std::string m_original_expression;
136 ControllerEmu::EmulatedController* m_controller;
137
138 ciface::Core::DeviceQualifier m_devq;
139 Type m_type;
140 std::shared_ptr<ciface::Core::Device> m_selected_device;
141 std::mutex m_selected_device_mutex;
142 };