| 420 | // ── ANT sub-panel ───────────────────────────────────────────────────────────── |
| 421 | |
| 422 | void SpectrumOverlayMenu::buildAntPanel() |
| 423 | { |
| 424 | m_antPanel = new QWidget(parentWidget()); |
| 425 | m_antPanel->setStyleSheet(kPanelStyle); |
| 426 | m_antPanel->hide(); |
| 427 | |
| 428 | auto* vbox = new QVBoxLayout(m_antPanel); |
| 429 | vbox->setContentsMargins(6, 6, 6, 6); |
| 430 | vbox->setSpacing(4); |
| 431 | |
| 432 | constexpr int kLabelW = 48; |
| 433 | constexpr int kValueW = 20; |
| 434 | |
| 435 | // RX ANT row |
| 436 | auto* antRow = new QHBoxLayout; |
| 437 | antRow->setSpacing(4); |
| 438 | auto* antLabel = new QLabel("RX ANT:"); |
| 439 | antLabel->setStyleSheet(kLabelStyle); |
| 440 | antLabel->setFixedWidth(kLabelW); |
| 441 | antRow->addWidget(antLabel); |
| 442 | m_rxAntCmb = new GuardedComboBox; |
| 443 | AetherSDR::applyComboStyle(m_rxAntCmb); |
| 444 | antRow->addWidget(m_rxAntCmb, 1); |
| 445 | vbox->addLayout(antRow); |
| 446 | |
| 447 | connect(m_rxAntCmb, QOverload<int>::of(&QComboBox::currentIndexChanged), |
| 448 | this, [this](int index) { |
| 449 | if (m_updatingFromModel || index < 0) |
| 450 | return; |
| 451 | QString ant = m_rxAntCmb->itemData(index).toString(); |
| 452 | if (ant.isEmpty()) |
| 453 | ant = m_rxAntCmb->itemText(index); |
| 454 | if (ant.isEmpty()) |
| 455 | return; |
| 456 | const QString profileId = m_kiwiSdrManager |
| 457 | ? m_kiwiSdrManager->profileIdForVirtualAntennaToken(ant) |
| 458 | : QString(); |
| 459 | SliceModel* targetSlice = |
| 460 | antennaTargetSliceForPan(m_radioModel, m_slice, m_panId); |
| 461 | if (!profileId.isEmpty()) { |
| 462 | if (targetSlice) { |
| 463 | emit kiwiRxAntennaSelected(targetSlice->sliceId(), profileId); |
| 464 | } |
| 465 | updateLoopButtonVisibility(); |
| 466 | return; |
| 467 | } |
| 468 | if (targetSlice) { |
| 469 | emit flexRxAntennaSelected(targetSlice->sliceId()); |
| 470 | } |
| 471 | if (m_radioModel && !m_panId.isEmpty()) { |
| 472 | m_radioModel->sendCommand( |
| 473 | QStringLiteral("display pan set %1 rxant=%2").arg(m_panId, ant)); |
| 474 | } else if (targetSlice) { |
| 475 | targetSlice->setRxAntenna(ant); |
| 476 | } |
| 477 | updateLoopButtonVisibility(); |
| 478 | }); |
| 479 |
nothing calls this directly
no test coverage detected