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

Method createCellWidgets

Gui/ProgressTaskInfo.cpp:650–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void
651ProgressTaskInfo::createCellWidgets()
652{
653 _imp->progressBar = new QProgressBar;
654 _imp->progressBar->setValue(_imp->progressPercent);
655 //We must call this otherwise this is never called by Qt for custom widgets (this is a Qt bug)
656 {
657 QSize s = _imp->progressBar->minimumSizeHint();
658 Q_UNUSED(s);
659 }
660 _imp->controlsButtonsContainer = new QWidget;
661 QHBoxLayout* layout = new QHBoxLayout(_imp->controlsButtonsContainer);
662 layout->setContentsMargins(0, 0, 0, 0);
663 layout->setSpacing(0);
664
665 int medSizeIcon = TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE);
666 QPixmap restartPix, pauseOnPix, pauseOffPix, clearTasksPix;
667 appPTR->getIcon(NATRON_PIXMAP_PLAYER_PLAY_DISABLED, medSizeIcon, &restartPix);
668 appPTR->getIcon(NATRON_PIXMAP_PLAYER_STOP_DISABLED, medSizeIcon, &clearTasksPix);
669 appPTR->getIcon(NATRON_PIXMAP_PLAYER_PAUSE_ENABLED, medSizeIcon, &pauseOnPix);
670 appPTR->getIcon(NATRON_PIXMAP_PLAYER_PAUSE_DISABLED, medSizeIcon, &pauseOffPix);
671
672 const QSize medButtonIconSize( TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_ICON_SIZE) );
673 const QSize medButtonSize( TO_DPIX(NATRON_MEDIUM_BUTTON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_SIZE) );
674 QIcon pauseIc;
675 pauseIc.addPixmap(pauseOnPix, QIcon::Normal, QIcon::On);
676 pauseIc.addPixmap(pauseOffPix, QIcon::Normal, QIcon::Off);
677 _imp->pauseTasksButton = new Button(pauseIc, QString(), _imp->controlsButtonsContainer);
678 _imp->pauseTasksButton->setFixedSize(medButtonSize);
679 _imp->pauseTasksButton->setIconSize(medButtonIconSize);
680 _imp->pauseTasksButton->setFocusPolicy(Qt::NoFocus);
681 _imp->pauseTasksButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Pause the task. Tasks that can be paused "
682 "may be restarted with the restart button."), NATRON_NAMESPACE::WhiteSpaceNormal) );
683 QObject::connect( _imp->pauseTasksButton, SIGNAL(clicked(bool)), this, SLOT(onPauseTriggered()) );
684 _imp->pauseTasksButton->setEnabled(_imp->canBePaused);
685 layout->addWidget(_imp->pauseTasksButton);
686
687 _imp->restartTasksButton = new Button(QIcon(restartPix), QString(), _imp->controlsButtonsContainer);
688 _imp->restartTasksButton->setFixedSize(medButtonSize);
689 _imp->restartTasksButton->setIconSize(medButtonIconSize);
690 _imp->restartTasksButton->setFocusPolicy(Qt::NoFocus);
691 _imp->restartTasksButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Restart task"), NATRON_NAMESPACE::WhiteSpaceNormal) );
692 QObject::connect( _imp->restartTasksButton, SIGNAL(clicked(bool)), this, SLOT(onRestartTriggered()) );
693 _imp->restartTasksButton->setEnabled(false);
694 layout->addWidget(_imp->restartTasksButton);
695
696
697 _imp->cancelTasksButton = new Button(QIcon(clearTasksPix), QString(), _imp->controlsButtonsContainer);
698 _imp->cancelTasksButton->setFixedSize(medButtonSize);
699 _imp->cancelTasksButton->setIconSize(medButtonIconSize);
700 _imp->cancelTasksButton->setFocusPolicy(Qt::NoFocus);
701 _imp->cancelTasksButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Cancel and remove the task from the list"), NATRON_NAMESPACE::WhiteSpaceNormal) );
702 QObject::connect( _imp->cancelTasksButton, SIGNAL(clicked(bool)), this, SLOT(onCancelTriggered()) );
703 layout->addWidget(_imp->cancelTasksButton);
704
705 _imp->refreshButtons();
706} // ProgressTaskInfo::createCellWidgets
707

Callers 2

removeTasksFromTableMethod · 0.80
createItemsMethod · 0.80

Calls 10

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

Tested by

no test coverage detected