/*** WRJoy - JoystickGUI class
  ** Warthog Robotics
  ** University of Sao Paulo at Sao Carlos
  ** http://www.warthog.sc.usp.br
  ** This file is part of the Warthog Robotics project
  ***/


// Prevents multiple definitions
#ifndef WRJOY_JOYSTICKGUI
#define WRJOY_JOYSTICKGUI


// Includes WRJoy
#include <WRJoy/wrjoy.hh>


// Includes Qt library
#include <QtCore/QtCore>
#include <QtWidgets/QtWidgets>

// Includes SDL library
#include <SDL2/SDL.h>


// Selects WRJoy namespace
using namespace WRJoy;


class WRJoy::JoystickGUI : public QMainWindow {
    private:
        Joystick* _joystick;

        QTabWidget* _tabWidget;

        QToolBar* _toolBar;
        QAction*  _startJoystickAction;
        QAction*  _stopJoystickAction;
        QAction*  _resetAction;


    public:
        JoystickGUI(Joystick* joystick);


    private:
        void configureMainWindow();
        void configureToolBar();
        void configureTabWidget();
        void configureConnections();

        void configureRunTimeActions(QToolBar* toolBar);
        void configureAdvancedActions(QToolBar* toolBar);


    private slots:
        void startJoystick();
        void stopJoystick();
        void resetJoystick();

        void joystickStarted();
        void joystickStoped();
        void joystickReseted();
        void joystickOpened(int sdlIndex);
        void joystickClosed();
};


#endif
