blob: 9dbd446ab5f2d1b4248a706ad57c21338432ed63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#ifndef CONTROLOBJECTSCRIPT_H
#define CONTROLOBJECTSCRIPT_H
#include <QVector>
#include "control/controlproxy.h"
#include "controllers/controllerdebug.h"
#include "controllers/engine/scriptconnection.h"
// this is used for communicate with controller scripts
class ControlObjectScript : public ControlProxy {
Q_OBJECT
public:
explicit ControlObjectScript(const ConfigKey& key, QObject* pParent = nullptr);
bool addScriptConnection(const ScriptConnection& conn);
bool removeScriptConnection(const ScriptConnection& conn);
// Required for legacy behavior of ControllerEngine::connectControl
inline int countConnections() {
return m_scriptConnections.size(); };
inline ScriptConnection firstConnection() {
return m_scriptConnections.first(); };
void disconnectAllConnectionsToFunction(const QJSValue& function);
// Called from update();
void emitValueChanged() override {
emit trigger(get(), this);
}
signals:
// It will connect to the slotValueChanged as well
void trigger(double, QObject*);
protected slots:
// Receives the value from the master control by a unique queued connection
void slotValueChanged(double v, QObject*);
private:
QVector<ScriptConnection> m_scriptConnections;
};
#endif // CONTROLOBJECTSCRIPT_H
|