/***
 * 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/>.
 ***/
#ifndef PLAYERSETTINGS_HH
#define PLAYERSETTINGS_HH

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


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

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

#define PLAYER_SETTINGS_MAX_PLAYER 11
#define PLAYER_SETTINGS_MAX_SPEED 10
#define PLAYER_SETTINGS_MAX_TEAM 1
#define PLAYER_SETTINGS_PLAYER_SPINBOX_STEP 0.1

// Selects WRJoy namespace
using namespace WRJoy;


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

    QWidget*   _centralWidget;
    QSpinBox* _teamsSpinBox;
    QSpinBox* _playersSpinBox;
    QDoubleSpinBox* _speedSpinBox;
    QCheckBox* _kickEnable;
    QCheckBox* _kickChipEnable;
    QCheckBox* _kickOnTouchEnable;

    QToolBar* _toolBar;

public:
    PlayerSettings(Joystick* joystick);


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

private slots:
    void changeTeam(int id);
    void changePlayer(int id);
    void changeSpeed(double speed);
    void changeKick();
    void changeChipKick();

    void playerChanged(quint8 player);
};

#endif // PLAYERSETTINGS_HH
