JoystickAxis.h 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef JOYSTICKAXIS_H
#define JOYSTICKAXIS_H

#include <QWidget>

namespace Ui {
class JoystickAxis;
}

class JoystickAxis : public QWidget
{
    Q_OBJECT
    
public:
    explicit JoystickAxis(int id, QWidget *parent = 0);
    ~JoystickAxis();

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    /**
     * @brief The JOYSTICK_MAPPING enum storing the values for each item in the mapping combobox.
     * This should match the order of items in the mapping combobox in JoystickAxis.ui.
     */
    enum JOYSTICK_AXIS_MAPPING
    {
        JOYSTICK_AXIS_MAPPING_NONE     = 0,
        JOYSTICK_AXIS_MAPPING_YAW      = 1,
        JOYSTICK_AXIS_MAPPING_PITCH    = 2,
        JOYSTICK_AXIS_MAPPING_ROLL     = 3,
        JOYSTICK_AXIS_MAPPING_THROTTLE = 4
    };

signals:
    /** @brief Signal a change in this axis' yaw/pitch/roll mapping */
    void mappingChanged(int id, int newMapping);

35
public slots:
36 37 38 39
    /** @brief Update the displayed value of the included progressbar.
     * @param value A value between -1.0 and 1.0.
     */
    void setValue(float value);
40 41
    
private:
42
    int id; ///< The ID for this axis. Corresponds to the IDs used by JoystickInput.
43
    Ui::JoystickAxis *ui;
44 45 46 47

private slots:
    /** @brief Handle changes to the mapping dropdown bar. */
    void mappingComboBoxChanged(int newMapping);
48 49 50
};

#endif // JOYSTICKAXIS_H