History

toolbar work to better support tablet buttons

Anthony J. Thibault committed 9 years ago

Commit 67302cb1 parent ed11eda7 files · +70 −17Browse files

Showing the changes to libraries/script-engine/src/TabletScriptingInterface.cpp (1 of 7 files). Show all

Unified · Split

libraries/script-engine/src/TabletScriptingInterface.cpp+10−1
@@ -188,6 +188,8 @@ void TabletProxy::setToolbarMode(bool toolbarMode) { · 187 unmodified lines
188188 _desktopWindow = tabletRootWindow;
189189 QMetaObject::invokeMethod(quickItem, "setShown", Q_ARG(const QVariant&, QVariant(false)));
190190
191+ QObject::connect(quickItem, SIGNAL(windowClosed()), this, SLOT(desktopWindowClosed()));
192+
191193 QObject::connect(tabletRootWindow, SIGNAL(webEventReceived(QVariant)), this, SIGNAL(webEventReceived(QVariant)));
192194
193195 // forward qml surface events to interface js
@@ -255,6 +257,13 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr · 61 unmodified lines
255257 }
256258 });
257259
260+ if (_toolbarMode) {
261+ // if someone creates the tablet in toolbar mode, make sure to display the home screen on the tablet.
262+ auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
263+ QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()), Qt::DirectConnection);
264+ QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
265+ }
266+
258267 gotoHomeScreen();
259268
260269 QMetaObject::invokeMethod(_qmlTabletRoot, "setUsername", Q_ARG(const QVariant&, QVariant(getUsername())));
@@ -633,7 +642,7 @@ void TabletButtonProxy::editProperties(QVariantMap properties) { · 372 unmodified lines
633642 }
634643
635644 if (_toolbarButtonProxy) {
636− QMetaObject::invokeMethod(_toolbarButtonProxy, "editProperties", Qt::AutoConnection, Q_ARG(QVariant, properties));
645+ QMetaObject::invokeMethod(_toolbarButtonProxy, "editProperties", Qt::AutoConnection, Q_ARG(QVariantMap, properties));
637646 }
638647 }
639648