Merge pull request #12126 from vladest/addressbar_close_fix

AddressBar trigger implemented. Fixed warnings on non existing contex…
This commit is contained in:
Seth Alves 2018-01-31 11:26:05 -08:00 committed by GitHub
commit 0df4ae02fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 5 deletions

View file

@ -282,7 +282,7 @@ Menu::Menu() {
// Navigate > Show Address Bar // Navigate > Show Address Bar
addActionToQMenuAndActionHash(navigateMenu, MenuOption::AddressBar, Qt::CTRL | Qt::Key_L, addActionToQMenuAndActionHash(navigateMenu, MenuOption::AddressBar, Qt::CTRL | Qt::Key_L,
dialogsManager.data(), SLOT(showAddressBar())); dialogsManager.data(), SLOT(toggleAddressBar()));
// Navigate > LocationBookmarks related menus -- Note: the LocationBookmarks class adds its own submenus here. // Navigate > LocationBookmarks related menus -- Note: the LocationBookmarks class adds its own submenus here.
auto locationBookmarks = DependencyManager::get<LocationBookmarks>(); auto locationBookmarks = DependencyManager::get<LocationBookmarks>();

View file

@ -22,7 +22,7 @@ class AddressBarDialog : public OffscreenQmlDialog {
Q_PROPERTY(bool backEnabled READ backEnabled NOTIFY backEnabledChanged) Q_PROPERTY(bool backEnabled READ backEnabled NOTIFY backEnabledChanged)
Q_PROPERTY(bool forwardEnabled READ forwardEnabled NOTIFY forwardEnabledChanged) Q_PROPERTY(bool forwardEnabled READ forwardEnabled NOTIFY forwardEnabledChanged)
Q_PROPERTY(bool useFeed READ useFeed WRITE setUseFeed NOTIFY useFeedChanged) Q_PROPERTY(bool useFeed READ useFeed WRITE setUseFeed NOTIFY useFeedChanged)
Q_PROPERTY(QString metaverseServerUrl READ metaverseServerUrl) Q_PROPERTY(QString metaverseServerUrl READ metaverseServerUrl CONSTANT)
public: public:
AddressBarDialog(QQuickItem* parent = nullptr); AddressBarDialog(QQuickItem* parent = nullptr);

View file

@ -58,7 +58,7 @@ void DialogsManager::showAddressBar() {
hmd->openTablet(); hmd->openTablet();
} }
qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID());
emit addressBarShown(true); setAddressBarVisible(true);
} }
void DialogsManager::hideAddressBar() { void DialogsManager::hideAddressBar() {
@ -71,7 +71,7 @@ void DialogsManager::hideAddressBar() {
hmd->closeTablet(); hmd->closeTablet();
} }
qApp->setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); qApp->setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID);
emit addressBarShown(false); setAddressBarVisible(false);
} }
void DialogsManager::showFeed() { void DialogsManager::showFeed() {
@ -157,6 +157,24 @@ void DialogsManager::hmdToolsClosed() {
} }
} }
void DialogsManager::toggleAddressBar() {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
const bool addressBarLoaded = tablet->isPathLoaded(TABLET_ADDRESS_DIALOG);
if (_addressBarVisible || addressBarLoaded) {
hideAddressBar();
} else {
showAddressBar();
}
}
void DialogsManager::setAddressBarVisible(bool addressBarVisible) {
_addressBarVisible = addressBarVisible;
emit addressBarShown(_addressBarVisible);
}
void DialogsManager::showTestingResults() { void DialogsManager::showTestingResults() {
if (!_testingDialog) { if (!_testingDialog) {
_testingDialog = new TestingDialog(qApp->getWindow()); _testingDialog = new TestingDialog(qApp->getWindow());

View file

@ -39,6 +39,7 @@ public:
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; } QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; } QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; }
void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } void emitAddressBarShown(bool visible) { emit addressBarShown(visible); }
void setAddressBarVisible(bool addressBarVisible);
public slots: public slots:
void showAddressBar(); void showAddressBar();
@ -52,6 +53,7 @@ public slots:
void hmdTools(bool showTools); void hmdTools(bool showTools);
void showDomainConnectionDialog(); void showDomainConnectionDialog();
void showTestingResults(); void showTestingResults();
void toggleAddressBar();
// Application Update // Application Update
void showUpdateDialog(); void showUpdateDialog();
@ -78,7 +80,7 @@ private:
QPointer<OctreeStatsDialog> _octreeStatsDialog; QPointer<OctreeStatsDialog> _octreeStatsDialog;
QPointer<TestingDialog> _testingDialog; QPointer<TestingDialog> _testingDialog;
QPointer<DomainConnectionDialog> _domainConnectionDialog; QPointer<DomainConnectionDialog> _domainConnectionDialog;
bool _closeAddressBar { false }; bool _addressBarVisible { false };
}; };
#endif // hifi_DialogsManager_h #endif // hifi_DialogsManager_h

View file

@ -72,6 +72,13 @@ Web3DOverlay::Web3DOverlay() {
connect(this, &Web3DOverlay::requestWebSurface, this, &Web3DOverlay::buildWebSurface); connect(this, &Web3DOverlay::requestWebSurface, this, &Web3DOverlay::buildWebSurface);
connect(this, &Web3DOverlay::releaseWebSurface, this, &Web3DOverlay::destroyWebSurface); connect(this, &Web3DOverlay::releaseWebSurface, this, &Web3DOverlay::destroyWebSurface);
connect(this, &Web3DOverlay::resizeWebSurface, this, &Web3DOverlay::onResizeWebSurface); connect(this, &Web3DOverlay::resizeWebSurface, this, &Web3DOverlay::onResizeWebSurface);
//need to be intialized before Tablet 1st open
_webSurface = DependencyManager::get<OffscreenQmlSurfaceCache>()->acquire(_url);
_webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("Account", GlobalServicesScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
} }
Web3DOverlay::Web3DOverlay(const Web3DOverlay* Web3DOverlay) : Web3DOverlay::Web3DOverlay(const Web3DOverlay* Web3DOverlay) :