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

Method setProgress

app/src/Sessions/Player.cpp:614–636  ·  view source on GitHub ↗

* @brief Seeks to a normalized position and rebuilds plot history around it. */

Source from the content-addressed store, hash-verified

612 * @brief Seeks to a normalized position and rebuilds plot history around it.
613 */
614void Sessions::Player::setProgress(const double progress)
615{
616 if (!isOpen())
617 return;
618
619 const auto clamped = std::clamp(progress, 0.0, 1.0);
620 if (isPlaying())
621 pause();
622
623 const int newPos = qMin(frameCount() - 1, qCeil(frameCount() * clamped));
624 if (newPos == m_framePos)
625 return;
626
627 m_framePos = newPos;
628
629 UI::Dashboard::instance().clearPlotData();
630
631 const int toLoad = UI::Dashboard::instance().points();
632 const int startIdx = std::max(0, m_framePos - toLoad);
633 processFrameBatch(startIdx, m_framePos);
634
635 updateData();
636}
637
638/**
639 * @brief Advances one frame and rebuilds the trailing plot window.

Callers

nothing calls this directly

Calls 3

clearPlotDataMethod · 0.80
clampFunction · 0.50
pointsMethod · 0.45

Tested by

no test coverage detected