Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def enabled_modules(build):
# Keep alphabetized.
'QtConcurrent',
'QtWidgets',
'QtQml',
])
if build.platform_is_windows:
qt_modules.extend([
Expand Down Expand Up @@ -856,7 +857,6 @@ def sources(self, build):

"controllers/controller.cpp",
"controllers/controllerdebug.cpp",
"controllers/controllerengine.cpp",
"controllers/controllerenumerator.cpp",
"controllers/controllerlearningeventfilter.cpp",
"controllers/controllermanager.cpp",
Expand All @@ -872,6 +872,8 @@ def sources(self, build):
"controllers/delegates/midiopcodedelegate.cpp",
"controllers/delegates/midibytedelegate.cpp",
"controllers/delegates/midioptionsdelegate.cpp",
"controllers/engine/controllerengine.cpp",
"controllers/engine/controllerenginejsproxy.cpp",
"controllers/learningutils.cpp",
"controllers/midi/midimessage.cpp",
"controllers/midi/midiutils.cpp",
Expand Down
2 changes: 1 addition & 1 deletion src/control/controlobjectscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void ControlObjectScript::removeScriptConnection(const ScriptConnection& conn) {
}
}

void ControlObjectScript::disconnectAllConnectionsToFunction(const QScriptValue& function) {
void ControlObjectScript::disconnectAllConnectionsToFunction(const QJSValue& function) {
// Make a local copy of m_scriptConnections because items are removed within the loop.
QList<ScriptConnection> connections = m_scriptConnections;
for (const auto& conn: connections) {
Expand Down
4 changes: 2 additions & 2 deletions src/control/controlobjectscript.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CONTROLOBJECTSCRIPT_H
#define CONTROLOBJECTSCRIPT_H

#include "controllers/controllerengine.h"
#include "controllers/engine/controllerengine.h"
#include "controllers/controllerdebug.h"
#include "control/controlproxy.h"

Expand All @@ -20,7 +20,7 @@ class ControlObjectScript : public ControlProxy {
return m_scriptConnections.size(); };
inline ScriptConnection firstConnection() {
return m_scriptConnections.first(); };
void disconnectAllConnectionsToFunction(const QScriptValue& function);
void disconnectAllConnectionsToFunction(const QJSValue& function);

// Called from update();
void emitValueChanged() override {
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <QApplication>
#include <QScriptValue>
#include <QJSValue>

#include "controllers/controller.h"
#include "controllers/controllerdebug.h"
Expand Down Expand Up @@ -136,7 +136,7 @@ void Controller::receive(const QByteArray data, mixxx::Duration timestamp) {
continue;
}
function.append(".incomingData");
QScriptValue incomingData = m_pEngine->wrapFunctionCode(function, 2);
QJSValue incomingData = m_pEngine->wrapFunctionCode(function, 2);
if (!m_pEngine->execute(incomingData, data, timestamp)) {
qWarning() << "Controller: Invalid script function" << function;
}
Expand Down
24 changes: 22 additions & 2 deletions src/controllers/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef CONTROLLER_H
#define CONTROLLER_H

#include "controllers/controllerengine.h"
#include "controllers/engine/controllerengine.h"
#include "controllers/controllervisitor.h"
#include "controllers/controllerpreset.h"
#include "controllers/controllerpresetinfo.h"
Expand Down Expand Up @@ -92,7 +92,7 @@ class Controller : public QObject, ConstControllerPresetVisitor {
protected:
// The length parameter is here for backwards compatibility for when scripts
// were required to specify it.
Q_INVOKABLE void send(QList<int> data, unsigned int length = 0);
void send(QList<int> data, unsigned int length = 0);

// To be called in sub-class' open() functions after opening the device but
// before starting any input polling/processing.
Expand Down Expand Up @@ -162,10 +162,30 @@ class Controller : public QObject, ConstControllerPresetVisitor {
bool m_bLearning;
QTime m_userActivityInhibitTimer;

friend class ControllerJSProxy;
// accesses lots of our stuff, but in the same thread
friend class ControllerManager;
// For testing
friend class ControllerPresetValidationTest;
};

// An object of this class gets exposed to the JS engine, so the methods of this class
// constitute the api that is provided to scripts under "controller" object.
// See comments on ControllerEngineJSProxy.
class ControllerJSProxy: public QObject {
public:
ControllerJSProxy(Controller* m_pController)
: m_pController(m_pController) {
}

// The length parameter is here for backwards compatibility for when scripts
// were required to specify it.
Q_INVOKABLE void send(QList<int> data, unsigned int length = 0) {
m_pController->send(data, length);
}

private:
Controller* m_pController;
};

#endif
Loading