Loading...
Searching...
No Matches
score-plugin-dataflow/Dataflow/PortItem.hpp
1#pragma once
2#include <Process/Dataflow/AddressAccessorEditWidget.hpp>
3#include <Process/Dataflow/PortFactory.hpp>
4#include <Process/Dataflow/PortItem.hpp>
5
6#include <Inspector/InspectorWidgetFactoryInterface.hpp>
7
8#include <score/command/Dispatchers/CommandDispatcher.hpp>
9#include <score/plugins/SerializableHelpers.hpp>
10
11#include <score_plugin_dataflow_export.h>
12namespace Scenario
13{
14class IntervalModel;
15}
16namespace Dataflow
17{
18class CableItem;
19
20class SCORE_PLUGIN_DATAFLOW_EXPORT AutomatablePortItem : public PortItem
21{
22public:
23 using PortItem::PortItem;
24 ~AutomatablePortItem() override;
25
26 void setupMenu(QMenu&, const score::DocumentContext& ctx) override;
27 void on_createAutomation(const score::DocumentContext& m_context);
28 virtual bool on_createAutomation(
29 const Scenario::IntervalModel& parent, std::function<void(score::Command*)> macro,
30 const score::DocumentContext& m_context);
31
32 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
33 void dropEvent(QGraphicsSceneDragDropEvent* event) override;
34};
35
36class SCORE_PLUGIN_DATAFLOW_EXPORT AutomatablePortFactory : public Process::PortFactory
37{
38public:
39 ~AutomatablePortFactory() override = default;
40
41private:
42 Dataflow::PortItem* makePortItem(
43 Process::Inlet& port, const Process::Context& ctx, QGraphicsItem* parent,
44 QObject* context) override;
45
46 Dataflow::PortItem* makePortItem(
47 Process::Outlet& port, const Process::Context& ctx, QGraphicsItem* parent,
48 QObject* context) override;
49};
50
51template <typename Model_T>
53{
54public:
55 ~AutomatablePortFactory_T() override = default;
56
57private:
58 UuidKey<Process::Port> concreteKey() const noexcept override
59 {
61 }
62
63 Model_T* load(const VisitorVariant& vis, QObject* parent) override
64 {
65 return score::deserialize_dyn(vis, [&](auto&& deserializer) {
66 return new Model_T{deserializer, parent};
67 });
68 }
69};
70}
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:53
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:37
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:21
Definition score-lib-process/Process/Dataflow/PortItem.hpp:39
Definition Port.hpp:177
Definition Port.hpp:273
Definition PortFactory.hpp:30
Definition IntervalModel.hpp:50
Definition UuidKey.hpp:343
The Command class.
Definition Command.hpp:34
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Static metadata implementation.
Definition lib/score/tools/Metadata.hpp:36
Definition ProcessContext.hpp:12
The VisitorVariant struct.
Definition VisitorInterface.hpp:26
Definition DocumentContext.hpp:18