Refactored some variables and added some documentation. Also, now the joystickChanged signal emits NaN for axes that aren't mapped, so consumers should handle this properly.
Moved the JOYSTICK_*_MAPPING enum into JoystickInput where it belongs. Also renamed some local variables.
The hat readings from the joystick now works correctly. Also moved some signals over to using an enum from an int type.
The button/axis/hat readings are now compared to the previous readings and signals are only emitted if they changed. The joystickChanged signal is still emitted every sample period.