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