diff --git a/ApplicationLibCode/Commands/WorkflowCommands/RicCancelWorkflowJobFeature.cpp b/ApplicationLibCode/Commands/WorkflowCommands/RicCancelWorkflowJobFeature.cpp index 639c6f6c0d..2234bec1dd 100644 --- a/ApplicationLibCode/Commands/WorkflowCommands/RicCancelWorkflowJobFeature.cpp +++ b/ApplicationLibCode/Commands/WorkflowCommands/RicCancelWorkflowJobFeature.cpp @@ -26,6 +26,9 @@ CAF_CMD_SOURCE_INIT( RicCancelWorkflowJobFeature, "RicCancelWorkflowJobFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RicCancelWorkflowJobFeature::onActionTriggered( bool isChecked ) { auto jobs = caf::selectedObjectsByType(); @@ -33,12 +36,18 @@ void RicCancelWorkflowJobFeature::onActionTriggered( bool isChecked ) jobs.front()->cancelJob(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RicCancelWorkflowJobFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Cancel Job" ); actionToSetup->setIcon( QIcon( ":/stop.svg" ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RicCancelWorkflowJobFeature::isCommandEnabled() const { auto jobs = caf::selectedObjectsByType(); diff --git a/ApplicationLibCode/Commands/WorkflowCommands/RicNewWorkflowJobFeature.cpp b/ApplicationLibCode/Commands/WorkflowCommands/RicNewWorkflowJobFeature.cpp index e6eee0523a..270c0ab60e 100644 --- a/ApplicationLibCode/Commands/WorkflowCommands/RicNewWorkflowJobFeature.cpp +++ b/ApplicationLibCode/Commands/WorkflowCommands/RicNewWorkflowJobFeature.cpp @@ -30,6 +30,9 @@ CAF_CMD_SOURCE_INIT( RicNewWorkflowJobFeature, "RicNewWorkflowJobFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RicNewWorkflowJobFeature::onActionTriggered( bool isChecked ) { auto workflows = caf::selectedObjectsByType(); @@ -53,12 +56,18 @@ void RicNewWorkflowJobFeature::onActionTriggered( bool isChecked ) workflow->uiCapability()->updateAllRequiredEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RicNewWorkflowJobFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "New Job" ); actionToSetup->setIcon( QIcon( ":/caf/duplicate.svg" ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RicNewWorkflowJobFeature::isCommandEnabled() const { return caf::selectedObjectsByType().size() == 1; diff --git a/ApplicationLibCode/Commands/WorkflowCommands/RicRunWorkflowJobFeature.cpp b/ApplicationLibCode/Commands/WorkflowCommands/RicRunWorkflowJobFeature.cpp index 8da5a00c76..f263121430 100644 --- a/ApplicationLibCode/Commands/WorkflowCommands/RicRunWorkflowJobFeature.cpp +++ b/ApplicationLibCode/Commands/WorkflowCommands/RicRunWorkflowJobFeature.cpp @@ -26,6 +26,9 @@ CAF_CMD_SOURCE_INIT( RicRunWorkflowJobFeature, "RicRunWorkflowJobFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RicRunWorkflowJobFeature::onActionTriggered( bool isChecked ) { auto jobs = caf::selectedObjectsByType(); @@ -33,12 +36,18 @@ void RicRunWorkflowJobFeature::onActionTriggered( bool isChecked ) jobs.front()->runJob(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RicRunWorkflowJobFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Run" ); actionToSetup->setIcon( QIcon( ":/Play.svg" ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RicRunWorkflowJobFeature::isCommandEnabled() const { auto jobs = caf::selectedObjectsByType(); diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflow.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflow.cpp index beae967fc1..a2b819ee78 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflow.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflow.cpp @@ -39,6 +39,9 @@ CAF_PDM_SOURCE_INIT( RimWorkflow, "Workflow" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflow::RimWorkflow() { CAF_PDM_InitObject( "Workflow", ":/Folder.png" ); @@ -58,11 +61,17 @@ RimWorkflow::RimWorkflow() CAF_PDM_InitFieldNoDefault( &m_jobs, "Jobs", "" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflow::name() const { return m_name(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflow::setWorkflowDirectory( const QString& directory ) { m_workflowDirectory = directory; @@ -71,21 +80,33 @@ void RimWorkflow::setWorkflowDirectory( const QString& directory ) setUiName( name ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflow::workflowDirectory() const { return m_workflowDirectory().path(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QJsonObject RimWorkflow::graph() const { return m_graph; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflow::loadError() const { return m_loadError(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- std::vector RimWorkflow::jobs() const { std::vector result; @@ -97,16 +118,25 @@ std::vector RimWorkflow::jobs() const return result; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflow::addJob( RimWorkflowJob* job ) { if ( job ) m_jobs.push_back( job ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflow::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const { menuBuilder << "RicNewWorkflowJobFeature"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RimWorkflow::loadFromDirectory( QString* errorMessage ) { m_jobs.deleteChildren(); @@ -213,6 +243,9 @@ bool RimWorkflow::loadFromDirectory( QString* errorMessage ) return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflow::findPythonExecutable() { QStringList candidates; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowArrayBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowArrayBinding.cpp index a9b4c2a186..ce8f108571 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowArrayBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowArrayBinding.cpp @@ -24,11 +24,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowArrayBinding, "WorkflowArrayBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowArrayBinding::RimWorkflowArrayBinding() { CAF_PDM_InitFieldNoDefault( &m_value, "Value", "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowArrayBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -38,6 +44,9 @@ void RimWorkflowArrayBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowArrayBinding::toYamlValue() const { return hasValue() ? m_value() : "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowBoolBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowBoolBinding.cpp index 000eb6fa64..a8e6bebbbe 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowBoolBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowBoolBinding.cpp @@ -22,11 +22,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowBoolBinding, "WorkflowBoolBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowBoolBinding::RimWorkflowBoolBinding() { CAF_PDM_InitField( &m_value, "Value", false, "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowBoolBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -36,6 +42,9 @@ void RimWorkflowBoolBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowBoolBinding::toYamlValue() const { if ( !hasValue() ) return "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCaseBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCaseBinding.cpp index 23ae4e49ef..f4436eaa53 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCaseBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCaseBinding.cpp @@ -23,22 +23,34 @@ CAF_PDM_SOURCE_INIT( RimWorkflowCaseBinding, "WorkflowCaseBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowCaseBinding::RimWorkflowCaseBinding() { CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowCaseBinding::displayValue() const { return m_case() ? m_case()->caseUserDescription() : "(not selected)"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowCaseBinding::toYamlValue() const { if ( m_case() == nullptr ) return "null"; return QString( "{__resinsight_ref__: EclipseCase, case_id: %1}" ).arg( m_case()->caseId() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QList RimWorkflowCaseBinding::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCollection.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCollection.cpp index c444c5d188..b9e15c348d 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowCollection.cpp @@ -25,6 +25,9 @@ CAF_PDM_SOURCE_INIT( RimWorkflowCollection, "WorkflowCollection" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowCollection::RimWorkflowCollection() { CAF_PDM_InitObject( "Workflows", ":/Folder.png" ); @@ -35,11 +38,17 @@ RimWorkflowCollection::RimWorkflowCollection() RimWorkflowCollection::~RimWorkflowCollection() = default; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowCollection::discoveryDirectory() { return QDir::homePath() + "/.taskmaestro/workflows"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowCollection::rescanWorkflows() { deleteAllItems(); diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDateBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDateBinding.cpp index 78159ca33d..4c931b0b40 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDateBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDateBinding.cpp @@ -22,11 +22,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowDateBinding, "WorkflowDateBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowDateBinding::RimWorkflowDateBinding() { CAF_PDM_InitField( &m_value, "Value", QDate::currentDate(), "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowDateBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -37,6 +43,9 @@ void RimWorkflowDateBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowDateBinding::toYamlValue() const { return hasValue() ? yamlQuotedScalar( m_value().toString( Qt::ISODate ) ) : "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDescribeTools.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDescribeTools.cpp index 0e0e1ca78c..fa43143831 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDescribeTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowDescribeTools.cpp @@ -25,6 +25,9 @@ namespace { +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QJsonObject resolveRef( const QString& ref, const QJsonObject& rootSchema ) { const QString prefix = "#/$defs/"; @@ -71,6 +74,9 @@ QJsonObject underlyingSchema( QJsonObject schema, const QJsonObject& rootSchema return schema; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool isOpaque( const QJsonObject& schema, const QJsonObject& rootSchema ) { return underlyingSchema( schema, rootSchema ).value( "x-taskmaestro-opaque" ).toBool( false ); @@ -88,6 +94,9 @@ QString objectPythonType( const QJsonObject& typeSchema, const QJsonObject& root return underlyingSchema( valueSchema, rootSchema ).value( "x-taskmaestro-python-type" ).toString(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString jsonType( const QJsonObject& typeSchema ) { const QString type = typeSchema.value( "type" ).toString(); @@ -113,6 +122,9 @@ bool isVec3Schema( const QJsonObject& typeSchema ) return true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QJsonObject configFieldSchema( const QString& fieldName, const QJsonObject& inputSchema, const QStringList& requiredFields, @@ -154,6 +166,9 @@ QJsonObject configFieldSchema( const QString& fieldName, return entry; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void appendEdge( QJsonArray& edges, const QJsonObject& ref, const QString& to, const QString& input ) { const QString from = ref.value( "task" ).toString(); @@ -166,6 +181,9 @@ void appendEdge( QJsonArray& edges, const QJsonObject& ref, const QString& to, c edges.append( edge ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void appendDependencyEdges( QJsonArray& edges, const QString& taskName, const QJsonValue& dependsOn ) { const QJsonObject deps = dependsOn.toObject(); @@ -201,6 +219,9 @@ void appendDependencyEdges( QJsonArray& edges, const QString& taskName, const QJ } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QJsonObject taskFromDescribe( const QJsonObject& task ) { const QJsonObject inputSchema = task.value( "input_schema" ).toObject(); diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFieldBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFieldBinding.cpp index af0f711fc3..3323e24def 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFieldBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFieldBinding.cpp @@ -29,6 +29,9 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimWorkflowFieldBinding, "WorkflowFieldBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowFieldBinding::RimWorkflowFieldBinding() { CAF_PDM_InitObject( "Field", ":/Bullet.png" ); @@ -46,27 +49,42 @@ RimWorkflowFieldBinding::RimWorkflowFieldBinding() m_hasValue.uiCapability()->setUiHidden( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowFieldBinding::fieldName() const { return m_fieldName(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFieldBinding::setFieldName( const QString& name ) { m_fieldName = name; setUiName( name ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFieldBinding::setDescription( const QString& description ) { m_description = description; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFieldBinding::setRequired( bool required ) { m_required = required; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowFieldBinding::displayValue() const { if ( !hasValue() ) return "(not set)"; @@ -80,6 +98,9 @@ QString RimWorkflowFieldBinding::displayValue() const return text.isEmpty() ? "(not set)" : text; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFieldBinding::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { if ( changedField == valueField() ) @@ -89,17 +110,26 @@ void RimWorkflowFieldBinding::fieldChangedByUi( const caf::PdmFieldHandle* chang } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RimWorkflowFieldBinding::hasValue() const { return m_hasValue(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowFieldBinding::yamlQuotedScalar( const QString& value ) { const QByteArray encoded = QJsonDocument( QJsonArray{ value } ).toJson( QJsonDocument::Compact ); return QString::fromUtf8( encoded.mid( 1, encoded.size() - 2 ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFieldBinding::applySchema( const QJsonObject& fieldSchema ) { setFieldName( fieldSchema.value( "name" ).toString() ); diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFilePathBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFilePathBinding.cpp index b502628130..f514edbb2f 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFilePathBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFilePathBinding.cpp @@ -24,6 +24,9 @@ CAF_PDM_SOURCE_INIT( RimWorkflowFilePathBinding, "WorkflowFilePathBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowFilePathBinding::RimWorkflowFilePathBinding() : m_selectDirectory( false ) { @@ -31,6 +34,9 @@ RimWorkflowFilePathBinding::RimWorkflowFilePathBinding() m_value.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFilePathBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -44,6 +50,9 @@ void RimWorkflowFilePathBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowFilePathBinding::displayValue() const { if ( !hasValue() ) return "(not set)"; @@ -52,11 +61,17 @@ QString RimWorkflowFilePathBinding::displayValue() const return path.isEmpty() ? "(not set)" : path; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowFilePathBinding::toYamlValue() const { return hasValue() ? yamlQuotedScalar( m_value().path() ) : "null"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFilePathBinding::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) { if ( field == &m_value ) diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFloatBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFloatBinding.cpp index 6e19777aeb..9ff20dd025 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFloatBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowFloatBinding.cpp @@ -22,11 +22,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowFloatBinding, "WorkflowFloatBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowFloatBinding::RimWorkflowFloatBinding() { CAF_PDM_InitField( &m_value, "Value", 0.0, "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowFloatBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -36,6 +42,9 @@ void RimWorkflowFloatBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowFloatBinding::toYamlValue() const { return hasValue() ? QString::number( m_value(), 'g', 17 ) : "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowIntBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowIntBinding.cpp index 8734d36b5b..01c19c39f1 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowIntBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowIntBinding.cpp @@ -22,11 +22,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowIntBinding, "WorkflowIntBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowIntBinding::RimWorkflowIntBinding() { CAF_PDM_InitField( &m_value, "Value", 0, "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowIntBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -36,6 +42,9 @@ void RimWorkflowIntBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowIntBinding::toYamlValue() const { return hasValue() ? QString::number( m_value() ) : "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowJob.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowJob.cpp index be21077ddc..5822f74217 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowJob.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowJob.cpp @@ -41,6 +41,9 @@ CAF_PDM_SOURCE_INIT( RimWorkflowJob, "WorkflowJob" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowJob::RimWorkflowJob() { CAF_PDM_InitObject( "Job", ":/Bullet.png" ); @@ -50,22 +53,34 @@ RimWorkflowJob::RimWorkflowJob() CAF_PDM_InitFieldNoDefault( &m_taskInputs, "TaskInputs", "" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowJob::~RimWorkflowJob() { cancelJob(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::setJobName( const QString& name ) { m_name = name; setUiName( name ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::initAfterRead() { setUiName( m_name() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { uiOrdering.add( &m_name ); @@ -82,11 +97,17 @@ void RimWorkflowJob::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering.skipRemainingFields( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) { uiTreeOrdering.skipRemainingChildren( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- std::vector RimWorkflowJob::taskInputs() const { std::vector result; @@ -98,6 +119,9 @@ std::vector RimWorkflowJob::taskInputs() const return result; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::setTaskInputs( std::vector inputs ) { m_taskInputs.deleteChildren(); @@ -107,6 +131,9 @@ void RimWorkflowJob::setTaskInputs( std::vector inputs ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) { if ( changedField == &m_name ) @@ -116,32 +143,50 @@ void RimWorkflowJob::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const { menuBuilder << "RicRunWorkflowJobFeature"; menuBuilder << "RicCancelWorkflowJobFeature"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RimWorkflowJob::isRunning() const { return m_runner && m_runner->isRunning(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QMap RimWorkflowJob::taskStates() const { return m_taskStates; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QMap RimWorkflowJob::taskErrors() const { return m_taskErrors; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowJob::runStatus() const { return m_runStatus; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::updateTaskState( const QString& runId, const QString& taskName, const QString& state, const QString& error ) { if ( runId != m_runId || ( state != "running" && state != "completed" && state != "failed" ) ) return; @@ -164,6 +209,9 @@ void RimWorkflowJob::updateTaskState( const QString& runId, const QString& taskN if ( auto* window = RiuMainWindow::instance() ) window->workflowJobStateChanged( this ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::finishRun( const QString& runId, bool succeeded, bool cancelled ) { if ( runId != m_runId ) return; @@ -185,11 +233,17 @@ void RimWorkflowJob::finishRun( const QString& runId, bool succeeded, bool cance if ( auto* window = RiuMainWindow::instance() ) window->workflowJobStateChanged( this ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::cancelJob() { if ( m_runner ) m_runner->cancel(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowJob::writeInputYaml( const QString& path ) const { QString body; @@ -205,6 +259,9 @@ QString RimWorkflowJob::writeInputYaml( const QString& path ) const return path; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowJob::runJob() { if ( isRunning() ) diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowStringBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowStringBinding.cpp index 53ec223ecb..fe1d742291 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowStringBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowStringBinding.cpp @@ -22,11 +22,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowStringBinding, "WorkflowStringBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowStringBinding::RimWorkflowStringBinding() { CAF_PDM_InitFieldNoDefault( &m_value, "Value", "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowStringBinding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -36,6 +42,9 @@ void RimWorkflowStringBinding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowStringBinding::toYamlValue() const { return hasValue() ? yamlQuotedScalar( m_value() ) : "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowTaskInput.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowTaskInput.cpp index 04b458154b..9935bbfae8 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowTaskInput.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowTaskInput.cpp @@ -40,6 +40,9 @@ CAF_PDM_SOURCE_INIT( RimWorkflowTaskInput, "WorkflowTaskInput" ); namespace { +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowFieldBinding* createBinding( const QJsonObject& schema ) { const QString resinsightType = schema.value( "resinsight_type" ).toString(); @@ -61,6 +64,9 @@ RimWorkflowFieldBinding* createBinding( const QJsonObject& schema ) } } // namespace +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowTaskInput::RimWorkflowTaskInput() { CAF_PDM_InitObject( "Task", ":/Bullet.png" ); @@ -70,17 +76,26 @@ RimWorkflowTaskInput::RimWorkflowTaskInput() m_taskName.uiCapability()->setUiReadOnly( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowTaskInput::taskName() const { return m_taskName(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowTaskInput::setTaskName( const QString& name ) { m_taskName = name; setUiName( name ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowTaskInput::buildFromSchema( const QJsonArray& configFields ) { deleteAllItems(); @@ -93,6 +108,9 @@ void RimWorkflowTaskInput::buildFromSchema( const QJsonArray& configFields ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowTaskInput::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { for ( RimWorkflowFieldBinding* b : items() ) @@ -102,11 +120,17 @@ void RimWorkflowTaskInput::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd uiOrdering.skipRemainingFields( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowTaskInput::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) { uiTreeOrdering.skipRemainingChildren( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowTaskInput::toTaskYamlBlock() const { QString out = m_taskName() + ":\n"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowVec3Binding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowVec3Binding.cpp index a5dd903765..6ececb91aa 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowVec3Binding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowVec3Binding.cpp @@ -22,11 +22,17 @@ CAF_PDM_SOURCE_INIT( RimWorkflowVec3Binding, "WorkflowVec3Binding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowVec3Binding::RimWorkflowVec3Binding() { CAF_PDM_InitField( &m_value, "Value", cvf::Vec3d::ZERO, "Value" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RimWorkflowVec3Binding::applySchema( const QJsonObject& fieldSchema ) { RimWorkflowFieldBinding::applySchema( fieldSchema ); @@ -41,6 +47,9 @@ void RimWorkflowVec3Binding::applySchema( const QJsonObject& fieldSchema ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowVec3Binding::toYamlValue() const { if ( !hasValue() ) return "null"; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowViewBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowViewBinding.cpp index 193d1201ff..79604480bc 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowViewBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowViewBinding.cpp @@ -25,22 +25,34 @@ CAF_PDM_SOURCE_INIT( RimWorkflowViewBinding, "WorkflowViewBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowViewBinding::RimWorkflowViewBinding() { CAF_PDM_InitFieldNoDefault( &m_view, "View", "View" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowViewBinding::displayValue() const { return m_view() ? m_view()->name() : "(not selected)"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowViewBinding::toYamlValue() const { if ( m_view() == nullptr ) return "null"; return QString( "{__resinsight_ref__: View, view_id: %1}" ).arg( m_view()->id() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QList RimWorkflowViewBinding::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowWellPathBinding.cpp b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowWellPathBinding.cpp index ccacf0a723..39d667645f 100644 --- a/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowWellPathBinding.cpp +++ b/ApplicationLibCode/ProjectDataModel/Workflow/RimWorkflowWellPathBinding.cpp @@ -23,16 +23,25 @@ CAF_PDM_SOURCE_INIT( RimWorkflowWellPathBinding, "WorkflowWellPathBinding" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimWorkflowWellPathBinding::RimWorkflowWellPathBinding() { CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowWellPathBinding::displayValue() const { return m_wellPath() ? m_wellPath()->name() : "(not selected)"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString RimWorkflowWellPathBinding::toYamlValue() const { if ( m_wellPath() == nullptr ) return "null"; @@ -40,6 +49,9 @@ QString RimWorkflowWellPathBinding::toYamlValue() const return QString( "{__resinsight_ref__: WellPath, well_path_name: %1}" ).arg( name ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QList RimWorkflowWellPathBinding::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/UnitTests/RimWorkflowDescribeTools-Test.cpp b/ApplicationLibCode/UnitTests/RimWorkflowDescribeTools-Test.cpp index bf0d33bc6c..39be32dbee 100644 --- a/ApplicationLibCode/UnitTests/RimWorkflowDescribeTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RimWorkflowDescribeTools-Test.cpp @@ -10,8 +10,10 @@ namespace { -// Output of `taskmaestro workflow describe workflow.yaml --input input.yaml --json` for a -// synthetic workflow: start -> greet_a, greet_b -> merge (collect), merge <- start.count +//-------------------------------------------------------------------------------------------------- +/// Output of `taskmaestro workflow describe workflow.yaml --input input.yaml --json` for a +/// synthetic workflow: start -> greet_a, greet_b -> merge (collect), merge <- start.count +//-------------------------------------------------------------------------------------------------- QJsonObject describeFixture() { QFile file( QString( "%1/RimWorkflowDescribeTools/describe.json" ).arg( TEST_DATA_DIR ) ); @@ -19,6 +21,9 @@ QJsonObject describeFixture() return QJsonDocument::fromJson( file.readAll() ).object(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QJsonObject taskByName( const QJsonObject& graph, const QString& name ) { for ( const QJsonValue& task : graph.value( "tasks" ).toArray() ) @@ -28,6 +33,9 @@ QJsonObject taskByName( const QJsonObject& graph, const QString& name ) return {}; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QJsonObject fieldByName( const QJsonObject& task, const QString& name ) { for ( const QJsonValue& field : task.value( "config_fields" ).toArray() ) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 2afd0199e8..6c9052e889 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1628,6 +1628,9 @@ void RiuMainWindow::workflowBindingChanged( const RimWorkflowFieldBinding* bindi } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuMainWindow::workflowJobStateChanged( const RimWorkflowJob* job ) { if ( !m_workflowGraphView || m_displayedWorkflowJob.p() != job ) return; @@ -1639,6 +1642,9 @@ void RiuMainWindow::workflowJobStateChanged( const RimWorkflowJob* job ) m_workflowGraphView->setRunStatus( job->runStatus() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuMainWindow::showWorkflowGraph( RimWorkflow* workflow, RimWorkflowJob* job ) { if ( !m_workflowGraphDock ) @@ -1669,6 +1675,9 @@ void RiuMainWindow::showWorkflowGraph( RimWorkflow* workflow, RimWorkflowJob* jo m_workflowGraphDock->setAsCurrentTab(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuMainWindow::slotNewObjectPropertyView() { ads::CDockWidget* dockWidget = diff --git a/ApplicationLibCode/UserInterface/RiuWorkflowGraphView.cpp b/ApplicationLibCode/UserInterface/RiuWorkflowGraphView.cpp index 83a60952b9..995b3864a3 100644 --- a/ApplicationLibCode/UserInterface/RiuWorkflowGraphView.cpp +++ b/ApplicationLibCode/UserInterface/RiuWorkflowGraphView.cpp @@ -48,6 +48,9 @@ constexpr qreal columnStep = 650.0; constexpr qreal configGap = 110.0; constexpr qreal rowGap = 55.0; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QStringList fieldPorts( const QJsonArray& fields ) { QStringList keys; @@ -60,12 +63,18 @@ QStringList fieldPorts( const QJsonArray& fields ) return keys; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString inputPortKey( const QJsonObject& edge ) { const QString field = edge.value( "input" ).toString(); return field.isEmpty() ? "model" : "field:" + field; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString outputPortKey( const QJsonObject& edge ) { const QString field = edge.value( "output" ).toString(); @@ -118,6 +127,9 @@ private: QGraphicsPolygonItem* m_arrow; }; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- GraphNode::GraphNode( const QString& name, QStringList inputs, QStringList outputs, bool isConfig ) : m_name( name ) , m_isConfig( isConfig ) @@ -155,11 +167,17 @@ GraphNode::GraphNode( const QString& name, QStringList inputs, QStringList outpu addPorts( outputs, true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- qreal GraphNode::height() const { return rect().height(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void GraphNode::addPorts( const QStringList& keys, bool output ) { auto& ports = output ? m_outputs : m_inputs; @@ -188,6 +206,9 @@ void GraphNode::addPorts( const QStringList& keys, bool output ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QPointF GraphNode::portPosition( const QString& key, bool output ) const { const auto& ports = output ? m_outputs : m_inputs; @@ -195,21 +216,33 @@ QPointF GraphNode::portPosition( const QString& key, bool output ) const return port ? port->mapToScene( port->rect().center() ) : scenePos(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void GraphNode::addEdge( GraphEdge* edge ) { m_edges.push_back( edge ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QString GraphNode::name() const { return m_name; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool GraphNode::isConfig() const { return m_isConfig; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void GraphNode::setTaskState( const QString& state, const QString& error ) { if ( m_isConfig ) return; @@ -243,6 +276,9 @@ void GraphNode::setTaskState( const QString& state, const QString& error ) setToolTip( error.isEmpty() ? m_name : m_name + "\n" + error ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void GraphNode::setConfigValue( const QString& fieldName, const QString& value ) { if ( !m_isConfig ) return; @@ -266,6 +302,9 @@ void GraphNode::setConfigValue( const QString& fieldName, const QString& value ) text->setToolTip( fieldName + ": " + value ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- QVariant GraphNode::itemChange( GraphicsItemChange change, const QVariant& value ) { if ( change == ItemPositionHasChanged ) @@ -277,6 +316,9 @@ QVariant GraphNode::itemChange( GraphicsItemChange change, const QVariant& value return QGraphicsRectItem::itemChange( change, value ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- GraphEdge::GraphEdge( GraphNode* from, QString outputKey, GraphNode* to, QString inputKey, bool isConfig ) : m_from( from ) , m_to( to ) @@ -295,6 +337,9 @@ GraphEdge::GraphEdge( GraphNode* from, QString outputKey, GraphNode* to, QString updatePath(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void GraphEdge::updatePath() { const QPointF start = m_from->portPosition( m_outputKey, true ); @@ -307,6 +352,9 @@ void GraphEdge::updatePath() } } // namespace +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RiuWorkflowGraphView::RiuWorkflowGraphView( QWidget* parent ) : QGraphicsView( parent ) , m_scene( new QGraphicsScene( this ) ) @@ -317,6 +365,9 @@ RiuWorkflowGraphView::RiuWorkflowGraphView( QWidget* parent ) setTransformationAnchor( QGraphicsView::AnchorUnderMouse ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::showGraph( const QJsonObject& graph, const QString& error ) { m_runStatusLabel = nullptr; @@ -467,6 +518,9 @@ void RiuWorkflowGraphView::showGraph( const QJsonObject& graph, const QString& e fitInView( m_scene->sceneRect(), Qt::KeepAspectRatio ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::setTaskInputValue( const QString& taskName, const QString& fieldName, const QString& value ) { for ( QGraphicsItem* item : m_scene->items() ) @@ -480,6 +534,9 @@ void RiuWorkflowGraphView::setTaskInputValue( const QString& taskName, const QSt } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::resetTaskStates() { for ( QGraphicsItem* item : m_scene->items() ) @@ -488,6 +545,9 @@ void RiuWorkflowGraphView::resetTaskStates() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::setTaskState( const QString& taskName, const QString& state, const QString& error ) { for ( QGraphicsItem* item : m_scene->items() ) @@ -501,6 +561,9 @@ void RiuWorkflowGraphView::setTaskState( const QString& taskName, const QString& } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::setRunStatus( const QString& status ) { if ( !m_runStatusLabel ) return; @@ -508,18 +571,27 @@ void RiuWorkflowGraphView::setRunStatus( const QString& status ) m_runStatusLabel->setToolTip( status ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::resizeEvent( QResizeEvent* event ) { QGraphicsView::resizeEvent( event ); if ( m_fitOnResize && !m_scene->sceneRect().isEmpty() ) fitInView( m_scene->sceneRect(), Qt::KeepAspectRatio ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::mousePressEvent( QMouseEvent* event ) { if ( event->button() == Qt::LeftButton ) m_fitOnResize = false; QGraphicsView::mousePressEvent( event ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowGraphView::wheelEvent( QWheelEvent* event ) { if ( event->modifiers() & Qt::ControlModifier ) diff --git a/ApplicationLibCode/UserInterface/RiuWorkflowJobRunner.cpp b/ApplicationLibCode/UserInterface/RiuWorkflowJobRunner.cpp index 4a777eebe2..15fddbf32d 100644 --- a/ApplicationLibCode/UserInterface/RiuWorkflowJobRunner.cpp +++ b/ApplicationLibCode/UserInterface/RiuWorkflowJobRunner.cpp @@ -30,6 +30,9 @@ namespace constexpr char PROGRESS_PREFIX[] = "@@RI_WORKFLOW_EVENT@@"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RiuWorkflowJobRunner::RiuWorkflowJobRunner( const QString& label, QObject* parent ) : QObject( parent ) , m_label( label ) @@ -40,6 +43,9 @@ RiuWorkflowJobRunner::RiuWorkflowJobRunner( const QString& label, QObject* paren connect( &m_process, &QProcess::errorOccurred, this, &RiuWorkflowJobRunner::onProcessError ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::start( const QString& program, const QStringList& arguments, const QProcessEnvironment& env ) { RiaLogging::info( QString( "Running %1" ).arg( m_label ).toStdString() ); @@ -48,6 +54,9 @@ void RiuWorkflowJobRunner::start( const QString& program, const QStringList& arg m_process.start( program, arguments ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::cancel() { if ( m_process.state() == QProcess::NotRunning ) return; @@ -56,23 +65,35 @@ void RiuWorkflowJobRunner::cancel() if ( !m_process.waitForFinished( 2000 ) ) m_process.kill(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RiuWorkflowJobRunner::isRunning() const { return m_process.state() != QProcess::NotRunning; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::onReadyReadStdout() { m_stdoutBuf.append( m_process.readAllStandardOutput() ); drainLines( m_stdoutBuf, RILogLevel::RI_LL_INFO ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::onReadyReadStderr() { m_stderrBuf.append( m_process.readAllStandardError() ); drainLines( m_stderrBuf, RILogLevel::RI_LL_WARNING ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::onProcessFinished( int exitCode, QProcess::ExitStatus status ) { m_stdoutBuf.append( m_process.readAllStandardOutput() ); @@ -108,6 +129,9 @@ void RiuWorkflowJobRunner::onProcessFinished( int exitCode, QProcess::ExitStatus deleteLater(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::onProcessError( QProcess::ProcessError error ) { if ( error != QProcess::FailedToStart || m_finishedEmitted ) return; @@ -117,6 +141,9 @@ void RiuWorkflowJobRunner::onProcessError( QProcess::ProcessError error ) deleteLater(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RiuWorkflowJobRunner::drainLines( QByteArray& buffer, RILogLevel level ) { int nl;