Loading...
Searching...
No Matches
AddOnlyProcessToInterval.hpp
1#pragma once
2#include <Scenario/Commands/ScenarioCommandFactory.hpp>
3
4#include <score/command/Command.hpp>
5#include <score/model/Identifier.hpp>
6#include <score/model/path/Path.hpp>
7#include <score/tools/std/Optional.hpp>
8
9#include <ossia/detail/json.hpp>
10
11#include <QPointF>
12
13#include <score_plugin_scenario_export.h>
14struct DataStreamInput;
15struct DataStreamOutput;
16namespace Process
17{
18class ProcessModelFactory;
19class LayerFactory;
20class ProcessModel;
21}
22
23namespace Scenario
24{
25class IntervalModel;
26namespace Command
27{
29class SCORE_PLUGIN_SCENARIO_EXPORT AddOnlyProcessToInterval final : public score::Command
30{
31 SCORE_COMMAND_DECL(CommandFactoryName(), AddOnlyProcessToInterval, "Add a process")
32public:
35 const QString& dat, QPointF pos);
37 const IntervalModel& cst, Id<Process::ProcessModel> idToUse,
38 UuidKey<Process::ProcessModel> process, const QString& dat, QPointF pos);
39
40 void undo(const score::DocumentContext& ctx) const override;
41 void redo(const score::DocumentContext& ctx) const override;
42
43 void undo(IntervalModel&) const;
45
46 const Path<IntervalModel>& intervalPath() const { return m_path; }
47
48 const Id<Process::ProcessModel>& processId() const { return m_createdProcessId; }
49
50 const UuidKey<Process::ProcessModel>& processKey() const { return m_processName; }
51
52protected:
53 void serializeImpl(DataStreamInput& s) const override;
54 void deserializeImpl(DataStreamOutput& s) override;
55
56private:
59 QString m_data;
60 QPointF m_graphpos;
61
62 Id<Process::ProcessModel> m_createdProcessId{};
63};
64
65class SCORE_PLUGIN_SCENARIO_EXPORT LoadOnlyLayerInInterval final : public score::Command
66{
67 SCORE_COMMAND_DECL(CommandFactoryName(), LoadOnlyLayerInInterval, "Load a process")
68public:
70 const IntervalModel& cst, Id<Process::ProcessModel> idToUse,
71 const rapidjson::Value& obj);
72
73 void undo(const score::DocumentContext& ctx) const override;
74 void redo(const score::DocumentContext& ctx) const override;
75
76 void undo(IntervalModel&) const;
78
79 const Path<IntervalModel>& intervalPath() const { return m_path; }
80
81 const Id<Process::ProcessModel>& processId() const { return m_createdProcessId; }
82
83protected:
84 void serializeImpl(DataStreamInput& s) const override;
85 void deserializeImpl(DataStreamOutput& s) override;
86
87private:
89 Id<Process::ProcessModel> m_createdProcessId{};
90 rapidjson::Document m_data;
91};
92
93class SCORE_PLUGIN_SCENARIO_EXPORT DuplicateOnlyProcessToInterval final
94 : public score::Command
95{
96 SCORE_COMMAND_DECL(
97 CommandFactoryName(), DuplicateOnlyProcessToInterval, "Duplicate a process")
98public:
101 const IntervalModel& cst, Id<Process::ProcessModel> idToUse,
102 const Process::ProcessModel&);
103
104 void undo(const score::DocumentContext& ctx) const override;
105 void redo(const score::DocumentContext& ctx) const override;
106
107 void undo(IntervalModel&) const;
109
110 const Path<IntervalModel>& intervalPath() const { return m_path; }
111
112 const Id<Process::ProcessModel>& processId() const { return m_createdProcessId; }
113
114protected:
115 void serializeImpl(DataStreamInput& s) const override;
116 void deserializeImpl(DataStreamOutput& s) override;
117
118private:
119 Path<IntervalModel> m_path;
120 QByteArray m_processData;
121 Id<Process::ProcessModel> m_createdProcessId{};
122};
123}
124}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
The Process class.
Definition score-lib-process/Process/Process.hpp:61
Create a new process in a interval.
Definition AddOnlyProcessToInterval.hpp:30
Definition AddOnlyProcessToInterval.hpp:95
Definition AddOnlyProcessToInterval.hpp:66
Definition IntervalModel.hpp:50
Definition UuidKey.hpp:343
The id_base_t class.
Definition Identifier.hpp:57
The Command class.
Definition Command.hpp:34
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1324
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18