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

Method restoreMultiplotTimeRings

app/src/UI/Dashboard.cpp:2471–2504  ·  view source on GitHub ↗

* @brief Restores saved multiplot rings; matches by group uniqueId and per-curve shape. */

Source from the content-addressed store, hash-verified

2469 * @brief Restores saved multiplot rings; matches by group uniqueId and per-curve shape.
2470 */
2471void 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.

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected