This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/native/native_bridge.cpp

24 lines
978 B
C++
Raw Normal View History

2019-12-13 17:45:27 +08:00
#include "context_manager.h"
#include "native_bridge.h"
2019-12-14 18:28:04 +08:00
#include "plugin/shader_plugin.h"
2019-12-13 17:45:27 +08:00
Q_INVOKABLE void NativeBridge::function(int contextId, QString module, QString methodName, QString callbackId, QJSValue jsValue) {
qDebug() << "contextId: " + QString::number(contextId) + ", " +
"module: " + module + ", " +
"methodName: " + methodName + ", " +
"callbackId: " + callbackId + ", " +
"arguments: " + jsValue.toString();
2019-12-13 17:48:37 +08:00
Context *context = ContextManager::getInstance()->getContext(contextId);
2019-12-14 18:28:04 +08:00
QString value = context->driver->getRegistry()->acquirePluginInfo(module);
qDebug() << value;
if (value.contains("ShaderPlugin")) {
ShaderPlugin shaderPlugin(context);
2019-12-17 17:05:57 +08:00
QMetaObject::invokeMethod(
&shaderPlugin,
methodName.toStdString().c_str(),
Qt::AutoConnection,
Q_ARG(QJSValue, jsValue));
2019-12-14 18:28:04 +08:00
}
2019-12-13 17:45:27 +08:00
}