| 7757 | } |
| 7758 | |
| 7759 | void MainWindow::createPansSequentially(const QString& layoutId, int total, |
| 7760 | std::shared_ptr<QStringList> panIds, int created) |
| 7761 | { |
| 7762 | if (created >= total) { |
| 7763 | // All new pans created — wait for radio status to establish PanadapterModels |
| 7764 | qDebug() << "applyPanLayout: all" << total << "new pans created:" << *panIds; |
| 7765 | QTimer::singleShot(800, this, [this, panIds, layoutId]() { |
| 7766 | // The new pans were added to the stack via panadapterAdded handler. |
| 7767 | // Wire any that aren't already wired. |
| 7768 | for (auto* applet : m_panStack->allApplets()) { |
| 7769 | const QString pid = applet->panId(); |
| 7770 | auto* pan = m_radioModel.panadapter(pid); |
| 7771 | if (pan) { |
| 7772 | // Push current state to the spectrum widget |
| 7773 | applet->spectrumWidget()->setDbmRange(pan->minDbm(), pan->maxDbm()); |
| 7774 | applet->spectrumWidget()->setFrequencyRange( |
| 7775 | pan->centerMhz(), pan->bandwidthMhz()); |
| 7776 | } |
| 7777 | } |
| 7778 | |
| 7779 | // Rearrange splitter structure for the selected layout |
| 7780 | m_panStack->rearrangeLayout(layoutId); |
| 7781 | |
| 7782 | m_panApplet = m_panStack->activeApplet(); |
| 7783 | |
| 7784 | qDebug() << "applyPanLayout: layout" << layoutId |
| 7785 | << "complete, total pans:" << m_panStack->count(); |
| 7786 | }); |
| 7787 | return; |
| 7788 | } |
| 7789 | |
| 7790 | m_radioModel.sendCmdPublic( |
| 7791 | "display panafall create x=100 y=100", |
| 7792 | [this, panIds, layoutId, total, created](int code, const QString& body) { |
| 7793 | if (code != 0) { |
| 7794 | qWarning() << "applyPanLayout: panafall create failed, code" |
| 7795 | << Qt::hex << code << body; |
| 7796 | showPanadapterSliceCapacityMessage(); |
| 7797 | return; |
| 7798 | } |
| 7799 | const QString panId = RadioStatusOwnership::parsePanafallCreatePanId(body); |
| 7800 | |
| 7801 | qDebug() << "applyPanLayout: created pan" << (created + 1) << "of" << total |
| 7802 | << "id:" << panId; |
| 7803 | |
| 7804 | if (!panId.isEmpty()) { |
| 7805 | panIds->append(panId); |
| 7806 | // Configure the pan |
| 7807 | m_radioModel.sendCommand( |
| 7808 | QString("display pan set %1 xpixels=1024 ypixels=700").arg(panId)); |
| 7809 | } |
| 7810 | |
| 7811 | // Create next pan after a brief delay |
| 7812 | QTimer::singleShot(200, this, [this, layoutId, total, panIds, created]() { |
| 7813 | createPansSequentially(layoutId, total, panIds, created + 1); |
| 7814 | }); |
| 7815 | }); |
| 7816 | } |
nothing calls this directly
no test coverage detected