* @brief Restores saved plot rings into the currently configured widget slots. Splices when * the new ring shape matches the saved one, replays through appendDecimated otherwise. */
| 2436 | * the new ring shape matches the saved one, replays through appendDecimated otherwise. |
| 2437 | */ |
| 2438 | void UI::Dashboard::restorePlotTimeRings(QHash<qint64, DSP::TimeRing>& snapshot) |
| 2439 | { |
| 2440 | if (snapshot.isEmpty()) |
| 2441 | return; |
| 2442 | |
| 2443 | const int n = widgetCount(SerialStudio::DashboardPlot); |
| 2444 | for (int i = 0; i < n; ++i) { |
| 2445 | auto ringIt = m_plotTimeRings.find(i); |
| 2446 | if (ringIt == m_plotTimeRings.end()) |
| 2447 | continue; |
| 2448 | |
| 2449 | const auto& d = getDatasetWidget(SerialStudio::DashboardPlot, i); |
| 2450 | auto savedIt = snapshot.find(ringSnapshotKey(d.sourceId, d.uniqueId)); |
| 2451 | if (savedIt == snapshot.end()) |
| 2452 | continue; |
| 2453 | |
| 2454 | auto& live = ringIt.value(); |
| 2455 | auto& kept = savedIt.value(); |
| 2456 | if (kept.time.raw() == nullptr) |
| 2457 | continue; |
| 2458 | |
| 2459 | if (live.time.capacity() == kept.time.capacity() && qFuzzyCompare(live.interval, kept.interval)) |
| 2460 | live = std::move(kept); |
| 2461 | else |
| 2462 | replayTimeRing(kept, live); |
| 2463 | |
| 2464 | snapshot.erase(savedIt); |
| 2465 | } |
| 2466 | } |
| 2467 | |
| 2468 | /** |
| 2469 | * @brief Restores saved multiplot rings; matches by group uniqueId and per-curve shape. |
nothing calls this directly
no test coverage detected