diff --git a/src/input/JoystickInput.h b/src/input/JoystickInput.h index 6e923ad2d6f6bf81c8e8d2db6aa9f35aef870427..2256d44d34425e9480358daf0c2c23142f901a4c 100644 --- a/src/input/JoystickInput.h +++ b/src/input/JoystickInput.h @@ -57,6 +57,19 @@ public: void run(); void shutdown(); + /** + * @brief The JOYSTICK_INPUT_MAPPING enum storing the values for each item in the mapping combobox. + * This should match the order of items in the mapping combobox in JoystickAxis.ui. + */ + enum JOYSTICK_INPUT_MAPPING + { + JOYSTICK_INPUT_MAPPING_NONE = 0, + JOYSTICK_INPUT_MAPPING_YAW = 1, + JOYSTICK_INPUT_MAPPING_PITCH = 2, + JOYSTICK_INPUT_MAPPING_ROLL = 3, + JOYSTICK_INPUT_MAPPING_THROTTLE = 4 + }; + /** * @brief Load joystick settings */ @@ -130,7 +143,7 @@ protected: bool done; // Store the mapping between axis numbers and the roll/pitch/yaw/throttle configuration. - // Value is one of JoystickAxis::JOYSTICK_AXIS_MAPPING. + // Value is one of JoystickAxis::JOYSTICK_INPUT_MAPPING. int rollAxis; int pitchAxis; int yawAxis; @@ -205,24 +218,24 @@ public slots: /** @brief Switch to a new joystick by ID number. */ void setActiveJoystick(int id); - void setMappingRollAxis(int mapping) + void setMappingRollAxis(int axis) { - rollAxis = mapping; + rollAxis = axis; } - void setMappingPitchAxis(int mapping) + void setMappingPitchAxis(int axis) { - pitchAxis = mapping; + pitchAxis = axis; } - void setMappingYawAxis(int mapping) + void setMappingYawAxis(int axis) { - yawAxis = mapping; + yawAxis = axis; } - void setMappingThrottleAxis(int mapping) + void setMappingThrottleAxis(int axis) { - throttleAxis = mapping; + throttleAxis = axis; } }; diff --git a/src/ui/JoystickAxis.h b/src/ui/JoystickAxis.h index ee948d2565ddfb9ee57706347e5bd3eee0b57f20..22482d9c6780de77f4b03139f0d060a374704d60 100644 --- a/src/ui/JoystickAxis.h +++ b/src/ui/JoystickAxis.h @@ -15,19 +15,6 @@ public: explicit JoystickAxis(int id, QWidget *parent = 0); ~JoystickAxis(); - /** - * @brief The JOYSTICK_MAPPING enum storing the values for each item in the mapping combobox. - * This should match the order of items in the mapping combobox in JoystickAxis.ui. - */ - enum JOYSTICK_AXIS_MAPPING - { - JOYSTICK_AXIS_MAPPING_NONE = 0, - JOYSTICK_AXIS_MAPPING_YAW = 1, - JOYSTICK_AXIS_MAPPING_PITCH = 2, - JOYSTICK_AXIS_MAPPING_ROLL = 3, - JOYSTICK_AXIS_MAPPING_THROTTLE = 4 - }; - signals: /** @brief Signal a change in this axis' yaw/pitch/roll mapping */ void mappingChanged(int id, int newMapping); diff --git a/src/ui/JoystickWidget.cc b/src/ui/JoystickWidget.cc index 9e4493be97f3d198babe0dd4ec1a4cedb82b9904..6edea3def3a7dfbc151c633d954909488dd11504 100644 --- a/src/ui/JoystickWidget.cc +++ b/src/ui/JoystickWidget.cc @@ -151,20 +151,20 @@ void JoystickWidget::setHat(float x, float y) updateStatus(tr("Hat position: x: %1, y: %2").arg(x).arg(y)); } -void JoystickWidget::setMappingAxis(int axisID, int newMapping) +void JoystickWidget::setMappingAxis(int axisID, JoystickInput::JOYSTICK_INPUT_MAPPING newMapping) { switch (newMapping) { - case JoystickAxis::JOYSTICK_AXIS_MAPPING_ROLL: + case JoystickInput::JOYSTICK_INPUT_MAPPING_ROLL: joystick->setMappingRollAxis(axisID); break; - case JoystickAxis::JOYSTICK_AXIS_MAPPING_PITCH: + case JoystickInput::JOYSTICK_INPUT_MAPPING_PITCH: joystick->setMappingPitchAxis(axisID); break; - case JoystickAxis::JOYSTICK_AXIS_MAPPING_YAW: + case JoystickInput::JOYSTICK_INPUT_MAPPING_YAW: joystick->setMappingYawAxis(axisID); break; - case JoystickAxis::JOYSTICK_AXIS_MAPPING_THROTTLE: + case JoystickInput::JOYSTICK_INPUT_MAPPING_THROTTLE: joystick->setMappingThrottleAxis(axisID); break; } diff --git a/src/ui/JoystickWidget.h b/src/ui/JoystickWidget.h index 5b8dd532e1dd75ba86db2fbf9a5c99448501ae0a..87b8d448ae966cf1e50e0781d6b4bd8dbfd4b956 100644 --- a/src/ui/JoystickWidget.h +++ b/src/ui/JoystickWidget.h @@ -81,7 +81,7 @@ protected slots: /** @brief Update the UI for a new joystick based on SDL ID. */ void updateUIForJoystick(int id); /** @brief Change the stored mapping for a given axis. */ - void setMappingAxis(int axisID, int newMapping); + void setMappingAxis(int axisID, JoystickInput::JOYSTICK_INPUT_MAPPING newMapping); private: Ui::JoystickWidget *m_ui;