score-plugin-media/Media/Step/View.hpp
1 #pragma once
2 #include <Process/LayerView.hpp>
3 
4 #include <Media/Step/Commands.hpp>
5 
6 #include <score/command/Dispatchers/SingleOngoingCommandDispatcher.hpp>
7 #include <score/graphics/RectItem.hpp>
8 
9 #include <QGraphicsSceneMouseEvent>
10 #include <QPainter>
11 
12 #include <verdigris>
13 
14 namespace Process
15 {
16 struct Context;
17 }
18 namespace Media::Step
19 {
20 class Model;
21 
22 class View final : public Process::LayerView
23 {
24  W_OBJECT(View)
25 public:
26  explicit View(const Model&, QGraphicsItem* parent);
27  ~View();
28 
29  void setBarWidth(double v);
30 
31 public:
32  void change(int arg_1, float arg_2) W_SIGNAL(change, arg_1, arg_2);
33 
34 private:
35  void paint_impl(QPainter* p) const override;
36 
37  void mousePressEvent(QGraphicsSceneMouseEvent* ev) override;
38  void mouseMoveEvent(QGraphicsSceneMouseEvent* ev) override;
39  void mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) override;
40 
41 private:
42  const Model& m_model;
43  double m_barWidth{};
44 };
45 
46 class Item final : public score::EmptyRectItem
47 {
48  W_OBJECT(Item)
49 public:
50  explicit Item(const Model&, const Process::Context& ctx, QGraphicsItem* parent);
51  ~Item();
52 
53  void setBarWidth(double v);
54 
55 public:
56  void change(int arg_1, float arg_2) W_SIGNAL(change, arg_1, arg_2);
57 
58 private:
59  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
60  final override;
61 
62  void mousePressEvent(QGraphicsSceneMouseEvent* ev) override;
63  void mouseMoveEvent(QGraphicsSceneMouseEvent* ev) override;
64  void mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) override;
65 
66 private:
67  const Model& m_model;
69 };
70 
71 void updateSteps(
73  std::size_t num, float v);
74 
75 }
Definition: score-plugin-media/Media/Step/View.hpp:47
Definition: score-plugin-media/Media/Step/Model.hpp:23
Definition: score-plugin-media/Media/Step/View.hpp:23
Definition: LayerView.hpp:21
Definition: RectItem.hpp:64
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Definition: ProcessContext.hpp:12