diff options
Diffstat (limited to 'src/yuzu/configuration/configure_motion_touch.h')
| -rw-r--r-- | src/yuzu/configuration/configure_motion_touch.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/yuzu/configuration/configure_motion_touch.h b/src/yuzu/configuration/configure_motion_touch.h new file mode 100644 index 000000000..3d4b5d659 --- /dev/null +++ b/src/yuzu/configuration/configure_motion_touch.h | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | // Copyright 2018 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include <QDialog> | ||
| 9 | #include "common/param_package.h" | ||
| 10 | |||
| 11 | class QLabel; | ||
| 12 | class QPushButton; | ||
| 13 | class QVBoxLayout; | ||
| 14 | |||
| 15 | namespace InputCommon { | ||
| 16 | class InputSubsystem; | ||
| 17 | } | ||
| 18 | |||
| 19 | namespace InputCommon::CemuhookUDP { | ||
| 20 | class CalibrationConfigurationJob; | ||
| 21 | } | ||
| 22 | |||
| 23 | namespace Ui { | ||
| 24 | class ConfigureMotionTouch; | ||
| 25 | } | ||
| 26 | |||
| 27 | /// A dialog for touchpad calibration configuration. | ||
| 28 | class CalibrationConfigurationDialog : public QDialog { | ||
| 29 | Q_OBJECT | ||
| 30 | public: | ||
| 31 | explicit CalibrationConfigurationDialog(QWidget* parent, const std::string& host, u16 port, | ||
| 32 | u8 pad_index, u16 client_id); | ||
| 33 | ~CalibrationConfigurationDialog() override; | ||
| 34 | |||
| 35 | private: | ||
| 36 | Q_INVOKABLE void UpdateLabelText(const QString& text); | ||
| 37 | Q_INVOKABLE void UpdateButtonText(const QString& text); | ||
| 38 | |||
| 39 | QVBoxLayout* layout; | ||
| 40 | QLabel* status_label; | ||
| 41 | QPushButton* cancel_button; | ||
| 42 | std::unique_ptr<InputCommon::CemuhookUDP::CalibrationConfigurationJob> job; | ||
| 43 | |||
| 44 | // Configuration results | ||
| 45 | bool completed{}; | ||
| 46 | u16 min_x{}; | ||
| 47 | u16 min_y{}; | ||
| 48 | u16 max_x{}; | ||
| 49 | u16 max_y{}; | ||
| 50 | |||
| 51 | friend class ConfigureMotionTouch; | ||
| 52 | }; | ||
| 53 | |||
| 54 | class ConfigureMotionTouch : public QDialog { | ||
| 55 | Q_OBJECT | ||
| 56 | |||
| 57 | public: | ||
| 58 | explicit ConfigureMotionTouch(QWidget* parent, InputCommon::InputSubsystem* input_subsystem_); | ||
| 59 | ~ConfigureMotionTouch() override; | ||
| 60 | |||
| 61 | public slots: | ||
| 62 | void ApplyConfiguration(); | ||
| 63 | |||
| 64 | private slots: | ||
| 65 | void OnCemuhookUDPTest(); | ||
| 66 | void OnConfigureTouchCalibration(); | ||
| 67 | void OnConfigureTouchFromButton(); | ||
| 68 | |||
| 69 | private: | ||
| 70 | void closeEvent(QCloseEvent* event) override; | ||
| 71 | Q_INVOKABLE void ShowUDPTestResult(bool result); | ||
| 72 | void SetConfiguration(); | ||
| 73 | void UpdateUiDisplay(); | ||
| 74 | void ConnectEvents(); | ||
| 75 | bool CanCloseDialog(); | ||
| 76 | |||
| 77 | InputCommon::InputSubsystem* input_subsystem; | ||
| 78 | |||
| 79 | std::unique_ptr<Ui::ConfigureMotionTouch> ui; | ||
| 80 | |||
| 81 | // Coordinate system of the CemuhookUDP touch provider | ||
| 82 | int min_x{}; | ||
| 83 | int min_y{}; | ||
| 84 | int max_x{}; | ||
| 85 | int max_y{}; | ||
| 86 | |||
| 87 | bool udp_test_in_progress{}; | ||
| 88 | |||
| 89 | std::vector<Settings::TouchFromButtonMap> touch_from_button_maps; | ||
| 90 | }; | ||