OSSIA
Open Scenario System for Interactive Application
qml_autom.hpp
1 #pragma once
4 
5 #include <ossia-qt/device/qml_node_base.hpp>
6 #include <ossia-qt/score/qml_interval.hpp>
7 
8 #include <QEasingCurve>
9 #include <QPointer>
10 #include <QQuickItem>
11 
12 #include <verdigris>
13 
14 namespace ossia
15 {
16 namespace qt
17 {
18 class qml_interval;
19 class qml_process : public QQuickItem
20 {
21  W_OBJECT(qml_process)
22 public:
23  qml_process(QQuickItem* parent = nullptr);
24  ~qml_process() override;
25 
26  qml_interval* interval() const;
27  virtual void setup();
28 
29  virtual std::shared_ptr<ossia::time_process> process() const = 0;
30 
31 protected:
32  void reset();
33  virtual void reset_impl();
34 
35  QPointer<qml_interval> m_cur_parent{};
36 };
37 
38 class qml_breakpoint : public QQuickItem
39 {
40  W_OBJECT(qml_breakpoint)
41 
42 public:
43  using QQuickItem::QQuickItem;
44  std::function<float(double, float, float)> segment();
45 
46  QEasingCurve::Type type() const { return m_type; }
47 
48 public:
49  void typeChanged(QEasingCurve::Type arg_1) E_SIGNAL(OSSIA_EXPORT, typeChanged, arg_1);
50 
51 public:
52  void setType(QEasingCurve::Type t)
53  {
54  if(m_type != t)
55  {
56  m_type = t;
57  typeChanged(t);
58  }
59  };
60  W_SLOT(setType)
61 
62 private:
63  QEasingCurve::Type m_type{QEasingCurve::Linear};
64 
65  W_PROPERTY(QEasingCurve::Type, type READ type WRITE setType NOTIFY typeChanged)
66 };
67 
68 class qml_autom : public qml_process
69 {
70  W_OBJECT(qml_autom)
71 
72 public:
73  qml_autom(QQuickItem* parent = nullptr);
74  ~qml_autom() override;
75  void setup() override;
76 
77  QVariant target() const;
78  double xMin() const;
79  double xMax() const;
80  double yMin() const;
81  double yMax() const;
82  std::shared_ptr<ossia::time_process> process() const override;
83 
84 public:
85  void setTarget(QVariant target);
86  W_SLOT(setTarget);
87  void setXMin(double xMin);
88  W_SLOT(setXMin);
89  void setXMax(double xMax);
90  W_SLOT(setXMax);
91  void setYMin(double yMin);
92  W_SLOT(setYMin);
93  void setYMax(double yMax);
94  W_SLOT(setYMax);
95 
96 public:
97  void targetChanged(QVariant target) E_SIGNAL(OSSIA_EXPORT, targetChanged, target);
98  void xMinChanged(double xMin) E_SIGNAL(OSSIA_EXPORT, xMinChanged, xMin);
99  void xMaxChanged(double xMax) E_SIGNAL(OSSIA_EXPORT, xMaxChanged, xMax);
100  void yMinChanged(double yMin) E_SIGNAL(OSSIA_EXPORT, yMinChanged, yMin);
101  void yMaxChanged(double yMax) E_SIGNAL(OSSIA_EXPORT, yMaxChanged, yMax);
102 
103 private:
104  void reset_impl() override;
105  /*
106  std::shared_ptr<ossia::automation> m_impl;
107  */
108  QVariant m_target;
109  double m_xMin{0.};
110  double m_xMax{1.};
111  double m_yMin{0.};
112  double m_yMax{1.};
113  QMetaObject::Connection m_death;
114 
115  W_PROPERTY(double, yMax READ yMax WRITE setYMax NOTIFY yMaxChanged)
116 
117  W_PROPERTY(double, yMin READ yMin WRITE setYMin NOTIFY yMinChanged)
118 
119  W_PROPERTY(double, xMax READ xMax WRITE setXMax NOTIFY xMaxChanged)
120 
121  W_PROPERTY(double, xMin READ xMin WRITE setXMin NOTIFY xMinChanged)
122 
123  W_PROPERTY(QVariant, target READ target WRITE setTarget NOTIFY targetChanged)
124 };
125 }
126 }
Definition: git_info.h:7