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

Method createCellWidgets

Gui/ProgressTaskInfo.cpp:605–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603}
604
605void
606ProgressTaskInfo::createCellWidgets()
607{
608 _imp->progressBar = new QProgressBar;
609 _imp->progressBar->setValue(_imp->progressPercent);
610 //We must call this otherwise this is never called by Qt for custom widgets (this is a Qt bug)
611 {
612 QSize s = _imp->progressBar->minimumSizeHint();
613 Q_UNUSED(s);
614 }
615 _imp->controlsButtonsContainer = new QWidget;
616 QHBoxLayout* layout = new QHBoxLayout(_imp->controlsButtonsContainer);
617 layout->setContentsMargins(0, 0, 0, 0);
618 layout->setSpacing(0);
619
620 int medSizeIcon = TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE);
621 QPixmap restartPix, pauseOnPix, pauseOffPix, clearTasksPix;
622 appPTR->getIcon(NATRON_PIXMAP_PLAYER_PLAY_DISABLED, medSizeIcon, &restartPix);
623 appPTR->getIcon(NATRON_PIXMAP_PLAYER_STOP_DISABLED, medSizeIcon, &clearTasksPix);
624 appPTR->getIcon(NATRON_PIXMAP_PLAYER_PAUSE_ENABLED, medSizeIcon, &pauseOnPix);
625 appPTR->getIcon(NATRON_PIXMAP_PLAYER_PAUSE_DISABLED, medSizeIcon, &pauseOffPix);
626
627 const QSize medButtonIconSize( TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_ICON_SIZE) );
628 const QSize medButtonSize( TO_DPIX(NATRON_MEDIUM_BUTTON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_SIZE) );
629 QIcon pauseIc;
630 pauseIc.addPixmap(pauseOnPix, QIcon::Normal, QIcon::On);
631 pauseIc.addPixmap(pauseOffPix, QIcon::Normal, QIcon::Off);
632 _imp->pauseTasksButton = new Button(pauseIc, QString(), _imp->controlsButtonsContainer);
633 _imp->pauseTasksButton->setFixedSize(medButtonSize);
634 _imp->pauseTasksButton->setIconSize(medButtonIconSize);
635 _imp->pauseTasksButton->setFocusPolicy(Qt::NoFocus);
636 _imp->pauseTasksButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Pause the task. Tasks that can be paused "
637 "may be restarted with the restart button."), NATRON_NAMESPACE::WhiteSpaceNormal) );
638 QObject::connect( _imp->pauseTasksButton, SIGNAL(clicked(bool)), this, SLOT(onPauseTriggered()) );
639 _imp->pauseTasksButton->setEnabled(_imp->canBePaused);
640 layout->addWidget(_imp->pauseTasksButton);
641
642 _imp->restartTasksButton = new Button(QIcon(restartPix), QString(), _imp->controlsButtonsContainer);
643 _imp->restartTasksButton->setFixedSize(medButtonSize);
644 _imp->restartTasksButton->setIconSize(medButtonIconSize);
645 _imp->restartTasksButton->setFocusPolicy(Qt::NoFocus);
646 _imp->restartTasksButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Restart task"), NATRON_NAMESPACE::WhiteSpaceNormal) );
647 QObject::connect( _imp->restartTasksButton, SIGNAL(clicked(bool)), this, SLOT(onRestartTriggered()) );
648 _imp->restartTasksButton->setEnabled(false);
649 layout->addWidget(_imp->restartTasksButton);
650
651
652 _imp->cancelTasksButton = new Button(QIcon(clearTasksPix), QString(), _imp->controlsButtonsContainer);
653 _imp->cancelTasksButton->setFixedSize(medButtonSize);
654 _imp->cancelTasksButton->setIconSize(medButtonIconSize);
655 _imp->cancelTasksButton->setFocusPolicy(Qt::NoFocus);
656 _imp->cancelTasksButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Cancel and remove the task from the list"), NATRON_NAMESPACE::WhiteSpaceNormal) );
657 QObject::connect( _imp->cancelTasksButton, SIGNAL(clicked(bool)), this, SLOT(onCancelTriggered()) );
658 layout->addWidget(_imp->cancelTasksButton);
659
660 _imp->refreshButtons();
661} // ProgressTaskInfo::createCellWidgets
662

Callers 2

removeTasksFromTableMethod · 0.80
createItemsMethod · 0.80

Calls 10

QStringClass · 0.85
convertFromPlainTextFunction · 0.85
QIconClass · 0.85
addWidgetMethod · 0.80
refreshButtonsMethod · 0.80
setValueMethod · 0.45
minimumSizeHintMethod · 0.45
getIconMethod · 0.45
setToolTipMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected