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

Method setProgress

app/src/MDF4/Player.cpp:568–591  ·  view source on GitHub ↗

* @brief Seeks to a specific position in the file */

Source from the content-addressed store, hash-verified

566 * @brief Seeks to a specific position in the file
567 */
568void MDF4::Player::setProgress(const double progress)
569{
570 if (!isOpen())
571 return;
572
573 if (isPlaying())
574 pause();
575
576 int newFramePos = qBound(0, static_cast<int>(progress * frameCount()), frameCount() - 1);
577
578 if (newFramePos != m_framePos) {
579 m_framePos = newFramePos;
580
581 UI::Dashboard::instance().clearPlotData();
582
583 int framesToLoad = UI::Dashboard::instance().points();
584 int startFrame = std::max(0, m_framePos - framesToLoad);
585 int endFrame = std::min(frameCount() - 1, m_framePos);
586
587 processFrameBatch(startFrame, endFrame);
588
589 updateData();
590 }
591}
592
593//--------------------------------------------------------------------------------------------------
594// Data processing

Callers

nothing calls this directly

Calls 2

clearPlotDataMethod · 0.80
pointsMethod · 0.45

Tested by

no test coverage detected