Commit 2569fef5 authored by nanthony21's avatar nanthony21

Separate startJoystick from enableJoystick. Just because the joystick is not...

Separate startJoystick from enableJoystick. Just because the joystick is not enabled doesn't mean that we don't want to be able to monitor its behavior
parent 328ad9ee
...@@ -1787,6 +1787,7 @@ void Vehicle::_loadSettings(void) ...@@ -1787,6 +1787,7 @@ void Vehicle::_loadSettings(void)
// Joystick enabled is a global setting so first make sure there are any joysticks connected // Joystick enabled is a global setting so first make sure there are any joysticks connected
if (_toolbox->joystickManager()->joysticks().count()) { if (_toolbox->joystickManager()->joysticks().count()) {
setJoystickEnabled(settings.value(_joystickEnabledSettingsKey, false).toBool()); setJoystickEnabled(settings.value(_joystickEnabledSettingsKey, false).toBool());
_startJoystick(true);
} }
} }
...@@ -1839,7 +1840,6 @@ bool Vehicle::joystickEnabled(void) ...@@ -1839,7 +1840,6 @@ bool Vehicle::joystickEnabled(void)
void Vehicle::setJoystickEnabled(bool enabled) void Vehicle::setJoystickEnabled(bool enabled)
{ {
_joystickEnabled = enabled; _joystickEnabled = enabled;
_startJoystick(_joystickEnabled);
_saveSettings(); _saveSettings();
emit joystickEnabledChanged(_joystickEnabled); emit joystickEnabledChanged(_joystickEnabled);
} }
...@@ -1849,9 +1849,7 @@ void Vehicle::_startJoystick(bool start) ...@@ -1849,9 +1849,7 @@ void Vehicle::_startJoystick(bool start)
Joystick* joystick = _joystickManager->activeJoystick(); Joystick* joystick = _joystickManager->activeJoystick();
if (joystick) { if (joystick) {
if (start) { if (start) {
if (_joystickEnabled) { joystick->startPolling(this);
joystick->startPolling(this);
}
} else { } else {
joystick->stopPolling(); joystick->stopPolling();
} }
......
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