MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / updateProgressBar

Method updateProgressBar

Gui/ProgressTaskInfo.cpp:567–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565} // ProgressTaskInfoPrivate::createItems
566
567void
568ProgressTaskInfo::updateProgressBar(double totalProgress,
569 double subTaskProgress)
570{
571 assert( QThread::currentThread() == qApp->thread() );
572 totalProgress = MathUtils::clamp(totalProgress, 0., 1.);
573 subTaskProgress = MathUtils::clamp(subTaskProgress, 0., 1.);
574
575 _imp->progressPercent = totalProgress * 100.;
576 if (_imp->progressBar) {
577 _imp->progressBar->setValue(_imp->progressPercent);
578 }
579
580
581 double timeElapsedSecs = _imp->timer->getTimeSinceCreation();
582 _imp->timeRemaining = subTaskProgress == 0 ? 0 : timeElapsedSecs * (1. - subTaskProgress) / subTaskProgress;
583
584 if ( !_imp->nameItem && !wasCanceled() ) {
585 ///Show the item if the total estimated time is gt NATRON_SHOW_PROGRESS_TOTAL_ESTIMATED_TIME_MS
586 //double totalTime = subTaskProgress == 0 ? 0 : timeElapsedSecs * 1. / subTaskProgress;
587
588 // If we estimate that the task will be longer than NATRON_SHOW_PROGRESS_TOTAL_ESTIMATED_TIME_MS and it has been
589 // NATRON_PROGRESS_DIALOG_ETA_REFRESH_MS elapsed, show it
590 if ( (_imp->timeRemaining * 1000 > NATRON_SHOW_PROGRESS_TOTAL_ESTIMATED_TIME_MS) &&
591 ( timeElapsedSecs * 1000 > NATRON_PROGRESS_DIALOG_ETA_REFRESH_MS) ) {
592 _imp->createItems();
593 _imp->panel->onShowProgressPanelTimerTriggered();
594 }
595 }
596
597 if (!_imp->updatedProgressOnce && _imp->statusItem) {
598 _imp->updatedProgressOnce = true;
599 _imp->statusItem->setTextColor(Qt::green);
600 _imp->status = eProgressTaskStatusRunning;
601 _imp->statusItem->setText( tr("Running") );
602 _imp->refreshButtons();
603 }
604
605 updateTaskBarProgress(_imp->status, _imp->progressPercent);
606}
607
608void
609ProgressTaskInfo::updateProgress(const int frame,

Callers 1

Calls 7

clampFunction · 0.85
getTimeSinceCreationMethod · 0.80
createItemsMethod · 0.80
refreshButtonsMethod · 0.80
setValueMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected