| 1235 | } |
| 1236 | |
| 1237 | void MainWindow::sendPanDimensionsToRadio(const QString& panId, |
| 1238 | SpectrumWidget* sw, |
| 1239 | bool updateLocalDecoderImmediately) |
| 1240 | { |
| 1241 | // Raw sender for radio FFT dimensions. Normal lifecycle/resize paths must |
| 1242 | // call requestPanDimensionsForRadio() instead so profile loads can defer |
| 1243 | // these writes; sending xpixels/ypixels while the radio is rebuilding a |
| 1244 | // profile can make the radio autosave a partial GUIClient slice layout. |
| 1245 | if (panId.isEmpty() || !sw || !panPixelDimensionsReady(sw)) { |
| 1246 | return; |
| 1247 | } |
| 1248 | |
| 1249 | auto* pan = m_radioModel.panadapter(panId); |
| 1250 | if (!pan) { |
| 1251 | return; |
| 1252 | } |
| 1253 | |
| 1254 | const int xpix = panXpixelsFor(sw); |
| 1255 | const int ypix = panYpixelsFor(sw); |
| 1256 | m_radioModel.sendCommand( |
| 1257 | QString("display pan set %1 xpixels=%2 ypixels=%3") |
| 1258 | .arg(panId).arg(xpix).arg(ypix)); |
| 1259 | |
| 1260 | if (profileLoadRadioStateWritesHeld()) { |
| 1261 | m_profileLoadPendingFftYpixels.insert(panId, ypix); |
| 1262 | m_profileLoadPanDimensionsSettlingUntilMs.insert( |
| 1263 | panId, |
| 1264 | QDateTime::currentMSecsSinceEpoch() + kProfileLoadDimensionSettleMs); |
| 1265 | } |
| 1266 | |
| 1267 | const quint32 streamId = pan->panStreamId(); |
| 1268 | if (streamId) { |
| 1269 | QPointer<SpectrumWidget> swGuard(sw); |
| 1270 | auto updateLocalDecoder = [this, panId, swGuard, streamId, ypix]() { |
| 1271 | if (m_shuttingDown || !swGuard) { |
| 1272 | return; |
| 1273 | } |
| 1274 | auto* currentPan = m_radioModel.panadapter(panId); |
| 1275 | if (!currentPan || currentPan->panStreamId() != streamId) { |
| 1276 | return; |
| 1277 | } |
| 1278 | if (!panPixelDimensionsReady(swGuard.data()) |
| 1279 | || panYpixelsFor(swGuard.data()) != ypix) { |
| 1280 | return; |
| 1281 | } |
| 1282 | m_radioModel.panStream()->setYPixels(streamId, ypix); |
| 1283 | swGuard->prepareForFftScaleChange(); |
| 1284 | }; |
| 1285 | |
| 1286 | if (updateLocalDecoderImmediately) { |
| 1287 | updateLocalDecoder(); |
| 1288 | } else { |
| 1289 | // Radio status echo is the normal sync point. The delayed fallback |
| 1290 | // preserves resize recovery if the echo is missed, without decoding |
| 1291 | // queued old-height FFT frames with the new height. |
| 1292 | QTimer::singleShot(kPanDimensionDecoderFallbackMs, |
| 1293 | this, |
| 1294 | updateLocalDecoder); |
nothing calls this directly
no test coverage detected