MCPcopy Create free account
hub / github.com/MrKepzie/Natron / cancelTask

Method cancelTask

Gui/ProgressTaskInfo.cpp:214–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214void
215ProgressTaskInfo::cancelTask(bool calledFromRenderEngine,
216 int retCode)
217{
218 if (_imp->refreshLabelTimer) {
219 _imp->refreshLabelTimer->stop();
220 }
221
222 if ( _imp->panel->getGui() && _imp->panel->getGui()->isGUIFrozen() && appPTR->getCurrentSettings()->isAutoTurboEnabled() ) {
223 _imp->panel->getGui()->onFreezeUIButtonClicked(false);
224 }
225
226 if (calledFromRenderEngine) {
227 _imp->panel->getGui()->ensureProgressPanelVisible();
228 _imp->panel->onLastTaskAddedFinished(this);
229 } else {
230 if (_imp->lastWidgetCurrentWhenShowingProgressDialog) {
231 _imp->lastWidgetCurrentWhenShowingProgressDialog->getParentPane()->setCurrentWidget(_imp->lastWidgetCurrentWhenShowingProgressDialog);
232 _imp->lastWidgetCurrentWhenShowingProgressDialog = 0;
233 }
234 }
235
236 {
237 QMutexLocker k(&_imp->canceledMutex);
238 if (_imp->canceled) {
239 return;
240 }
241 _imp->canceled = true;
242 }
243 if (_imp->timeRemainingItem) {
244 _imp->timeRemainingItem->setText( tr("N/A") );
245 }
246 if (_imp->statusItem) {
247 if (!calledFromRenderEngine) {
248 _imp->statusItem->setTextColor( QColor(243, 147, 0) );
249 if (_imp->canBePaused) {
250 _imp->statusItem->setText( tr("Paused") );
251 _imp->status = eProgressTaskStatusPaused;
252 } else {
253 _imp->statusItem->setText( tr("Canceled") );
254 _imp->status = eProgressTaskStatusCanceled;
255 }
256 } else {
257 if (retCode == 0) {
258 _imp->statusItem->setTextColor(Qt::black);
259 _imp->statusItem->setText( tr("Finished") );
260 _imp->status = eProgressTaskStatusFinished;
261 if (_imp->progressBar) {
262 _imp->progressBar->setValue(100);
263 }
264 } else {
265 _imp->statusItem->setTextColor(Qt::red);
266 _imp->statusItem->setText( tr("Failed") );
267 _imp->status = eProgressTaskStatusFinished;
268 }
269 }
270 _imp->refreshButtons();
271 }

Callers 3

startTaskMethod · 0.80

Calls 15

QColorClass · 0.85
isGUIFrozenMethod · 0.80
isAutoTurboEnabledMethod · 0.80
getCurrentSettingsMethod · 0.80
setCurrentWidgetMethod · 0.80
getParentPaneMethod · 0.80
refreshButtonsMethod · 0.80
getEffectInstanceMethod · 0.80
removeRenderFromQueueMethod · 0.80

Tested by

no test coverage detected