Commit 902f359f authored by Bryant's avatar Bryant

Moved the JOYSTICK_*_MAPPING enum into JoystickInput where it belongs. Also...

Moved the JOYSTICK_*_MAPPING enum into JoystickInput where it belongs. Also renamed some local variables.
parent 1e5e97ad
......@@ -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;
}
};
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment