JoystickAxis.h 1.67 KB
Newer Older
1 2 3 4
#ifndef JOYSTICKAXIS_H
#define JOYSTICKAXIS_H

#include <QWidget>
5
#include "JoystickInput.h"
6 7 8 9 10 11 12 13 14 15 16 17

namespace Ui {
class JoystickAxis;
}

class JoystickAxis : public QWidget
{
    Q_OBJECT
    
public:
    explicit JoystickAxis(int id, QWidget *parent = 0);
    ~JoystickAxis();
18 19 20
    void setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING newMapping);
    void setInverted(bool newValue);
    void setRangeLimit(bool newValue);
21

22 23
signals:
    /** @brief Signal a change in this axis' yaw/pitch/roll mapping */
24
    void mappingChanged(int id, JoystickInput::JOYSTICK_INPUT_MAPPING newMapping);
25
    /** @brief Signal a change in this axis' inversion status */
26 27 28
    void inversionChanged(int id, bool inversion);
    /** @brief Signal a change in this axis' range setting. If limited is true then only the positive values should be read from this axis. */
    void rangeChanged(int id, bool limited);
29

30
public slots:
31 32 33 34
    /** @brief Update the displayed value of the included progressbar.
     * @param value A value between -1.0 and 1.0.
     */
    void setValue(float value);
35 36
    /** @brief Specify the UAS that this axis should track for displaying throttle properly. */
    void setActiveUAS(UASInterface* uas);
37 38
    
private:
39
    int id; ///< The ID for this axis. Corresponds to the IDs used by JoystickInput.
40
    Ui::JoystickAxis *ui;
41 42 43 44

private slots:
    /** @brief Handle changes to the mapping dropdown bar. */
    void mappingComboBoxChanged(int newMapping);
45
    /** @brief Emit signal when the inversion checkbox is changed. */
46
    void inversionCheckBoxChanged(bool inverted);
47 48
    /** @brief Emit signal when the range checkbox is changed. */
    void rangeCheckBoxChanged(bool inverted);
49 50 51
};

#endif // JOYSTICKAXIS_H