Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -44,7 +44,7 @@ void TabletScriptingInterface::setQmlTabletRoot(QString tabletId, QQuickItem* qm · 43 unmodified lines | |||
| 44 | 44 | ||
| 45 | static const char* TABLET_SOURCE_URL = "Tablet.qml"; | 45 | static const char* TABLET_SOURCE_URL = "Tablet.qml"; |
| 46 | static const char* WEB_VIEW_SOURCE_URL = "TabletWebView.qml"; | 46 | static const char* WEB_VIEW_SOURCE_URL = "TabletWebView.qml"; |
| 47 | static const char* LOADER_SOURCE_PROPERTY_NAME = "loaderSource"; | 47 | static const char* LOADER_SOURCE_PROPERTY_NAME = "LoaderSource"; |
| 48 | 48 | ||
| 49 | TabletProxy::TabletProxy(QString name) : _name(name) { | 49 | TabletProxy::TabletProxy(QString name) : _name(name) { |
| 50 | ; | 50 | ; |
| @@ -79,6 +79,8 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr · 28 unmodified lines | |||
| 79 | if (_qmlTabletRoot && _qmlOffscreenSurface) { | 79 | if (_qmlTabletRoot && _qmlOffscreenSurface) { |
| 80 | QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant))); | 80 | QObject::connect(_qmlOffscreenSurface, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant))); |
| 81 | gotoHomeScreen(); | 81 | gotoHomeScreen(); |
| 82 | //auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader"); | ||
| 83 | //QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen())); | ||
| 82 | } else { | 84 | } else { |
| 83 | removeButtonsFromHomeScreen(); | 85 | removeButtonsFromHomeScreen(); |
| 84 | } | 86 | } |
| @@ -88,8 +90,10 @@ void TabletProxy::gotoHomeScreen() { · 3 unmodified lines | |||
| 88 | if (_qmlTabletRoot) { | 90 | if (_qmlTabletRoot) { |
| 89 | QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString(); | 91 | QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString(); |
| 90 | if (tabletSource != TABLET_SOURCE_URL) { | 92 | if (tabletSource != TABLET_SOURCE_URL) { |
| 93 | _qmlTabletRoot->setProperty(LOADER_SOURCE_PROPERTY_NAME, TABLET_SOURCE_URL); | ||
| 94 | auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader"); | ||
| 95 | QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen())); | ||
| 91 | QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL))); | 96 | QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL))); |
| 92 | addButtonsToHomeScreen(); | ||
| 93 | } | 97 | } |
| 94 | } | 98 | } |
| 95 | } | 99 | } |
| @@ -99,6 +103,7 @@ void TabletProxy::gotoWebScreen(const QString& url) { · 3 unmodified lines | |||
| 99 | removeButtonsFromHomeScreen(); | 103 | removeButtonsFromHomeScreen(); |
| 100 | QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString(); | 104 | QString tabletSource = _qmlTabletRoot->property(LOADER_SOURCE_PROPERTY_NAME).toString(); |
| 101 | if (tabletSource != WEB_VIEW_SOURCE_URL) { | 105 | if (tabletSource != WEB_VIEW_SOURCE_URL) { |
| 106 | _qmlTabletRoot->setProperty(LOADER_SOURCE_PROPERTY_NAME, WEB_VIEW_SOURCE_URL); | ||
| 102 | QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL))); | 107 | QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(WEB_VIEW_SOURCE_URL))); |
| 103 | // TABLET_UI_HACK: TODO: addEventBridge to tablet.... | 108 | // TABLET_UI_HACK: TODO: addEventBridge to tablet.... |
| 104 | } | 109 | } |
| @@ -168,6 +173,8 @@ void TabletProxy::addButtonsToHomeScreen() { · 63 unmodified lines | |||
| 168 | for (auto& buttonProxy : _tabletButtonProxies) { | 173 | for (auto& buttonProxy : _tabletButtonProxies) { |
| 169 | addButtonProxyToQmlTablet(tablet, buttonProxy.data()); | 174 | addButtonProxyToQmlTablet(tablet, buttonProxy.data()); |
| 170 | } | 175 | } |
| 176 | auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader"); | ||
| 177 | QObject::disconnect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen())); | ||
| 171 | } | 178 | } |
| 172 | 179 | ||
| 173 | void TabletProxy::removeButtonsFromHomeScreen() { | 180 | void TabletProxy::removeButtonsFromHomeScreen() { |