refactor joystick; code refactor in mainwindow.cpp; adding a test