MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / restorePlotTimeRings

Method restorePlotTimeRings

app/src/UI/Dashboard.cpp:2438–2466  ·  view source on GitHub ↗

* @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. */

Source from the content-addressed store, hash-verified

2436 * the new ring shape matches the saved one, replays through appendDecimated otherwise.
2437 */
2438void 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.

Callers

nothing calls this directly

Calls 7

ringSnapshotKeyFunction · 0.85
replayTimeRingFunction · 0.85
isEmptyMethod · 0.80
findMethod · 0.80
rawMethod · 0.80
valueMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected