Skip to content

Commit abd072d

Browse files
committed
js: give access to transport object, to connect to play(), stop(), etc.
1 parent f7372ed commit abd072d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/plugins/score-plugin-engine/Execution/ExecutionController.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using exec_setup_fun
3030
class SCORE_PLUGIN_ENGINE_EXPORT ExecutionController : public QObject
3131
{
3232
public:
33-
ExecutionController(const score::GUIApplicationContext& ctx);
33+
explicit ExecutionController(const score::GUIApplicationContext& ctx);
3434
~ExecutionController();
3535

3636
TransportInterface& transport() const noexcept;

src/plugins/score-plugin-js/JS/Qml/EditContext.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ class SCORE_PLUGIN_JS_EXPORT EditJsContext : public QObject
294294
void scrub(double z);
295295
W_SLOT(scrub)
296296

297+
QObject* transport();
298+
W_INVOKABLE(transport)
299+
297300
////////////////
298301
/// File API ///
299302
QString readFile(QString path);

src/plugins/score-plugin-js/JS/Qml/EditContext.ossia.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <Engine/ApplicationPlugin.hpp>
88
#include <JS/Qml/EditContext.hpp>
9+
10+
#include <Transport/DocumentPlugin.hpp>
911
namespace JS
1012
{
1113

@@ -90,4 +92,11 @@ void EditJsContext::scrub(double dx)
9092
{
9193
// TODO
9294
}
95+
QObject* EditJsContext::transport()
96+
{
97+
auto doc = ctx();
98+
if(!doc)
99+
return nullptr;
100+
return doc->findPlugin<Transport::DocumentPlugin>();
101+
}
93102
}

0 commit comments

Comments
 (0)