#include "controllersetup.h" #include "ui_controllersetup.h" #include "logcategories.h" controllerSetup::controllerSetup(QWidget* parent) : QDialog(parent), ui(new Ui::controllerSetup) { ui->setupUi(this); ui->tabWidget->clear(); ui->tabWidget->hide(); noControllersText = new QLabel("No USB controller found"); noControllersText->setStyleSheet("QLabel { color : gray; }"); ui->hboxLayout->addWidget(noControllersText); this->resize(this->sizeHint()); } controllerSetup::~controllerSetup() { qInfo(logUsbControl()) << "Deleting controllerSetup() window"; delete noControllersText; delete updateDialog; delete ui; // Will delete all content in all tabs tabs.clear(); // Step through ALL buttons and knobs setting their text to NULL (just in case) for (auto b = buttons->begin(); b != buttons->end(); b++) { b->text=Q_NULLPTR; b->bgRect=Q_NULLPTR; } for (auto k= knobs->begin(); k != knobs->end(); k++) { k->text=Q_NULLPTR; } } void controllerSetup::hideEvent(QHideEvent *event) { Q_UNUSED(event) qDebug(logUsbControl()) << "Controller window hideEvent()"; updateDialog->hide(); } void controllerSetup::on_tabWidget_currentChanged(int index) { // We may get the indexChanged event before the tabWidget has been initialized if (ui->tabWidget->widget(index) != Q_NULLPTR) { QString path = ui->tabWidget->widget(index)->objectName(); auto tab = tabs.find(path); if (tab != tabs.end()) { this->resize(this->sizeHint()); } } if (updateDialog != Q_NULLPTR) { updateDialog->hide(); } } void controllerSetup::init(usbDevMap* dev, QVector