#ifndef TRAINJS_H #define TRAINJS_H #include #include #include #include #include "items/item.h" #include "QJoysticks.h" class TrainJs: public QObject { Q_OBJECT private: static constexpr char JOYSTICK_NAME[] = "UVOS UsbJoy"; inline static std::vector> js_; int id_ = -1; int axis_ = -1; bool handleRelease = false; bool wantsNewItem = true; bool inhibitUntillZero = true; std::weak_ptr item_; TrainJs(int id, int axis); TrainJs() = default; private slots: void axisChanged(const int id, const int axis, const qreal value); void buttonChanged(const int id, const int button, const bool pressed); signals: void reqNewItem(); public: ~TrainJs(); static std::vector> getJsDevices(); static void init(); std::weak_ptr getItem(); void setItem(std::weak_ptr); bool itemIsSet(); bool getWantsNewItem() { return wantsNewItem; } }; #endif // TRAINJS_H