Maki
Formally verified low-code orchestration
Loading...
Searching...
No Matches
properties_menu.h
1#pragma once
2
3#include <QFrame>
4#include <memory>
5
6#include "elements/flow.h"
7#include "result.h"
8#include "widgets/frame.h"
9#include "widgets/widget_factory.h"
10
11class QDialog;
12class QLayout;
13class QStandardItemModel;
14class QTableView;
15class TransitionItem;
16
17class FlowSaveInfo;
18class PropertyInfo;
19
28class PropertiesMenu : public QFrame
29{
30 Q_OBJECT
31
32public:
33 explicit PropertiesMenu(QWidget* parent);
34
35 VoidResult start();
36
37 VoidResult onNodeRemoved(const QString& nodeId);
38 VoidResult onNodeSelected(const QString& nodeId, bool selected);
39
40 VoidResult onTransitionSelected(TransitionItem* transition);
41 VoidResult onFlowAdded(const QString& flowId, const QString& nodeId);
42 VoidResult onFlowRemoved(const QString& flowId, const QString& nodeId);
43
44 QLayout* layout() const;
45
46signals:
47 void propertyUpdated(const QString& parameterId, const QString& nodeId, const maki::Value& value);
48 void openParameter(const QString& parameterId);
49 void nodeFocused(const QString& nodeId);
50 void flowSelected(const QString& flowId, const QString& nodeId);
51 void flowCreationRequested(const QString& ownerNodeId);
52
53private:
54 enum TableRole
55 {
56 IdRole = Qt::UserRole,
57 ModifiableRole = Qt::UserRole + 1,
58 };
59
60 QString mCurrentNode;
61 QDialog* mCurrentDialog = nullptr;
62 StyledFrame* mFrame = nullptr;
64
65 VoidResult onNodeModified(const QString& nodeId);
66
67 // Property editors.
68 VoidResult loadProperties(const QString& nodeId);
69 VoidResult loadValueProperty(const std::shared_ptr<IParameter>& property, const QString& nodeId);
70 VoidResult loadColorProperty(const std::shared_ptr<IParameter>& property, const QString& nodeId);
71 VoidResult loadSelectProperty(const std::shared_ptr<IParameter>& property, const QString& nodeId);
72 VoidResult loadLinkProperty(const std::shared_ptr<IParameter>& property, const QString& nodeId);
73 VoidResult loadComponentSelectProperty(const std::shared_ptr<IParameter>& property, const QString& nodeId);
74
75 VoidResult loadCallArguments(const std::shared_ptr<FlowSaveInfo>& call, const QString& propertyId, const QString& nodeId, maki::WidgetGroup* group);
76
77 void addCompleter(maki::InputWidget* editor, const QString& nodeId, const koda::types::TypeReference& type);
78
79 // Controls for dynamically defined fields/events.
80 VoidResult loadControls(const QString& nodeId);
81 Result<QTableWidget*> loadEventTable(const QString& nodeId, std::shared_ptr<NodeConfig> nodeConfig);
82 VoidResult loadControlAddEvent(QTableWidget* table, const QString& nodeId);
83
84 void openEventDialog(QTableWidget* table, const QString& nodeId, int row, bool synchronousCreation = false);
85 void addEventToTable(QTableWidget* table, int row, const std::shared_ptr<FlowSaveInfo>& event);
86 void removeEventFromTable(QTableWidget* table, const QString& nodeId);
87
88 void updateBlockName(PNodeSaveInfo nodeInfo, const QString& componentName, const QString& eventName) const;
89
90 std::shared_ptr<FlowSaveInfo> getFlowConfigOfRow(PNodeSaveInfo nodeInfo, QTableWidget* table, int row) const;
91};
Definition event_dispatcher.h:30
Represents the save information for a flow.
Definition flow_info.h:15
Represents a property with configuration and options.
Definition property_info.h:16
Definition frame.h:10
Represents a transition between two nodes in a graphical representation.
Definition transition.h:16
Definition widget_factory.h:203
A labelled container widget that groups widgets in a generic layout.
Definition widget_factory.h:146