diff --git a/controllersetup.cpp b/controllersetup.cpp index 5cee26e..473c915 100644 --- a/controllersetup.cpp +++ b/controllersetup.cpp @@ -26,6 +26,13 @@ void controllerSetup::hideEvent(QHideEvent *event) updateDialog->hide(); } +void controllerSetup::on_tabWidget_currentChanged(int index) +{ + if (updateDialog != Q_NULLPTR) + updateDialog->hide(); +} + + void controllerSetup::init() { @@ -125,12 +132,33 @@ void controllerSetup::mousePressed(controllerScene* scene, QPoint p) buttonLatch->blockSignals(true); buttonLatch->setChecked(currentButton->toggle); buttonLatch->blockSignals(false); - buttonLatch->show(); - buttonOnColor->show(); - buttonOffColor->show(); - buttonIcon->show(); - iconLabel->show(); + + switch (currentButton->parent->type.model) + { + case StreamDeckMini: + case StreamDeckMiniV2: + case StreamDeckOriginal: + case StreamDeckOriginalV2: + case StreamDeckOriginalMK2: + case StreamDeckXL: + case StreamDeckXLV2: + case StreamDeckPlus: + buttonOnColor->setStyleSheet(QString("background-color: %1").arg(currentButton->backgroundOn.name(QColor::HexArgb))); + buttonOffColor->setStyleSheet(QString("background-color: %1").arg(currentButton->backgroundOff.name(QColor::HexArgb))); + buttonOnColor->show(); + buttonOffColor->show(); + buttonIcon->show(); + iconLabel->setText(currentButton->iconName); + iconLabel->show(); + break; + default: + buttonOnColor->hide(); + buttonOffColor->hide(); + buttonIcon->hide(); + iconLabel->hide(); + break; + } updateDialog->show(); updateDialog->move(gp); @@ -240,6 +268,7 @@ void controllerSetup::buttonOnColorClicked() { QMutexLocker locker(mutex); currentButton->backgroundOn = selColor; + buttonOnColor->setStyleSheet(QString("background-color: %1").arg(currentButton->backgroundOn.name(QColor::HexArgb))); emit sendRequest(currentButton->parent,usbFeatureType::featureButton,currentButton->num,currentButton->onCommand->text,currentButton->icon,¤tButton->backgroundOn); } } @@ -255,6 +284,7 @@ void controllerSetup::buttonOffColorClicked() { QMutexLocker locker(mutex); currentButton->backgroundOff = selColor; + buttonOffColor->setStyleSheet(QString("background-color: %1").arg(currentButton->backgroundOff.name(QColor::HexArgb))); } } @@ -263,7 +293,8 @@ void controllerSetup::buttonIconClicked() QString file = QFileDialog::getOpenFileName(this,"Select Icon Filename",".","Images (*png *.jpg)"); if (!file.isEmpty()) { QFileInfo info = QFileInfo(file); - iconLabel->setText(info.fileName()); + currentButton->iconName = info.fileName(); + iconLabel->setText(currentButton->iconName); QImage image; image.load(file); if (currentButton->icon != Q_NULLPTR) @@ -406,6 +437,19 @@ void controllerSetup::newDevice(USBDEVICE* dev, CONTROLLER* cntrl, QVectoraddItem(c.text, c.index); - offEvent->addItem(c.text, c.index); - } + if (c.index == -1) { + onEvent->insertSeparator(onEvent->count()); + offEvent->insertSeparator(offEvent->count()); - if (c.cmdType == commandKnob || c.text == "None") { - knobEvent->addItem(c.text, c.index); + } else { + onEvent->addItem(c.text, c.index); + offEvent->addItem(c.text, c.index); + } + } + else if (c.cmdType == commandKnob || c.text == "None") { + if (c.index == -1) { + knobEvent->insertSeparator(knobEvent->count()); + } else { + knobEvent->addItem(c.text, c.index); + } } } @@ -553,7 +606,7 @@ void controllerSetup::newDevice(USBDEVICE* dev, CONTROLLER* cntrl, QVectorpath; + qInfo(logUsbControl()) << "Setting sensitivity" << val <<"for device" << dev->product; emit sendRequest(dev,usbFeatureType::featureSensitivity,val); } diff --git a/controllersetup.h b/controllersetup.h index eaf865b..f56e35f 100644 --- a/controllersetup.h +++ b/controllersetup.h @@ -94,6 +94,7 @@ public slots: void disableClicked(USBDEVICE* dev, bool clicked, QWidget* widget); void setConnected(USBDEVICE* dev); void hideEvent(QHideEvent *event); + void on_tabWidget_currentChanged(int index); private: @@ -112,7 +113,7 @@ private: KNOB* currentKnob = Q_NULLPTR; // Update Dialog - QDialog * updateDialog; + QDialog * updateDialog = Q_NULLPTR; QComboBox* onEvent; QComboBox* offEvent; QComboBox* knobEvent; diff --git a/resources/resources.qrc b/resources/resources.qrc index 258b5b4..151a3ac 100644 --- a/resources/resources.qrc +++ b/resources/resources.qrc @@ -7,6 +7,10 @@ ecoder.png quickkeys.png xbox.png + streamdeck.png + streamdeckmini.png + streamdeckxl.png + streamdeckpedal.png streamdeckplus.png diff --git a/resources/streamdeck.png b/resources/streamdeck.png new file mode 100644 index 0000000..5c45c5f Binary files /dev/null and b/resources/streamdeck.png differ diff --git a/resources/streamdeckmini.png b/resources/streamdeckmini.png new file mode 100644 index 0000000..d514570 Binary files /dev/null and b/resources/streamdeckmini.png differ diff --git a/resources/streamdeckpedal.png b/resources/streamdeckpedal.png new file mode 100644 index 0000000..84a0e88 Binary files /dev/null and b/resources/streamdeckpedal.png differ diff --git a/resources/streamdeckplus.png b/resources/streamdeckplus.png index c89243c..5acbd7a 100644 Binary files a/resources/streamdeckplus.png and b/resources/streamdeckplus.png differ diff --git a/resources/streamdeckxl.png b/resources/streamdeckxl.png new file mode 100644 index 0000000..424999a Binary files /dev/null and b/resources/streamdeckxl.png differ diff --git a/usbcontroller.cpp b/usbcontroller.cpp index 4db9e76..20ebab6 100644 --- a/usbcontroller.cpp +++ b/usbcontroller.cpp @@ -124,20 +124,22 @@ void usbController::init(QMutex* mut,usbMap* prefs ,QVector