/***
 * Warthog Robotics
 * University of Sao Paulo (USP) at Sao Carlos
 * http://www.warthog.sc.usp.br/
 *
 * This file is part of WRJoy project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ***/

// Prevents multiple definitions
#ifndef WRJOY_BASICSETTINGS
#define WRJOY_BASICSETTINGS


// 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::BasicSettings : public QMainWindow {
    private:
        Joystick* _joystick;

        QWidget*   _centralWidget;
        QComboBox* _joysticksComboBox;
		QSpinBox* _teamsSpinBox;
		QSpinBox* _playersSpinBox;
        QDoubleSpinBox* _speedSpinBox;
        QCheckBox* _kickEnable;

        QToolBar* _toolBar;
        QAction*  _openJoystickAction;
        QAction*  _closeJoystickAction;
        QAction*  _updateJoystickListAction;

    public:
        BasicSettings(Joystick* joystick);


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

        void configureSDLActions(QToolBar* toolBar);

    private slots:
        void openJoystick();
        void closeJoystick();
        void updateJoysticksList();

        void joystickOpened();
        void joystickOpenFail(QString sdlError);
        void joystickClosed();

    private:
        QStringList availableJoysticks();
};


#endif
