From a28becfb1a29a68812cd1cf977eeb29df1906edd Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Jan 2017 09:42:12 -0800 Subject: [PATCH 1/4] close tablet before changing domains --- interface/src/ui/AddressBarDialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/src/ui/AddressBarDialog.cpp b/interface/src/ui/AddressBarDialog.cpp index 25ecfc05c2..88e0b6b847 100644 --- a/interface/src/ui/AddressBarDialog.cpp +++ b/interface/src/ui/AddressBarDialog.cpp @@ -51,6 +51,8 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare void AddressBarDialog::loadAddress(const QString& address, bool fromSuggestions) { qDebug() << "Called LoadAddress with address " << address; if (!address.isEmpty()) { + auto HMD = DependencyManager::get(); + HMD->setShouldShowTablet(false); DependencyManager::get()->handleLookupString(address, fromSuggestions); } } @@ -62,6 +64,8 @@ void AddressBarDialog::loadHome() { if (homeLocation == "") { homeLocation = DEFAULT_HOME_LOCATION; } + auto HMD = DependencyManager::get(); + HMD->setShouldShowTablet(false); DependencyManager::get()->handleLookupString(homeLocation); } From 601a35a9b66796df421f1a48fe1009f9c1b6e3aa Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Jan 2017 15:49:49 -0800 Subject: [PATCH 2/4] try a different way of repairing tablet after a domain change --- interface/src/ui/AddressBarDialog.cpp | 18 +++++++++--------- scripts/system/tablet-ui/tabletUI.js | 7 ++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/interface/src/ui/AddressBarDialog.cpp b/interface/src/ui/AddressBarDialog.cpp index 88e0b6b847..b687bfef88 100644 --- a/interface/src/ui/AddressBarDialog.cpp +++ b/interface/src/ui/AddressBarDialog.cpp @@ -17,7 +17,7 @@ #include "DependencyManager.h" #include "AddressManager.h" #include "DialogsManager.h" -#include "scripting/HMDScriptingInterface.h" +// #include "scripting/HMDScriptingInterface.h" HIFI_QML_DEF(AddressBarDialog) @@ -40,10 +40,10 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare _backEnabled = !(DependencyManager::get()->getBackStack().isEmpty()); _forwardEnabled = !(DependencyManager::get()->getForwardStack().isEmpty()); connect(addressManager.data(), &AddressManager::hostChanged, this, &AddressBarDialog::metaverseServerUrlChanged); - connect(addressManager.data(), &AddressManager::hostChanged, [](){ - auto HMD = DependencyManager::get(); - HMD->setShouldShowTablet(false); - }); + // connect(addressManager.data(), &AddressManager::hostChanged, [](){ + // auto HMD = DependencyManager::get(); + // HMD->setShouldShowTablet(false); + // }); connect(DependencyManager::get().data(), &DialogsManager::setUseFeed, this, &AddressBarDialog::setUseFeed); connect(qApp, &Application::receivedHifiSchemeURL, this, &AddressBarDialog::receivedHifiSchemeURL); } @@ -51,8 +51,8 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare void AddressBarDialog::loadAddress(const QString& address, bool fromSuggestions) { qDebug() << "Called LoadAddress with address " << address; if (!address.isEmpty()) { - auto HMD = DependencyManager::get(); - HMD->setShouldShowTablet(false); + // auto HMD = DependencyManager::get(); + // HMD->setShouldShowTablet(false); DependencyManager::get()->handleLookupString(address, fromSuggestions); } } @@ -64,8 +64,8 @@ void AddressBarDialog::loadHome() { if (homeLocation == "") { homeLocation = DEFAULT_HOME_LOCATION; } - auto HMD = DependencyManager::get(); - HMD->setShouldShowTablet(false); + // auto HMD = DependencyManager::get(); + // HMD->setShouldShowTablet(false); DependencyManager::get()->handleLookupString(homeLocation); } diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index f625b087d5..5db29b2738 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -54,7 +54,12 @@ tablet.updateAudioBar(currentMicLevel); } - if (HMD.showTablet && !tabletShown) { + if (tabletShown && UIWebTablet && Overlays.getOverlayType(UIWebTablet.webOverlayID) != "web3d") { + // when we switch domains, the tablet entity gets destroyed and recreated. this causes + // the overlay to be deleted, but not recreated. repair this situation here: + hideTabletUI(); + showTabletUI(); + } else if (HMD.showTablet && !tabletShown) { showTabletUI(); } else if (!HMD.showTablet && tabletShown) { hideTabletUI(); From ced1b61b70d7aac3191d55cff30860d696e47dd5 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Jan 2017 16:03:22 -0800 Subject: [PATCH 3/4] close rather than attempt to repair the tablet after a domain change --- scripts/system/tablet-ui/tabletUI.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index 5db29b2738..7011aa4cab 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -56,9 +56,10 @@ if (tabletShown && UIWebTablet && Overlays.getOverlayType(UIWebTablet.webOverlayID) != "web3d") { // when we switch domains, the tablet entity gets destroyed and recreated. this causes - // the overlay to be deleted, but not recreated. repair this situation here: + // the overlay to be deleted, but not recreated. If the overlay is deleted for this or any + // other reason, close the tablet. hideTabletUI(); - showTabletUI(); + HMD.closeTablet(); } else if (HMD.showTablet && !tabletShown) { showTabletUI(); } else if (!HMD.showTablet && tabletShown) { From b679d94585aa9e8f2350fc4e1e67cef73abbcbe4 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Jan 2017 16:04:22 -0800 Subject: [PATCH 4/4] remove commented-out code --- interface/src/ui/AddressBarDialog.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/interface/src/ui/AddressBarDialog.cpp b/interface/src/ui/AddressBarDialog.cpp index b687bfef88..ac566d68c7 100644 --- a/interface/src/ui/AddressBarDialog.cpp +++ b/interface/src/ui/AddressBarDialog.cpp @@ -17,7 +17,6 @@ #include "DependencyManager.h" #include "AddressManager.h" #include "DialogsManager.h" -// #include "scripting/HMDScriptingInterface.h" HIFI_QML_DEF(AddressBarDialog) @@ -40,10 +39,6 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare _backEnabled = !(DependencyManager::get()->getBackStack().isEmpty()); _forwardEnabled = !(DependencyManager::get()->getForwardStack().isEmpty()); connect(addressManager.data(), &AddressManager::hostChanged, this, &AddressBarDialog::metaverseServerUrlChanged); - // connect(addressManager.data(), &AddressManager::hostChanged, [](){ - // auto HMD = DependencyManager::get(); - // HMD->setShouldShowTablet(false); - // }); connect(DependencyManager::get().data(), &DialogsManager::setUseFeed, this, &AddressBarDialog::setUseFeed); connect(qApp, &Application::receivedHifiSchemeURL, this, &AddressBarDialog::receivedHifiSchemeURL); } @@ -51,8 +46,6 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare void AddressBarDialog::loadAddress(const QString& address, bool fromSuggestions) { qDebug() << "Called LoadAddress with address " << address; if (!address.isEmpty()) { - // auto HMD = DependencyManager::get(); - // HMD->setShouldShowTablet(false); DependencyManager::get()->handleLookupString(address, fromSuggestions); } } @@ -64,8 +57,6 @@ void AddressBarDialog::loadHome() { if (homeLocation == "") { homeLocation = DEFAULT_HOME_LOCATION; } - // auto HMD = DependencyManager::get(); - // HMD->setShouldShowTablet(false); DependencyManager::get()->handleLookupString(homeLocation); }