| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QDialog> |
| 7 |
#include <QString> |
| 8 |
|
| 9 |
namespace ControllerEmu |
| 10 |
{ |
| 11 |
class EmulatedController; |
| 12 |
} |
| 13 |
|
| 14 |
class InputConfig; |
| 15 |
class MappingButton; |
| 16 |
|
| 17 |
class QComboBox; |
| 18 |
class QDialogButtonBox; |
| 19 |
class QEvent; |
| 20 |
class QHBoxLayout; |
| 21 |
class QGroupBox; |
| 22 |
class QVBoxLayout; |
| 23 |
class QPushButton; |
| 24 |
class QTabWidget; |
| 25 |
class QToolButton; |
| 26 |
class QWidget; |
| 27 |
|
| 28 |
class MappingWindow final : public QDialog |
| 29 |
{ |
| 30 |
Q_OBJECT |
| 31 |
public: |
| 32 |
enum class Type |
| 33 |
{ |
| 34 |
|
| 35 |
MAPPING_GC_BONGOS, |
| 36 |
MAPPING_GC_DANCEMAT, |
| 37 |
MAPPING_GC_GBA, |
| 38 |
MAPPING_GC_KEYBOARD, |
| 39 |
MAPPING_GCPAD, |
| 40 |
MAPPING_GC_STEERINGWHEEL, |
| 41 |
MAPPING_GC_MICROPHONE, |
| 42 |
|
| 43 |
MAPPING_WIIMOTE_EMU, |
| 44 |
|
| 45 |
MAPPING_HOTKEYS, |
| 46 |
|
| 47 |
MAPPING_FREELOOK, |
| 48 |
|
| 49 |
MAPPING_AM_BASEBOARD, |
| 50 |
}; |
| 51 |
|
| 52 |
explicit MappingWindow(QWidget* parent, Type type, int port_num); |
| 53 |
|
| 54 |
int GetPort() const; |
| 55 |
ControllerEmu::EmulatedController* GetController() const; |
| 56 |
bool IsCreateOtherDeviceMappingsEnabled() const; |
| 57 |
bool IsWaitForAlternateMappingsEnabled() const; |
| 58 |
bool IsIterativeMappingEnabled() const; |
| 59 |
void ShowExtensionMotionTabs(bool show); |
| 60 |
void ActivateExtensionTab(); |
| 61 |
|
| 62 |
signals: |
| 63 |
|
| 64 |
void ConfigChanged(); |
| 65 |
|
| 66 |
void Update(); |
| 67 |
void Save(); |
| 68 |
|
| 69 |
void UnQueueInputDetection(MappingButton*); |
| 70 |
void QueueInputDetection(MappingButton*); |
| 71 |
void CancelMapping(); |
| 72 |
|
| 73 |
private: |
| 74 |
void SetMappingType(Type type); |
| 75 |
void CreateDevicesLayout(); |
| 76 |
void CreateProfilesLayout(); |
| 77 |
void CreateResetLayout(); |
| 78 |
void CreateMainLayout(); |
| 79 |
void ConnectWidgets(); |
| 80 |
|
| 81 |
QWidget* AddWidget(const QString& name, QWidget* widget); |
| 82 |
|
| 83 |
void RefreshDevices(); |
| 84 |
|
| 85 |
void OnSelectProfile(int index); |
| 86 |
void OnProfileTextChanged(const QString& text); |
| 87 |
void OnDeleteProfilePressed(); |
| 88 |
void OnLoadProfilePressed(); |
| 89 |
void OnSaveProfilePressed(); |
| 90 |
void OnOpenProfileFolder(); |
| 91 |
void UpdateProfileIndex(); |
| 92 |
void UpdateProfileButtonState(); |
| 93 |
void PopulateProfileSelection(); |
| 94 |
void UpdateDeviceList(); |
| 95 |
|
| 96 |
void OnDefaultFieldsPressed(); |
| 97 |
void OnClearFieldsPressed(); |
| 98 |
void OnSelectDevice(int index); |
| 99 |
|
| 100 |
ControllerEmu::EmulatedController* m_controller = nullptr; |
| 101 |
|
| 102 |
|
| 103 |
QVBoxLayout* m_main_layout; |
| 104 |
QHBoxLayout* m_config_layout; |
| 105 |
QDialogButtonBox* m_button_box; |
| 106 |
|
| 107 |
|
| 108 |
QGroupBox* m_devices_box; |
| 109 |
QHBoxLayout* m_devices_layout; |
| 110 |
QComboBox* m_devices_combo; |
| 111 |
QAction* m_other_device_mappings; |
| 112 |
QAction* m_wait_for_alternate_mappings; |
| 113 |
QAction* m_iterative_mapping; |
| 114 |
|
| 115 |
|
| 116 |
QGroupBox* m_profiles_box; |
| 117 |
QHBoxLayout* m_profiles_layout; |
| 118 |
QComboBox* m_profiles_combo; |
| 119 |
QPushButton* m_profiles_load; |
| 120 |
QPushButton* m_profiles_save; |
| 121 |
QToolButton* m_profile_other_actions; |
| 122 |
QAction* m_profiles_delete; |
| 123 |
QAction* m_profiles_open_folder; |
| 124 |
|
| 125 |
|
| 126 |
QGroupBox* m_reset_box; |
| 127 |
QHBoxLayout* m_reset_layout; |
| 128 |
QPushButton* m_reset_default; |
| 129 |
QPushButton* m_reset_clear; |
| 130 |
|
| 131 |
QTabWidget* m_tab_widget; |
| 132 |
QWidget* m_extension_motion_input_tab; |
| 133 |
QWidget* m_extension_motion_simulation_tab; |
| 134 |
const QString EXTENSION_MOTION_INPUT_TAB_NAME = tr("Extension Motion Input"); |
| 135 |
const QString EXTENSION_MOTION_SIMULATION_TAB_NAME = tr("Extension Motion Simulation"); |
| 136 |
|
| 137 |
Type m_mapping_type; |
| 138 |
const int m_port; |
| 139 |
InputConfig* m_config; |
| 140 |
}; |