| 2598 | #endif |
| 2599 | |
| 2600 | void MainWindow::wireRadioSetupDialogSignals(RadioSetupDialog* dlg, const QString& prevComp) |
| 2601 | { |
| 2602 | if (!dlg) return; |
| 2603 | connect(dlg, &RadioSetupDialog::txBandSettingsRequested, |
| 2604 | m_txBandAction, &QAction::trigger); |
| 2605 | // serialSettingsChanged is the "external-device settings changed" signal in |
| 2606 | // practice — the dialog emits it for serial-port, FlexControl, Ulanzi-dial, |
| 2607 | // and HID-encoder edits. The Ulanzi/HID branches below run regardless of |
| 2608 | // HAVE_SERIALPORT because those backends exist on all platforms (#3257). |
| 2609 | connect(dlg, &RadioSetupDialog::serialSettingsChanged, this, [this]() { |
| 2610 | #ifdef HAVE_SERIALPORT |
| 2611 | QMetaObject::invokeMethod(m_serialPort, [this] { m_serialPort->loadSettings(); }); |
| 2612 | auto& fcs = AppSettings::instance(); |
| 2613 | const bool fcOpen = fcs.value("FlexControlOpen", "False").toString() == "True"; |
| 2614 | const QString fcPort = fcs.value("FlexControlPort").toString(); |
| 2615 | const bool fcInvert = fcs.value("FlexControlInvertDir", "False").toString() == "True"; |
| 2616 | QMetaObject::invokeMethod(m_flexControl, [this, fcOpen, fcPort, fcInvert] { |
| 2617 | if (fcOpen) { |
| 2618 | if (fcPort.isEmpty()) { |
| 2619 | if (m_flexControl->isOpen()) |
| 2620 | m_flexControl->close(); |
| 2621 | } else if (!m_flexControl->isOpen() || m_flexControl->portName() != fcPort) { |
| 2622 | if (m_flexControl->isOpen()) |
| 2623 | m_flexControl->close(); |
| 2624 | m_flexControl->open(fcPort); |
| 2625 | } |
| 2626 | } else if (m_flexControl->isOpen()) { |
| 2627 | m_flexControl->close(); |
| 2628 | } |
| 2629 | m_flexControl->setInvertDirection(fcInvert); |
| 2630 | }); |
| 2631 | if (m_flexControlDialog) |
| 2632 | m_flexControlDialog->refreshButtonActions(); |
| 2633 | syncFlexControlIndicatorForSettings(); |
| 2634 | #endif |
| 2635 | // External-device enable evaluation. start()/loadSettings() are |
| 2636 | // idempotent (each guards against re-open), so re-firing them when |
| 2637 | // unrelated settings change is harmless. Toggling the user-facing |
| 2638 | // checkbox from off → on is the moment the OS TCC prompt fires — |
| 2639 | // with user context — instead of every launch (#3257). |
| 2640 | auto& s = AppSettings::instance(); |
| 2641 | if (m_dialBackend && |
| 2642 | s.value("UlanziDialEnabled", "False").toString() == "True") { |
| 2643 | QMetaObject::invokeMethod(m_dialBackend, &UlanziDialBackend::start, |
| 2644 | Qt::QueuedConnection); |
| 2645 | } |
| 2646 | #ifdef HAVE_HIDAPI |
| 2647 | if (m_hidEncoder && |
| 2648 | s.value("HidEncoderEnabled", "False").toString() == "True") { |
| 2649 | QMetaObject::invokeMethod(m_hidEncoder, [this] { |
| 2650 | m_hidEncoder->loadSettings(); |
| 2651 | }); |
| 2652 | } |
| 2653 | refreshStreamDeckLabels(); |
| 2654 | #endif |
| 2655 | }); |
| 2656 | #ifdef HAVE_SERIALPORT |
| 2657 | dlg->setFlexControlConnectionStatus( |
nothing calls this directly
no test coverage detected