* @brief Restores saved multiplot rings; matches by group uniqueId and per-curve shape. */
| 2469 | * @brief Restores saved multiplot rings; matches by group uniqueId and per-curve shape. |
| 2470 | */ |
| 2471 | void UI::Dashboard::restoreMultiplotTimeRings(QHash<qint64, std::vector<DSP::TimeRing>>& snapshot) |
| 2472 | { |
| 2473 | if (snapshot.isEmpty()) |
| 2474 | return; |
| 2475 | |
| 2476 | const int n = widgetCount(SerialStudio::DashboardMultiPlot); |
| 2477 | for (int i = 0; i < n; ++i) { |
| 2478 | auto ringIt = m_multiplotTimeRings.find(i); |
| 2479 | if (ringIt == m_multiplotTimeRings.end()) |
| 2480 | continue; |
| 2481 | |
| 2482 | const auto& g = getGroupWidget(SerialStudio::DashboardMultiPlot, i); |
| 2483 | auto savedIt = snapshot.find(ringSnapshotKey(g.sourceId, g.uniqueId)); |
| 2484 | if (savedIt == snapshot.end()) |
| 2485 | continue; |
| 2486 | |
| 2487 | auto& live = ringIt.value(); |
| 2488 | auto& kept = savedIt.value(); |
| 2489 | |
| 2490 | const std::size_t count = std::min(live.size(), kept.size()); |
| 2491 | for (std::size_t j = 0; j < count; ++j) { |
| 2492 | if (kept[j].time.raw() == nullptr) |
| 2493 | continue; |
| 2494 | |
| 2495 | if (live[j].time.capacity() == kept[j].time.capacity() |
| 2496 | && qFuzzyCompare(live[j].interval, kept[j].interval)) |
| 2497 | live[j] = std::move(kept[j]); |
| 2498 | else |
| 2499 | replayTimeRing(kept[j], live[j]); |
| 2500 | } |
| 2501 | |
| 2502 | snapshot.erase(savedIt); |
| 2503 | } |
| 2504 | } |
| 2505 | |
| 2506 | /** |
| 2507 | * @brief Re-applies saved sweep trigger settings onto freshly configured plot engines. |
nothing calls this directly
no test coverage detected