diff options
author | be_ <be.0@gmx.com> | 2017-03-14 15:06:22 -0500 |
---|---|---|
committer | be_ <be.0@gmx.com> | 2017-03-14 22:14:15 -0500 |
commit | fe19473324f605d4fa6a3e202f8310cb1b791777 (patch) | |
tree | 85720ac3543a6ca5f8d9730db9b266ff1ffd6287 /src/control/controlobjectscript.h | |
parent | 3eb8844a5e5a789395cd0d72b45040c38521697d (diff) |
cleanup ControllerEngine::connectControl and related code, plus add tests
This fixes a bug in which calling the disconnect() method of
script callback connection objects would disconnect all callbacks connected
to its ControlObject.
Also add debugging messages for connecting and disconnecting callbacks
Diffstat (limited to 'src/control/controlobjectscript.h')
-rw-r--r-- | src/control/controlobjectscript.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/control/controlobjectscript.h b/src/control/controlobjectscript.h index 78c3068a21..5e89a36042 100644 --- a/src/control/controlobjectscript.h +++ b/src/control/controlobjectscript.h @@ -2,7 +2,7 @@ #define CONTROLOBJECTSCRIPT_H #include "controllers/controllerengine.h" - +#include "controllers/controllerdebug.h" #include "control/controlproxy.h" // this is used for communicate with controller scripts @@ -11,12 +11,16 @@ class ControlObjectScript : public ControlProxy { public: explicit ControlObjectScript(const ConfigKey& key, QObject* pParent = nullptr); - void connectScriptFunction( + bool addConnection( const ControllerEngineConnection& conn); - bool disconnectScriptFunction( + bool removeConnection( const ControllerEngineConnection& conn); + inline int countConnections() { + return m_controllerEngineConnections.size(); }; + void disconnectAllConnectionsToFunction(const QScriptValue& function); + // Called from update(); void emitValueChanged() override { emit(trigger(get(), this)); @@ -31,7 +35,7 @@ class ControlObjectScript : public ControlProxy { void slotValueChanged(double v, QObject*); private: - QList<ControllerEngineConnection> m_connectedScriptFunctions; + QList<ControllerEngineConnection> m_controllerEngineConnections; }; #endif // CONTROLOBJECTSCRIPT_H |