void LoginDialog::showWithSelection() { auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); auto hmd = DependencyManager::get<HMDScriptingInterface>(); if (!qApp->isHMDMode()) { if (qApp->getLoginDialogPoppedUp()) { LoginDialog::show(); return; } else { if (!tablet->isPathLoaded(TABLET_LOGIN_DIALOG_URL)) { tablet->loadQMLSource(TABLET_LOGIN_DIALOG_URL); } } } else { if (!qApp->getLoginDialogPoppedUp()) { tablet->initialScreen(TABLET_LOGIN_DIALOG_URL); } else { qApp->createLoginDialogOverlay(); } } if (!hmd->getShouldShowTablet()) { hmd->openTablet(); } }
void DialogsManager::hideAddressBar() { auto hmd = DependencyManager::get<HMDScriptingInterface>(); auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) { tablet->gotoHomeScreen(); hmd->closeTablet(); } qApp->setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); setAddressBarVisible(false); }
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::showAddressBar() { auto hmd = DependencyManager::get<HMDScriptingInterface>(); auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); if (!tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) { tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); } if (!hmd->getShouldShowTablet()) { hmd->openTablet(); } qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); setAddressBarVisible(true); }
void LoginDialog::showWithSelection() { auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); auto hmd = DependencyManager::get<HMDScriptingInterface>(); if (tablet->getToolbarMode()) { LoginDialog::show(); } else { static const QUrl url("../../dialogs/TabletLoginDialog.qml"); tablet->initialScreen(url); if (!hmd->getShouldShowTablet()) { hmd->openTablet(); } } }
void LoginDialog::openUrl(const QString& url) const { auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); auto hmd = DependencyManager::get<HMDScriptingInterface>(); auto offscreenUi = DependencyManager::get<OffscreenUi>(); if (tablet->getToolbarMode()) { auto browser = offscreenUi->load("Browser.qml"); browser->setProperty("url", url); } else { if (!hmd->getShouldShowTablet() && !qApp->isHMDMode()) { auto browser = offscreenUi->load("Browser.qml"); browser->setProperty("url", url); } else { tablet->gotoWebScreen(url); } } }
void DialogsManager::setDomainConnectionFailureVisibility(bool visible) { auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); if (tablet->getToolbarMode()) { if (visible) { ConnectionFailureDialog::show(); } else { ConnectionFailureDialog::hide(); } } else { static const QUrl url("dialogs/TabletConnectionFailureDialog.qml"); auto hmd = DependencyManager::get<HMDScriptingInterface>(); if (visible) { tablet->initialScreen(url); if (!hmd->getShouldShowTablet()) { hmd->openTablet(); } } } }
void Web3DOverlay::loadSourceURL() { if (!_webSurface) { return; } QUrl sourceUrl(_url); if (sourceUrl.scheme() == "http" || sourceUrl.scheme() == "https" || _url.toLower().endsWith(".htm") || _url.toLower().endsWith(".html")) { _webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/")); _webSurface->load("Web3DOverlay.qml"); _webSurface->resume(); _webSurface->getRootItem()->setProperty("url", _url); _webSurface->getRootItem()->setProperty("scriptURL", _scriptURL); } else { _webSurface->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath())); _webSurface->load(_url, [&](QQmlContext* context, QObject* obj) {}); _webSurface->resume(); _webSurface->getSurfaceContext()->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("Preferences", DependencyManager::get<Preferences>().data()); _webSurface->getSurfaceContext()->setContextProperty("Vec3", new Vec3()); _webSurface->getSurfaceContext()->setContextProperty("Quat", new Quat()); _webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get()); _webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data()); if (_webSurface->getRootItem() && _webSurface->getRootItem()->objectName() == "tabletRoot") { auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); auto flags = tabletScriptingInterface->getFlags(); _webSurface->getSurfaceContext()->setContextProperty("offscreenFlags", flags); _webSurface->getSurfaceContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data()); _webSurface->getSurfaceContext()->setContextProperty("Account", AccountScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("Audio", DependencyManager::get<AudioScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data()); _webSurface->getSurfaceContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("fileDialogHelper", new FileDialogHelper()); _webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get()); _webSurface->getSurfaceContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data()); _webSurface->getSurfaceContext()->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data()); _webSurface->getSurfaceContext()->setContextProperty("LODManager", DependencyManager::get<LODManager>().data()); _webSurface->getSurfaceContext()->setContextProperty("OctreeStats", DependencyManager::get<OctreeStatsProvider>().data()); _webSurface->getSurfaceContext()->setContextProperty("DCModel", DependencyManager::get<DomainConnectionModel>().data()); _webSurface->getSurfaceContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data()); _webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data()); _webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data()); _webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../"); tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface.data()); // mark the TabletProxy object as cpp ownership. QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"); _webSurface->getSurfaceContext()->engine()->setObjectOwnership(tablet, QQmlEngine::CppOwnership); // Override min fps for tablet UI, for silky smooth scrolling setMaxFPS(90); } } _webSurface->getSurfaceContext()->setContextProperty("globalPosition", vec3toVariant(getPosition())); }