| 433 | } |
| 434 | |
| 435 | void |
| 436 | ProgressPanel::startTask(const NodePtr& node, |
| 437 | const int firstFrame, |
| 438 | const int lastFrame, |
| 439 | const int frameStep, |
| 440 | const bool canPause, |
| 441 | const bool canCancel, |
| 442 | const QString& message, |
| 443 | const ProcessHandlerPtr& process) |
| 444 | { |
| 445 | assert( QThread::currentThread() == qApp->thread() ); |
| 446 | if (!node) { |
| 447 | return; |
| 448 | } |
| 449 | assert( (canPause && firstFrame != std::numeric_limits<int>::min() && lastFrame != std::numeric_limits<int>::max()) || !canPause ); |
| 450 | |
| 451 | ProgressTaskInfoPtr task; |
| 452 | { |
| 453 | QMutexLocker k(&_imp->tasksMutex); |
| 454 | task = _imp->findTask(node); |
| 455 | } |
| 456 | if (task) { |
| 457 | task->cancelTask(false, 1); |
| 458 | removeTaskFromTable(task); |
| 459 | } |
| 460 | |
| 461 | |
| 462 | QMutexLocker k(&_imp->tasksMutex); |
| 463 | |
| 464 | task.reset( new ProgressTaskInfo(this, |
| 465 | node, |
| 466 | firstFrame, |
| 467 | lastFrame, |
| 468 | frameStep, |
| 469 | canPause, |
| 470 | canCancel, |
| 471 | message, process) ); |
| 472 | |
| 473 | task->setTaskBar(_taskbar); |
| 474 | |
| 475 | if ( canPause || node->getEffectInstance()->isOutput() ) { |
| 476 | task->createItems(); |
| 477 | QTimer::singleShot( NATRON_DISPLAY_PROGRESS_PANEL_AFTER_MS, this, SLOT(onShowProgressPanelTimerTriggered()) ); |
| 478 | } |
| 479 | |
| 480 | if (process) { |
| 481 | connectProcessSlots( task.get(), process.get() ); |
| 482 | } |
| 483 | if (!process) { |
| 484 | if ( node->getEffectInstance()->isOutput() ) { |
| 485 | OutputEffectInstance* isOutput = dynamic_cast<OutputEffectInstance*>( node->getEffectInstance().get() ); |
| 486 | if (isOutput) { |
| 487 | |
| 488 | if ( getGui() && !getGui()->isGUIFrozen() && appPTR->getCurrentSettings()->isAutoTurboEnabled() ) { |
| 489 | getGui()->onFreezeUIButtonClicked(true); |
| 490 | } |
| 491 | |
| 492 | RenderEnginePtr engine = isOutput->getRenderEngine(); |
no test coverage detected