implement joystick item switching
This commit is contained in:
@ -13,15 +13,15 @@ class TrainJs: public QObject
|
||||
Q_OBJECT
|
||||
private:
|
||||
static constexpr char JOYSTICK_NAME[] = "UVOS UsbJoy";
|
||||
static constexpr int LONGPRESS_TIME = 500;
|
||||
|
||||
inline static std::vector<std::shared_ptr<TrainJs>> js_;
|
||||
|
||||
int id_ = -1;
|
||||
int axis_ = -1;
|
||||
|
||||
QTimer longpressTimer_;
|
||||
bool handleRelease = false;
|
||||
bool wantsNewItem = true;
|
||||
bool inhibitUntillZero = true;
|
||||
|
||||
std::weak_ptr<Item> item_;
|
||||
TrainJs(int id, int axis);
|
||||
@ -30,7 +30,6 @@ private:
|
||||
private slots:
|
||||
void axisChanged(const int id, const int axis, const qreal value);
|
||||
void buttonChanged(const int id, const int button, const bool pressed);
|
||||
void longpressTimeout();
|
||||
|
||||
signals:
|
||||
void reqNewItem();
|
||||
@ -42,6 +41,7 @@ public:
|
||||
std::weak_ptr<Item> getItem();
|
||||
void setItem(std::weak_ptr<Item>);
|
||||
bool itemIsSet();
|
||||
bool getWantsNewItem() {return wantsNewItem;}
|
||||
};
|
||||
|
||||
#endif // TRAINJS_H
|
||||
|
Reference in New Issue
Block a user