Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -21,6 +21,17 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <InfoView.h> |
| 22 | 22 | #include "SoundEffect.h" |
| 23 | 23 | |
| 24 | + | |
| 25 | +QScriptValue tabletToScriptValue(QScriptEngine* engine, TabletProxy* const &in) { | |
| 26 | + qDebug() << "------------------- converting tabletProxy to scriptValue <--------------------"; | |
| 27 | + return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater | QScriptEngine::ExcludeChildObjects); | |
| 28 | +} | |
| 29 | + | |
| 30 | +void tabletFromScriptValue(const QScriptValue& value, TabletProxy* &out) { | |
| 31 | + qDebug() << "----------------> value to tabletProxy <----------------"; | |
| 32 | + out = qobject_cast<TabletProxy*>(value.toQObject()); | |
| 33 | +} | |
| 34 | + | |
| 24 | 35 | TabletScriptingInterface::TabletScriptingInterface() { |
| 25 | 36 | qmlRegisterType<SoundEffect>("Hifi", 1, 0, "SoundEffect"); |
| 26 | 37 | } |
| @@ -41,7 +52,7 @@ QObject* TabletScriptingInterface::getSystemToolbarProxy() { · 14 unmodified lines | ||
| 41 | 52 | } |
| 42 | 53 | } |
| 43 | 54 | |
| 44 | −QObject* TabletScriptingInterface::getTablet(const QString& tabletId) { | |
| 55 | +TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) { | |
| 45 | 56 | |
| 46 | 57 | std::lock_guard<std::mutex> guard(_mutex); |
| 47 | 58 | |
| @@ -81,11 +92,6 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm · 33 unmodified lines | ||
| 81 | 92 | |
| 82 | 93 | QQuickWindow* TabletScriptingInterface::getTabletWindow() { |
| 83 | 94 | TabletProxy* tablet = qobject_cast<TabletProxy*>(getTablet("com.highfidelity.interface.tablet.system")); |
| 84 | − | |
| 85 | − if (!tablet) { | |
| 86 | − return nullptr; | |
| 87 | − } | |
| 88 | − | |
| 89 | 95 | QObject* qmlSurface = tablet->getTabletSurface(); |
| 90 | 96 | OffscreenQmlSurface* surface = dynamic_cast<OffscreenQmlSurface*>(qmlSurface); |
| 91 | 97 | |