score-plugin-media/Media/Merger/Inspector.hpp
1 #pragma once
2 #include <Process/Inspector/ProcessInspectorWidgetDelegate.hpp>
3 #include <Process/Inspector/ProcessInspectorWidgetDelegateFactory.hpp>
4 
5 #include <Media/Merger/Commands.hpp>
6 #include <Media/Merger/Model.hpp>
7 
8 #include <score/command/Dispatchers/OngoingCommandDispatcher.hpp>
9 #include <score/document/DocumentContext.hpp>
10 #include <score/tools/Bind.hpp>
11 #include <score/widgets/DoubleSlider.hpp>
12 #include <score/widgets/SignalUtils.hpp>
13 
14 #include <QFormLayout>
15 #include <QSpinBox>
16 
17 namespace Media
18 {
19 namespace Merger
20 {
22 {
23 public:
24  explicit InspectorWidget(
25  const Model& obj, const score::DocumentContext& doc, QWidget* parent)
26  : InspectorWidgetDelegate_T{obj, parent}
27  , m_dispatcher{doc.dispatcher}
28  , m_count{this}
29  {
30  m_count.setRange(1, 24);
31  m_count.setValue(obj.inCount());
32 
33  auto lay = new QFormLayout{this};
34 
35  con(process(), &Model::inCountChanged, this,
36  [&] { m_count.setValue(obj.inCount()); });
37 
38  con(m_count, &QSpinBox::editingFinished, this, [&]() {
39  m_dispatcher.submit<SetMergeInCount>(obj, m_count.value());
40  m_dispatcher.commit();
41  });
42 
43  lay->addRow(tr("Count"), &m_count);
44  }
45 
46 private:
47  OngoingCommandDispatcher& m_dispatcher;
48 
49  QSpinBox m_count;
50 };
51 class InspectorFactory final
52  : public Process::InspectorWidgetDelegateFactory_T<Model, InspectorWidget>
53 {
54  SCORE_CONCRETE("cb41b8ba-7fe6-47ae-891d-90da8cc145c5")
55 };
56 }
57 }
Definition: score-plugin-media/Media/Merger/Inspector.hpp:53
Definition: score-plugin-media/Media/Merger/Inspector.hpp:22
Definition: score-plugin-media/Media/Merger/Model.hpp:17
Definition: plugins/score-plugin-media/Media/Merger/commands.hpp:13
The OngoingCommandDispatcher class.
Definition: OngoingCommandDispatcher.hpp:27
void submit(Args &&... args)
Definition: OngoingCommandDispatcher.hpp:37
void commit()
Definition: OngoingCommandDispatcher.hpp:61
Definition: ProcessInspectorWidgetDelegate.hpp:13
Definition: ProcessInspectorWidgetDelegateFactory.hpp:53
Definition: DocumentContext.hpp:18