2 #include <Device/Node/DeviceNode.hpp>
4 #include <Explorer/DocumentPlugin/DeviceDocumentPlugin.hpp>
5 #include <Explorer/Explorer/DeviceExplorerModel.hpp>
7 #include <Scenario/Palette/ScenarioPoint.hpp>
8 #include <Scenario/Process/Algorithms/Accessors.hpp>
10 #include <Recording/Record/RecordTools.hpp>
12 #include <score/plugins/Interface.hpp>
13 #include <score/plugins/documentdelegate/DocumentDelegateView.hpp>
15 #include <score/tools/ObjectMatches.hpp>
17 #include <core/document/Document.hpp>
18 #include <core/document/DocumentView.hpp>
20 #include <QApplication>
24 #include <score_plugin_recording_export.h>
34 class DeviceExplorerModel;
42 using clock = std::chrono::steady_clock;
51 firstValueTime = clock::now();
57 return firstValueTime.time_since_epoch() != clock::duration::zero();
60 TimeVal time()
const {
return GetTimeDifference(firstValueTime); }
62 double timeInDouble()
const {
return GetTimeDifferenceInDouble(firstValueTime); }
70 clock::time_point firstValueTime{};
74 void startTimer() W_SIGNAL(startTimer);
79 context.document.view()->viewDelegate().getWidget()->setEnabled(
false);
88 virtual bool setup(
const Box&,
const RecordListening&) = 0;
89 virtual void stop() = 0;
109 bool setup() {
return false; }
115 std::vector<std::unique_ptr<RecordProvider>> m_recorders;
119 template <
typename T>
135 auto recordListening = GetAddressesToRecordRecursive(ctx.explorer);
136 if(recordListening.empty())
140 ctx.explorer.deviceModel().listening().stop();
143 Box box = CreateBox(ctx);
145 if(!recorder.setup(box, recordListening))
147 ctx.explorer.deviceModel().listening().restore();
153 ctx.timer.setTimerType(Qt::PreciseTimer);
154 ctx.timer.setInterval(ReasonableUpdateInterval(recorder.count()));
155 QObject::connect(&ctx.timer, &QTimer::timeout,
this, [&, box]() {
157 auto& cur_date = box.interval.date();
158 box.moveCommand.update(
159 ctx.scenario, {}, box.endEvent,
160 cur_date + GetTimeDifference(ctx.firstValueTime), 0,
true);
162 box.moveCommand.redo(ctx.context);
169 [&]() { ctx.timer.stop(); });
181 ctx.explorer.deviceModel().listening().restore();
182 ctx.dispatcher.commit();
183 ctx.context.document.view()->viewDelegate().getWidget()->setEnabled(
true);
191 SCORE_INTERFACE(
RecorderFactory,
"64999184-a705-4686-b967-14e8f79692f1")
197 virtual std::unique_ptr<RecordProvider>
Definition: DeviceExplorerModel.hpp:67
void identified_object_destroyed(IdentifiedObjectAbstract *o)
Will be called in the IdentifiedObjectAbstract destructor.
Definition: RecordProviderFactory.hpp:190
Definition: RecordProviderFactory.hpp:94
Definition: RecordProviderFactory.hpp:121
The core hierarchical and temporal process of score.
Definition: ScenarioModel.hpp:37
Base class for plug-in interfaces.
Definition: Interface.hpp:52
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: RecordTools.hpp:64
Definition: RecordProviderFactory.hpp:39
Definition: RecordProviderFactory.hpp:86
Definition: ScenarioPoint.hpp:13
Definition: TimeValue.hpp:21
Definition: ObjectMatches.hpp:6
Definition: DocumentContext.hpp:18