* @brief Seeks playback to a normalized position between 0.0 and 1.0. */
| 424 | * @brief Seeks playback to a normalized position between 0.0 and 1.0. |
| 425 | */ |
| 426 | void CSV::Player::setProgress(const double progress) |
| 427 | { |
| 428 | Q_ASSERT(progress >= 0.0 && progress <= 1.0); |
| 429 | Q_ASSERT(isOpen()); |
| 430 | |
| 431 | const auto validProgress = std::clamp(progress, 0.0, 1.0); |
| 432 | |
| 433 | if (isPlaying()) |
| 434 | pause(); |
| 435 | |
| 436 | if (frameCount() <= 0) |
| 437 | return; |
| 438 | |
| 439 | int newFramePos = qMin(frameCount() - 1, qCeil(frameCount() * validProgress)); |
| 440 | |
| 441 | if (newFramePos != m_framePos) { |
| 442 | m_framePos = newFramePos; |
| 443 | |
| 444 | UI::Dashboard::instance().clearPlotData(); |
| 445 | |
| 446 | int framesToLoad = UI::Dashboard::instance().points(); |
| 447 | int startFrame = std::max(1, m_framePos - framesToLoad); |
| 448 | int endFrame = std::min(frameCount() - 1, m_framePos); |
| 449 | |
| 450 | processFrameBatch(startFrame, endFrame); |
| 451 | |
| 452 | updateData(); |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | //-------------------------------------------------------------------------------------------------- |
| 457 | // Data processing |
nothing calls this directly
no test coverage detected