QtPdWidgets  2.3.1
Rotor.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009 - 2019 Florian Pose <fp@igh.de>
4  *
5  * This file is part of the QtPdWidgets library.
6  *
7  * The QtPdWidgets library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The QtPdWidgets library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdWidgets Library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef PD_ROTOR_H
24 #define PD_ROTOR_H
25 
26 #include <QtPdCom1/Transmission.h>
27 
28 #include <pdcom5/Variable.h>
29 #include <pdcom5/Subscription.h>
30 
31 #include "Export.h"
32 
33 #include <QFrame>
34 
35 #include <memory>
36 
37 namespace Pd {
38 
39 /****************************************************************************/
40 
42  public QFrame
43 {
44  Q_OBJECT
45  Q_PROPERTY(QString background
46  READ getBackground WRITE setBackground RESET resetBackground)
47  Q_PROPERTY(QString rotor
48  READ getRotor WRITE setRotor RESET resetRotor)
49  Q_PROPERTY(QString foreground
50  READ getForeground WRITE setForeground RESET resetForeground)
51  Q_PROPERTY(QPointF rotorCenter
52  READ getRotorCenter WRITE setRotorCenter RESET resetRotorCenter)
53  Q_PROPERTY(double globalAngle
54  READ getGlobalAngle WRITE setGlobalAngle RESET resetGlobalAngle)
55 
56  public:
57  Rotor(QWidget * = 0);
58  ~Rotor();
59 
60  QSize sizeHint() const;
61 
62  QString getBackground() const;
63  void setBackground(const QString &);
64  void resetBackground();
65 
66  QString getRotor() const;
67  void setRotor(const QString &);
68  void resetRotor();
69 
70  QString getForeground() const;
71  void setForeground(const QString &);
72  void resetForeground();
73 
74  QPointF getRotorCenter() const;
75  void setRotorCenter(QPointF);
76  void resetRotorCenter();
77 
78  double getGlobalAngle() const;
79  void setGlobalAngle(double);
80  void resetGlobalAngle();
81 
84  void setSpeedVariable(
85  PdCom::Variable pv,
86  const PdCom::Selector &selector = {},
87  const QtPdCom::Transmission & = QtPdCom::event_mode,
88  double scale = 1.0,
89  double offset = 0.0,
90  double tau = 0.0
93  );
94 
95  void setSpeedVariable(
96  PdCom::Process *process,
97  const QString &path,
98  const PdCom::Selector &selector = {},
99  const QtPdCom::Transmission & = QtPdCom::event_mode,
100  double scale = 1.0,
101  double offset = 0.0,
102  double tau = 0.0
105  );
106 
107  void clearSpeedVariable();
108 
109  private:
110  struct PD_PRIVATE Impl;
111  std::unique_ptr<Impl> impl;
112 
113  PD_PRIVATE bool event(QEvent *) override;
114  PD_PRIVATE void resizeEvent(QResizeEvent *) override;
115  PD_PRIVATE void paintEvent(QPaintEvent *) override;
116 
117  private slots:
118  PD_PRIVATE void timeout();
119 };
120 
121 } // namespace
122 
123 /****************************************************************************/
124 
125 #endif
Definition: Bar.h:36
std::unique_ptr< Impl > impl
Definition: Rotor.h:111
Definition: Rotor.h:41
#define PD_PRIVATE
Definition: Export.h:28
#define PD_PUBLIC
Definition: Export.h:33
Definition: Rotor.cpp:43