diff --git a/aboutbox.cpp b/aboutbox.cpp index 4c3549e..6fa2f1f 100644 --- a/aboutbox.cpp +++ b/aboutbox.cpp @@ -15,8 +15,7 @@ aboutbox::aboutbox(QWidget *parent) : ui->topText->setText("wfview version " + QString(WFVIEW_VERSION)); QString head = QString(""); - QString copyright = QString("Copyright 2017-2022 Elliott H. Liggett, W6EL. All rights reserved.
wfview source code is licensed under the GNU GPLv3."); - QString nacode = QString("

Networking, audio, rigctl server, and much more written by Phil Taylor, M0VSE"); + QString copyright = QString("Copyright 2017-2023 Elliott H. Liggett, W6EL and Phil E. Taylor, M0VSE. All rights reserved.
wfview source code is licensed under the GNU GPLv3."); QString scm = QString("

Source code and issues managed by Roeland Jansen, PA3MET"); QString doctest = QString("

Testing and development mentorship from Jim Nijkamp, PA8E."); @@ -86,7 +85,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."); // String it all together: - QString aboutText = head + copyright + "\n" + nacode + "\n" + scm + "\n" + doctest + dedication + wfviewcommunityack; + QString aboutText = head + copyright + "\n" + "\n" + scm + "\n" + doctest + dedication + wfviewcommunityack; aboutText.append(website + "\n" + donate + "\n"+ docs + support + contact +"\n"); aboutText.append("\n" + ssCredit + "\n" + rsCredit + "\n"); diff --git a/controllersetup.cpp b/controllersetup.cpp index dcc1a9f..ffa0f73 100644 --- a/controllersetup.cpp +++ b/controllersetup.cpp @@ -7,157 +7,321 @@ controllerSetup::controllerSetup(QWidget* parent) : ui(new Ui::controllerSetup) { ui->setupUi(this); - scene = new controllerScene(); - connect(scene, SIGNAL(mousePressed(QPoint)), this, SLOT(mousePressed(QPoint))); - ui->graphicsView->setScene(scene); - ui->qkBrightCombo->setVisible(false); - ui->qkOrientCombo->setVisible(false); - ui->qkSpeedCombo->setVisible(false); - ui->qkColorButton->setVisible(false); - ui->qkTimeoutSpin->setVisible(false); - ui->qkTimeoutLabel->setVisible(false); - textItem = scene->addText("No USB controller found"); - textItem->setDefaultTextColor(Qt::gray); + 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() { - /* - // Remove any existing button text: - for (QGraphicsItem* item : scene->items()) + 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++) { - QGraphicsTextItem* txt = qgraphicsitem_cast(item); - if (!txt || txt == textItem) - continue; - scene->removeItem(txt); - delete txt; + b->text=Q_NULLPTR; + b->bgRect=Q_NULLPTR; } - if (onEventProxy != Q_NULLPTR) { - scene->removeItem(onEventProxy); - onEventProxy = Q_NULLPTR; - delete onEvent; - onEvent = Q_NULLPTR; + for (auto k= knobs->begin(); k != knobs->end(); k++) + { + k->text=Q_NULLPTR; } - if (offEventProxy != Q_NULLPTR) { - scene->removeItem(offEventProxy); - offEventProxy = Q_NULLPTR; - delete offEvent; - offEvent = Q_NULLPTR; - } - if (knobEventProxy != Q_NULLPTR) { - scene->removeItem(knobEventProxy); - knobEventProxy = Q_NULLPTR; - delete knobEvent; - knobEvent = Q_NULLPTR; - } - */ - - if (bgImage != Q_NULLPTR) { - scene->removeItem(bgImage); - delete bgImage; - bgImage = Q_NULLPTR; - } - - delete textItem; - delete scene; - delete ui; } -void controllerSetup::mousePressed(QPoint p) +void controllerSetup::hideEvent(QHideEvent *event) { - // Receive mouse event from the scene - qDebug() << "Looking for button Point x=" << p.x() << " y=" << p.y(); - if (onEvent == Q_NULLPTR|| offEvent == Q_NULLPTR|| knobEvent == Q_NULLPTR) - { - qInfo(logUsbControl()) << "Event missing, cannot continue..."; - return; - } - - bool found = false; - QMutexLocker locker(mutex); + Q_UNUSED(event) + qDebug(logUsbControl()) << "Controller window hideEvent()"; + updateDialog->hide(); +} - - for (BUTTON& b : *buttons) - { - if (b.dev == currentDevice && b.pos.contains(p)) +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()) { - found = true; - currentButton = &b; - qDebug() << "Button" << currentButton->num << "On Event" << currentButton->onCommand->text << "Off Event" << currentButton->offCommand->text; - onEvent->blockSignals(true); - onEvent->move(p); - onEvent->setCurrentIndex(onEvent->findData(currentButton->onCommand->index)); - onEvent->show(); - onEvent->blockSignals(false); - - p.setY(p.y() + 40); - offEvent->blockSignals(true); - offEvent->move(p); - offEvent->setCurrentIndex(offEvent->findData(currentButton->offCommand->index)); - offEvent->show(); - offEvent->blockSignals(false); - knobEvent->hide(); - break; + this->resize(this->sizeHint()); } } - if (!found) { - for (KNOB& k : *knobs) - { - if (k.dev == currentDevice && k.pos.contains(p)) - { - found = true; - currentKnob = &k; - qDebug() << "Knob" << currentKnob->num << "Event" << currentKnob->command->text; - knobEvent->blockSignals(true); - knobEvent->move(p); - knobEvent->setCurrentIndex(knobEvent->findData(currentKnob->command->index)); - knobEvent->show(); - knobEvent->blockSignals(false); - onEvent->hide(); - offEvent->hide(); - break; + if (updateDialog != Q_NULLPTR) + { + updateDialog->hide(); + } + +} + +void controllerSetup::init(usbDevMap* dev, QVector