QtPdWidgets  2.3.3
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 
46  /* The following three properties shall contain paths to SVG ressources.
47  * Other image formats are not supported.
48  */
49  Q_PROPERTY(QString background
50  READ getBackground WRITE setBackground RESET resetBackground)
51  Q_PROPERTY(QString rotor
52  READ getRotor WRITE setRotor RESET resetRotor)
53  Q_PROPERTY(QString foreground
54  READ getForeground WRITE setForeground RESET resetForeground)
55 
56  Q_PROPERTY(QPointF rotorCenter
57  READ getRotorCenter WRITE setRotorCenter RESET resetRotorCenter)
58  Q_PROPERTY(double globalAngle
59  READ getGlobalAngle WRITE setGlobalAngle RESET resetGlobalAngle)
60 
61  public:
62  Rotor(QWidget * = 0);
63  ~Rotor();
64 
65  QSize sizeHint() const;
66 
67  QString getBackground() const;
68  void setBackground(const QString &);
69  void resetBackground();
70 
71  QString getRotor() const;
72  void setRotor(const QString &);
73  void resetRotor();
74 
75  QString getForeground() const;
76  void setForeground(const QString &);
77  void resetForeground();
78 
79  QPointF getRotorCenter() const;
80  void setRotorCenter(QPointF);
81  void resetRotorCenter();
82 
83  double getGlobalAngle() const;
84  void setGlobalAngle(double);
85  void resetGlobalAngle();
86 
89  void setSpeedVariable(
90  PdCom::Variable pv,
91  const PdCom::Selector &selector = {},
92  const QtPdCom::Transmission & = QtPdCom::event_mode,
93  double scale = 1.0,
94  double offset = 0.0,
95  double tau = 0.0
98  );
99 
100  void setSpeedVariable(
101  PdCom::Process *process,
102  const QString &path,
103  const PdCom::Selector &selector = {},
104  const QtPdCom::Transmission & = QtPdCom::event_mode,
105  double scale = 1.0,
106  double offset = 0.0,
107  double tau = 0.0
110  );
111 
112  void clearSpeedVariable();
113 
114  private:
115  struct PD_PRIVATE Impl;
116  std::unique_ptr<Impl> impl;
117 
118  PD_PRIVATE bool event(QEvent *) override;
119  PD_PRIVATE void resizeEvent(QResizeEvent *) override;
120  PD_PRIVATE void paintEvent(QPaintEvent *) override;
121 
122  private slots:
123  PD_PRIVATE void timeout();
124 };
125 
126 } // namespace
127 
128 /****************************************************************************/
129 
130 #endif
Definition: Bar.h:36
std::unique_ptr< Impl > impl
Definition: Rotor.h:116
Definition: Rotor.h:41
#define PD_PRIVATE
Definition: Export.h:28
#define PD_PUBLIC
Definition: Export.h:33
Definition: Rotor.cpp:43