hurr durr I'm an idiot

This commit is contained in:
HifiExperiments 2021-01-18 18:39:12 -08:00
parent 4bf952260f
commit 3335c040e5

View file

@ -321,8 +321,8 @@ void TabletScriptingInterface::processEvent(const QKeyEvent* event) {
QObject* TabletScriptingInterface::getFlags() { QObject* TabletScriptingInterface::getFlags() {
Q_ASSERT(QThread::currentThread() == qApp->thread()); Q_ASSERT(QThread::currentThread() == qApp->thread());
auto offscreenUi = DependencyManager::get<OffscreenUi>(); auto offscreenUI = DependencyManager::get<OffscreenUi>();
return offscreenUi->getFlags(); return offscreenUI ? offscreenUI->getFlags() : nullptr;
} }
// //
@ -364,8 +364,6 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
_toolbarMode = toolbarMode; _toolbarMode = toolbarMode;
auto offscreenUi = DependencyManager::get<OffscreenUi>();
if (toolbarMode) { if (toolbarMode) {
#if !defined(DISABLE_QML) #if !defined(DISABLE_QML)
closeDialog(); closeDialog();
@ -385,18 +383,21 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml); connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
#endif #endif
} else { } else {
#if !defined(DISABLE_QML)
if (_currentPathLoaded != TABLET_HOME_SOURCE_URL) { if (_currentPathLoaded != TABLET_HOME_SOURCE_URL) {
loadHomeScreen(true); loadHomeScreen(true);
} }
#endif
auto offscreenUI = DependencyManager::get<OffscreenUi>();
if (offscreenUI) {
//check if running scripts window opened and save it for reopen in Tablet //check if running scripts window opened and save it for reopen in Tablet
if (offscreenUi->isVisible("RunningScripts")) { if (offscreenUI->isVisible("RunningScripts")) {
offscreenUi->hide("RunningScripts"); offscreenUI->hide("RunningScripts");
_showRunningScripts = true; _showRunningScripts = true;
} }
offscreenUi->hideDesktopWindows(); offscreenUI->hideDesktopWindows();
}
// destroy desktop window // destroy desktop window
if (_desktopWindow) { if (_desktopWindow) {
_desktopWindow->deleteLater(); _desktopWindow->deleteLater();
@ -579,9 +580,9 @@ void TabletProxy::gotoMenuScreen(const QString& submenu) {
root = _desktopWindow->asQuickItem(); root = _desktopWindow->asQuickItem();
} }
if (root) { auto offscreenUI = DependencyManager::get<OffscreenUi>();
auto offscreenUi = DependencyManager::get<OffscreenUi>(); if (root && offscreenUI) {
QObject* menu = offscreenUi->getRootMenu(); QObject* menu = offscreenUI->getRootMenu();
QMetaObject::invokeMethod(root, "setMenuProperties", Q_ARG(QVariant, QVariant::fromValue(menu)), Q_ARG(const QVariant&, QVariant(submenu))); QMetaObject::invokeMethod(root, "setMenuProperties", Q_ARG(QVariant, QVariant::fromValue(menu)), Q_ARG(const QVariant&, QVariant(submenu)));
QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL))); QMetaObject::invokeMethod(root, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL)));
_state = State::Menu; _state = State::Menu;