Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
SystemMenu Class Reference

Tree widget used to display and manage flows and nodes in the system view. More...

#include <system_menu.h>

Inheritance diagram for SystemMenu:

Signals

void nodeFocused (const QString &flowId, const QString &nodeId)
 Emitted when a node should be focused in the editor.
void nodeRemoved (const QString &flowId, const QString &nodeId)
 Emitted when a node should be removed.
void flowSelected (const QString &flowId, const QString &nodeId)
 Emitted when a flow is selected.
void flowRemoved (const QString &flowId, const QString &nodeId)
 Emitted when a flow should be removed.
void flowRenamed (const QString &flowId, const QString &nodeId)
 Emitted when a flow should be renamed.

Public Member Functions

 SystemMenu (QWidget *parent)
 Constructs the system menu widget.
VoidResult onNodeAdded (const QString &flowId, NodeItem *node, const Types::LibraryTypes canvasType)
 Handles the addition of a node to a flow.
VoidResult onNodeRemoved (const QString &flowId, const QString &nodeId, const QString &parentId)
 Handles the removal of a node from a flow.
VoidResult onNodeModified (const QString &flowId, NodeItem *node)
 Handles modifications to an existing node.
VoidResult onNodeSelected (const QString &flowId, NodeItem *node, bool selected)
 Handles selection state changes for a node.
VoidResult onFlowAdded (Flow *flow, NodeItem *node)
 Handles the addition of a flow to the menu.
VoidResult onFlowRemoved (const QString &flowId, const QString &nodeId)
 Handles the removal of a flow from the menu.

Private Types

enum  Roles {
  ToplevelRole = 0 , Capabilities , SubTasks , Flows ,
  PipelineRoot , Pipeline , ComponentRole , FlowRole ,
  NodeRole , PipelineRole
}
 Identifies the semantic role of a tree item. More...

Private Slots

void showContextMenu (const QPoint &pos)
 Shows the context menu at the given position.
void onItemClicked (QTreeWidgetItem *item, int)
 Handles clicks on tree items.

Private Member Functions

VoidResult addRootNode (NodeItem *node)
 Adds a root node to the menu.
VoidResult addLeafNode (NodeItem *node)
 Adds a leaf node to the menu.
void populateItem (QTreeWidgetItem *item, const QIcon &icon, const QString &name, const QString &type, const QString &data, const Roles role, const QString &canvas="")
 Populates a tree widget item using data from a node.
QTreeWidgetItem * getItemById (const QString &id) const
 Finds a tree item by its identifier.
QTreeWidgetItem * systemFlows ()
 Returns the root item containing system flows.
QTreeWidgetItem * componentFlows ()
 Returns the root item containing component flows.
void editFlow (QTreeWidgetItem *item)
 Starts editing the given flow item.
void removeFlow (QTreeWidgetItem *item)
 Removes the given flow item.

Detailed Description

Tree widget used to display and manage flows and nodes in the system view.

This widget maintains a hierarchical representation of system-level and component-level flows, along with their nodes. It reacts to node and flow lifecycle events and exposes signals for user interactions such as focusing, selecting, renaming, and removing items.

Member Enumeration Documentation

◆ Roles

enum SystemMenu::Roles
private

Identifies the semantic role of a tree item.

Enumerator
ToplevelRole 

Item represents a top-level category node.

ComponentRole 

Item represents a component category or container.

FlowRole 

Item represents a flow.

NodeRole 

Item represents a node within a flow.

PipelineRole 

Item represents a pipeline.

Constructor & Destructor Documentation

◆ SystemMenu()

SystemMenu::SystemMenu ( QWidget * parent)

Constructs the system menu widget.

Parameters
parentThe parent widget.

Member Function Documentation

◆ addLeafNode()

VoidResult SystemMenu::addLeafNode ( NodeItem * node)
private

Adds a leaf node to the menu.

Parameters
nodeThe node to add.
Returns
A result indicating whether the operation succeeded.

◆ addRootNode()

VoidResult SystemMenu::addRootNode ( NodeItem * node)
private

Adds a root node to the menu.

Parameters
nodeThe node to add.
Returns
A result indicating whether the operation succeeded.

◆ componentFlows()

QTreeWidgetItem * SystemMenu::componentFlows ( )
private

Returns the root item containing component flows.

Returns
The tree item representing the component flows section.

◆ editFlow()

void SystemMenu::editFlow ( QTreeWidgetItem * item)
private

Starts editing the given flow item.

Parameters
itemThe flow item to edit.

◆ flowRemoved

void SystemMenu::flowRemoved ( const QString & flowId,
const QString & nodeId )
signal

Emitted when a flow should be removed.

Parameters
flowIdThe identifier of the flow to remove.
nodeIdThe identifier of the node associated with the flow.

◆ flowRenamed

void SystemMenu::flowRenamed ( const QString & flowId,
const QString & nodeId )
signal

Emitted when a flow should be renamed.

Parameters
flowIdThe identifier of the flow to rename.
nodeIdThe identifier of the node associated with the flow.

◆ flowSelected

void SystemMenu::flowSelected ( const QString & flowId,
const QString & nodeId )
signal

Emitted when a flow is selected.

Parameters
flowIdThe identifier of the selected flow.
nodeIdThe identifier of the node associated with the flow.

◆ getItemById()

QTreeWidgetItem * SystemMenu::getItemById ( const QString & id) const
private

Finds a tree item by its identifier.

Parameters
idThe identifier to search for.
Returns
The matching tree item, or nullptr if none was found.

◆ nodeFocused

void SystemMenu::nodeFocused ( const QString & flowId,
const QString & nodeId )
signal

Emitted when a node should be focused in the editor.

Parameters
flowIdThe identifier of the flow containing the node.
nodeIdThe identifier of the node to focus.

◆ nodeRemoved

void SystemMenu::nodeRemoved ( const QString & flowId,
const QString & nodeId )
signal

Emitted when a node should be removed.

Parameters
flowIdThe identifier of the flow containing the node.
nodeIdThe identifier of the node to remove.

◆ onFlowAdded()

VoidResult SystemMenu::onFlowAdded ( Flow * flow,
NodeItem * node )

Handles the addition of a flow to the menu.

Parameters
flowThe flow that was added.
nodeThe node associated with the flow.
Returns
A result indicating whether the operation succeeded.

◆ onFlowRemoved()

VoidResult SystemMenu::onFlowRemoved ( const QString & flowId,
const QString & nodeId )

Handles the removal of a flow from the menu.

Parameters
flowIdThe identifier of the flow to remove.
nodeIdThe identifier of the node associated with the flow.
Returns
A result indicating whether the operation succeeded.

◆ onItemClicked

void SystemMenu::onItemClicked ( QTreeWidgetItem * item,
int  )
privateslot

Handles clicks on tree items.

Parameters
itemThe item that was clicked.
Theclicked column index.

◆ onNodeAdded()

VoidResult SystemMenu::onNodeAdded ( const QString & flowId,
NodeItem * node,
const Types::LibraryTypes canvasType )

Handles the addition of a node to a flow.

Parameters
flowIdThe identifier of the flow to which the node belongs.
nodeThe node that was added.
Returns
A result indicating whether the operation succeeded.

◆ onNodeModified()

VoidResult SystemMenu::onNodeModified ( const QString & flowId,
NodeItem * node )

Handles modifications to an existing node.

Parameters
flowIdThe identifier of the flow containing the node.
nodeThe modified node.
Returns
A result indicating whether the operation succeeded.

◆ onNodeRemoved()

VoidResult SystemMenu::onNodeRemoved ( const QString & flowId,
const QString & nodeId,
const QString & parentId )

Handles the removal of a node from a flow.

Parameters
flowIdThe identifier of the flow from which the node is removed.
nodeIdThe identifier of the node to remove.
parentIdThe identifier of the parent node, if applicable.
Returns
A result indicating whether the operation succeeded.

◆ onNodeSelected()

VoidResult SystemMenu::onNodeSelected ( const QString & flowId,
NodeItem * node,
bool selected )

Handles selection state changes for a node.

Parameters
flowIdThe identifier of the flow containing the node.
nodeThe node whose selection state changed.
selectedTrue if the node is selected, false otherwise.
Returns
A result indicating whether the operation succeeded.

◆ populateItem()

void SystemMenu::populateItem ( QTreeWidgetItem * item,
const QIcon & icon,
const QString & name,
const QString & type,
const QString & data,
const Roles role,
const QString & canvas = "" )
private

Populates a tree widget item using data from a node.

Parameters
itemThe tree item to populate.
nodeThe source node.

◆ removeFlow()

void SystemMenu::removeFlow ( QTreeWidgetItem * item)
private

Removes the given flow item.

Parameters
itemThe flow item to remove.

◆ showContextMenu

void SystemMenu::showContextMenu ( const QPoint & pos)
privateslot

Shows the context menu at the given position.

Parameters
posThe position where the context menu should appear.

◆ systemFlows()

QTreeWidgetItem * SystemMenu::systemFlows ( )
private

Returns the root item containing system flows.

Returns
The tree item representing the system flows section.

The documentation for this class was generated from the following files:
  • /__w/maki/maki/app/widgets/structure/system_menu.h
  • /__w/maki/maki/app/widgets/structure/system_menu.cpp