#ifndef CONTROLLERSETUP_H #define CONTROLLERSETUP_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "usbcontroller.h" class controllerScene : public QGraphicsScene { Q_OBJECT QGraphicsLineItem* item = Q_NULLPTR; signals: void showMenu(controllerScene* scene, QPoint p); void buttonAction(bool pressed, QPoint p); protected: void mousePressEvent(QGraphicsSceneMouseEvent* event) { if (event->button() == Qt::RightButton) { emit showMenu(this, event->scenePos().toPoint()); } else if (event->button() == Qt::LeftButton) { // Simulate a button press emit buttonAction(true,event->scenePos().toPoint()); } else { QGraphicsScene::mousePressEvent(event); } } void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { if (event->button() == Qt::LeftButton) { // Simulate a button release emit buttonAction(false,event->scenePos().toPoint()); } else { QGraphicsScene::mouseReleaseEvent(event); } } }; struct tabContent { QWidget* tab; QVBoxLayout* mainLayout; QHBoxLayout* topLayout; QWidget* widget; QVBoxLayout* layout; QCheckBox* disabled; QLabel* message; QGraphicsView* view; QLabel* pageLabel; QSpinBox* page; QHBoxLayout* sensLayout; QLabel* sensLabel; QSlider* sens; QImage* image; QGraphicsItem* bgImage = Q_NULLPTR; controllerScene* scene = Q_NULLPTR; QGridLayout* grid; QLabel* brightLabel; QComboBox* brightness; QLabel* speedLabel; QComboBox* speed; QLabel* orientLabel; QComboBox* orientation; QLabel* colorLabel; QPushButton* color; QLabel* timeoutLabel; QSpinBox* timeout; QLabel* pagesLabel; QSpinBox* pages; QLabel* helpText; }; namespace Ui { class controllerSetup; } class controllerSetup : public QDialog { Q_OBJECT public: explicit controllerSetup(QWidget* parent = 0); ~controllerSetup(); signals: void started(); void sendRequest(USBDEVICE* dev, usbFeatureType request, int val=0, QString text="", QImage* img=Q_NULLPTR, QColor* color=Q_NULLPTR); void programDisable(USBDEVICE* dev, bool disable); void programPages(USBDEVICE* dev, int pages); void backup(USBDEVICE* dev, QString path); void restore(USBDEVICE *dev, QString path); public slots: void init(usbDevMap* dev, QVector