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