diff --git a/interface/resources/qml/LoginDialog.qml b/interface/resources/qml/LoginDialog.qml index a883b2a41a..92cb408a7c 100644 --- a/interface/resources/qml/LoginDialog.qml +++ b/interface/resources/qml/LoginDialog.qml @@ -13,7 +13,6 @@ import QtQuick 2.4 import "qrc:////qml//controls-uit" as HifiControlsUit import "qrc:////qml//styles-uit" as HifiStylesUit -import "windows" as Windows import "LoginDialog" @@ -26,11 +25,16 @@ FocusScope { anchors.fill: parent readonly property bool isTablet: false + readonly property bool isOverlay: false property string iconText: "" property int iconSize: 50 - + property bool keyboardEnabled: false + property bool keyboardRaised: false + property bool punctuationMode: false + property bool isPassword: false property string title: "" + property string text: "" property int titleWidth: 0 function tryDestroy() { diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index 1a380ecdad..43ac0c7cec 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -246,6 +246,11 @@ Item { } Component.onCompleted: { + //but rise Tablet's one instead for Tablet interface + if (root.isTablet || root.isOverlay) { + root.keyboardEnabled = HMD.active; + root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) + } d.resize(); } } diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index 0c59f683e3..44f4ba7439 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -110,57 +110,44 @@ Item { horizontalAlignment: Image.AlignHCenter } } - Item { - id: splashContainer - width: parent.width - anchors.fill: parent - - visible: true - - Text { - id: flavorText - text: qsTr("BE ANYWHERE, WITH ANYONE RIGHT NOW") - width: 0.48 * parent.width - anchors.centerIn: parent - anchors { - top: banner.bottom - topMargin: 0.1 * parent.height - } - wrapMode: Text.WordWrap - lineHeight: 0.5 - color: "white" - font.family: linkAccountBody.fontFamily - font.pixelSize: !root.isTablet ? 2 * linkAccountBody.fontSize : linkAccountBody.fontSize - font.bold: linkAccountBody.fontBold - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - } - - HifiControlsUit.Button { - id: signUpButton - text: qsTr("Sign Up") - width: d.minWidthButton - height: d.minHeightButton - color: hifi.buttons.blue - fontFamily: linkAccountBody.fontFamily - fontSize: linkAccountBody.fontSize - fontBold: linkAccountBody.fontBold - anchors { - bottom: parent.bottom - bottomMargin: 0.1 * parent.height - left: parent.left - leftMargin: (parent.width - d.minWidthButton) / 2 - } - onClicked: { - linkAccountBody.withSteam = false; - toggleSignIn(false); - } + Text { + id: flavorText + text: qsTr("BE ANYWHERE, WITH ANYONE RIGHT NOW") + width: 0.48 * parent.width + anchors.centerIn: parent + anchors { + top: bannerContainer.bottom + topMargin: 0.1 * parent.height } + wrapMode: Text.WordWrap + lineHeight: 0.5 + color: "white" + font.family: linkAccountBody.fontFamily + font.pixelSize: !root.isTablet ? 2 * linkAccountBody.fontSize : linkAccountBody.fontSize + font.bold: linkAccountBody.fontBold + lineHeightMode: Text.ProportionalHeight + horizontalAlignment: Text.AlignHCenter } - Keys.onReturnPressed: { - Settings.setValue("keepMeLoggedIn/savedUsername", usernameField.text); - linkAccountBody.login(); + HifiControlsUit.Button { + id: signUpButton + text: qsTr("Sign Up") + width: d.minWidthButton + height: d.minHeightButton + color: hifi.buttons.blue + fontFamily: linkAccountBody.fontFamily + fontSize: linkAccountBody.fontSize + fontBold: linkAccountBody.fontBold + anchors { + bottom: parent.bottom + bottomMargin: 0.1 * parent.height + left: parent.left + leftMargin: (parent.width - d.minWidthButton) / 2 + } + onClicked: { + linkAccountBody.withSteam = false; + toggleSignIn(false); + } } } Item { @@ -279,13 +266,6 @@ Item { } Component.onCompleted: { - //dont rise local keyboard - keyboardEnabled = !root.isTablet && HMD.active; - //but rise Tablet's one instead for Tablet interface - if (root.isTablet) { - root.keyboardEnabled = HMD.active; - root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) - } d.resize(); } Component.onDestruction: { diff --git a/interface/resources/qml/LoginDialog/SignInBody.qml b/interface/resources/qml/LoginDialog/SignInBody.qml index 7a8bf347af..260836ffdb 100644 --- a/interface/resources/qml/LoginDialog/SignInBody.qml +++ b/interface/resources/qml/LoginDialog/SignInBody.qml @@ -212,6 +212,9 @@ Item { break; } } + onFocusChanged: { + root.text = ""; + } } HifiControlsUit.TextField { @@ -255,6 +258,9 @@ Item { break; } } + onFocusChanged: { + root.text = ""; + } } HifiControlsUit.TextField { id: passwordField @@ -272,6 +278,7 @@ Item { } onFocusChanged: { + root.text = ""; root.isPassword = true; } @@ -442,13 +449,9 @@ Item { } Component.onCompleted: { - //dont rise local keyboard - keyboardEnabled = !root.isTablet && HMD.active; //but rise Tablet's one instead for Tablet interface - if (root.isTablet) { - root.keyboardEnabled = HMD.active; - root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) - } + root.keyboardEnabled = HMD.active; + root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) d.resize(); init(loginDialog.isLogIn); } diff --git a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml index a95afab220..aad3fdff20 100644 --- a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml +++ b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml @@ -233,7 +233,7 @@ Item { //dont rise local keyboard keyboardEnabled = !root.isTablet && HMD.active; //but rise Tablet's one instead for Tablet interface - if (root.isTablet) { + if (root.isTablet || root.isOverlay) { root.keyboardEnabled = HMD.active; root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) } diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 065fda8b63..ad34e07f1b 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -36,6 +36,8 @@ FocusScope { property bool isPassword: false readonly property bool isTablet: true + readonly property bool isOverlay: false + property alias text: loginKeyboard.mirroredText property int titleWidth: 0 property string iconText: hifi.glyphs.avatar @@ -78,6 +80,18 @@ FocusScope { } } + HifiControlsUit.Keyboard { + id: loginKeyboard + raised: root.keyboardEnabled && root.keyboardRaised + numeric: root.punctuationMode + password: root.isPassword + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + } + Keys.onPressed: { if (!visible) { return diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6260c9c8b3..49ece45012 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -378,7 +378,7 @@ static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStanda Setting::Handle maxOctreePacketsPerSecond{"maxOctreePPS", DEFAULT_MAX_OCTREE_PPS}; Setting::Handle loginDialogPoppedUp{"loginDialogPoppedUp", false}; -static const QUrl OVERLAY_LOGIN_DIALOG_URL(PathUtils::qmlUrl("LoginDialog.qml")); +static const QUrl OVERLAY_LOGIN_DIALOG_URL(PathUtils::qmlUrl("OverlayLoginDialog.qml")); static const QString MARKETPLACE_CDN_HOSTNAME = "mpassets.highfidelity.com"; static const int INTERVAL_TO_CHECK_HMD_WORN_STATUS = 500; // milliseconds @@ -5231,9 +5231,13 @@ void Application::pauseUntilLoginDetermined() { nodeList->getDomainHandler().disconnect(); auto menu = Menu::getInstance(); menu->getMenu("Edit")->setVisible(false); + menu->getMenu("Edit")->setEnabled(false); menu->getMenu("View")->setVisible(false); + menu->getMenu("View")->setEnabled(false); menu->getMenu("Navigate")->setVisible(false); + menu->getMenu("Navigate")->setEnabled(false); menu->getMenu("Settings")->setVisible(false); + menu->getMenu("Settings")->setEnabled(false); } void Application::resumeAfterLoginDialogActionTaken() { @@ -5278,9 +5282,13 @@ void Application::resumeAfterLoginDialogActionTaken() { auto menu = Menu::getInstance(); menu->getMenu("Edit")->setVisible(true); + menu->getMenu("Edit")->setEnabled(true); menu->getMenu("View")->setVisible(true); + menu->getMenu("View")->setEnabled(true); menu->getMenu("Navigate")->setVisible(true); + menu->getMenu("Navigate")->setEnabled(true); menu->getMenu("Settings")->setVisible(true); + menu->getMenu("Settings")->setEnabled(true); } void Application::loadAvatarScripts(const QVector& urls) { @@ -7351,7 +7359,7 @@ void Application::showScriptLogs() { } void Application::showAssetServerWidget(QString filePath) { - if (!DependencyManager::get()->getThisNodeCanWriteAssets()) { + if (!DependencyManager::get()->getThisNodeCanWriteAssets() || getLoginDialogPoppedUp()) { return; } static const QUrl url { "hifi/AssetServer.qml" }; @@ -7990,6 +7998,9 @@ void Application::loadDomainConnectionDialog() { } void Application::toggleLogDialog() { + if (getLoginDialogPoppedUp()) { + return; + } if (! _logDialog) { _logDialog = new LogDialog(nullptr, getLogger()); } @@ -8519,8 +8530,12 @@ void Application::setShowBulletConstraintLimits(bool value) { void Application::checkReadyToCreateLoginDialogOverlay() { if (qApp->isHMDMode() && qApp->getActiveDisplayPlugin()->isDisplayVisible() && qApp->getLoginDialogPoppedUp() && _loginDialogOverlayID.isNull()) { createLoginDialogOverlay(); - } else if (qApp->getLoginDialogPoppedUp() && !qApp->isHMDMode()) { - _loginPointerManager.~LoginPointerManager(); + } else if (qApp->getLoginDialogPoppedUp()) { + if (!qApp->isHMDMode()) { + _loginPointerManager.tearDown(); + } else if (qApp->isHMDMode() && !_loginPointerManager.isSetUp()) { + _loginPointerManager.setUp(); + } } } @@ -8529,9 +8544,9 @@ void Application::createLoginDialogOverlay() { auto myAvatar = avatarManager->getMyAvatar(); Overlays& overlays = qApp->getOverlays(); // DEFAULT_DPI / tablet scale percentage - float overlayDpi = 31.0f / (60 / 100.0f); + float overlayDpi = 31.0f / (75.0f / 100.0f); QVariantMap overlayProperties { - { "name", "pleasework" }, + { "name", "LoginDialogOverlay" }, { "url", OVERLAY_LOGIN_DIALOG_URL }, { "position", vec3toVariant(myAvatar->getHeadPosition() - glm::vec3(0.0f, -0.1f, 1.0f)) }, { "orientation", quatToVariant(myAvatar->getWorldOrientation()) }, @@ -8539,77 +8554,22 @@ void Application::createLoginDialogOverlay() { { "grabbable", false }, { "ignorePickIntersection", false }, { "alpha", 1.0 }, + { "dimensions", vec2ToVariant(glm::vec2(0.5f, 0.5f)) }, { "dpi", overlayDpi }, { "visible", true } }; - _loginPointerManager.init(); - //auto pointer = DependencyManager::get().data(); - //auto standard = _controllerScriptingInterface->getStandard(); - - //glm::vec3 grabPointSphereOffsetLeft { 0.04, 0.13, 0.039 }; // x = upward, y = forward, z = lateral - //glm::vec3 grabPointSphereOffsetRight { -0.04, 0.13, 0.039 }; // x = upward, y = forward, z = lateral - - //QList leftPointerTriggerProperties; - //QVariantMap ltClick1 { - // { "action", controller::StandardButtonChannel::LT_CLICK }, - // { "button", "Focus" } - //}; - //QVariantMap ltClick2 { - // { "action", controller::StandardButtonChannel::LT_CLICK }, - // { "button", "Primary" } - //}; - - //leftPointerTriggerProperties.append(ltClick1); - //leftPointerTriggerProperties.append(ltClick2); - //const unsigned int leftHand = 0; - //QVariantMap leftPointerProperties { - // { "joint", "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND" }, - // { "filter", PickFilter::PICK_OVERLAYS }, - // { "triggers", leftPointerTriggerProperties }, - // { "posOffset", vec3toVariant(grabPointSphereOffsetLeft) }, - // { "hover", true }, - // { "distanceScaleEnd", true }, - // { "hand", leftHand } - //}; - //_leftLoginPointerID = pointer->createPointer(PickQuery::PickType::Ray, leftPointerProperties); - //pointer->setRenderState(_leftLoginPointerID, ""); - //pointer->enablePointer(_leftLoginPointerID); - //const unsigned int rightHand = 1; - //QList rightPointerTriggerProperties; - //QVariantMap rtClick1 { - // { "action", controller::StandardButtonChannel::RT_CLICK }, - // { "button", "Focus" } - //}; - //QVariantMap rtClick2 { - // { "action", controller::StandardButtonChannel::RT_CLICK }, - // { "button", "Primary" } - //}; - //rightPointerTriggerProperties.append(rtClick1); - //rightPointerTriggerProperties.append(rtClick2); - //QVariantMap rightPointerProperties{ - // { "joint", "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND" }, - // { "filter", PickFilter::PICK_OVERLAYS }, - // { "triggers", rightPointerTriggerProperties }, - // { "posOffset", vec3toVariant(grabPointSphereOffsetRight) }, - // { "hover", true }, - // { "distanceScaleEnd", true }, - // { "hand", rightHand } - //}; - //_rightLoginPointerID = pointer->createPointer(PickQuery::PickType::Ray, rightPointerProperties); - //pointer->setRenderState(_rightLoginPointerID, ""); - //pointer->enablePointer(_rightLoginPointerID); - - _loginDialogOverlayID = overlays.addOverlay("web3d", overlayProperties); + _loginDialogOverlayID = overlays.addOverlay("web3d", overlayProperties); + _loginPointerManager.setUp(); } void Application::onDismissedLoginDialog() { _loginDialogPoppedUp = false; loginDialogPoppedUp.set(false); - auto pointer = DependencyManager::get().data(); if (!_loginDialogOverlayID.isNull()) { // deleting overlay. qDebug() << "Deleting overlay"; getOverlays().deleteOverlay(_loginDialogOverlayID); + _loginPointerManager.tearDown(); } resumeAfterLoginDialogActionTaken(); } diff --git a/interface/src/LoginPointerManager.cpp b/interface/src/LoginPointerManager.cpp index ef1cc18d59..879268f4df 100644 --- a/interface/src/LoginPointerManager.cpp +++ b/interface/src/LoginPointerManager.cpp @@ -43,21 +43,21 @@ static const QVariantMap COLORS_GRAB_DISTANCE_HOLD = {{"red", 238}, -LoginPointerManager::~LoginPointerManager() { +void LoginPointerManager::tearDown() { auto pointers = DependencyManager::get().data(); if (pointers) { - if (leftLoginPointerID() != PointerEvent::INVALID_POINTER_ID) { - pointers->disablePointer(leftLoginPointerID()); - pointers->removePointer(leftLoginPointerID()); + if (_leftLoginPointerID > PointerEvent::INVALID_POINTER_ID) { + pointers->removePointer(_leftLoginPointerID); + _leftLoginPointerID = PointerEvent::INVALID_POINTER_ID; } - if (rightLoginPointerID() != PointerEvent::INVALID_POINTER_ID) { - pointers->disablePointer(rightLoginPointerID()); - pointers->removePointer(rightLoginPointerID()); + if (_rightLoginPointerID > PointerEvent::INVALID_POINTER_ID) { + pointers->removePointer(_rightLoginPointerID); + _rightLoginPointerID = PointerEvent::INVALID_POINTER_ID; } } } -void LoginPointerManager::init() { +void LoginPointerManager::setUp() { QVariantMap fullPathRenderState { {"type", "line3d"}, {"color", COLORS_GRAB_SEARCHING_FULL_SQUEEZE}, @@ -163,8 +163,7 @@ void LoginPointerManager::init() { { "button", "Primary" } }; - leftPointerTriggerProperties.append(ltClick1); - leftPointerTriggerProperties.append(ltClick2); + leftPointerTriggerProperties = QList({ltClick1, ltClick2}); const unsigned int leftHand = 0; QVariantMap leftPointerProperties { { "joint", "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND" }, @@ -178,9 +177,9 @@ void LoginPointerManager::init() { }; leftPointerProperties["renderStates"] = _renderStates; leftPointerProperties["defaultRenderStates"] = _defaultRenderStates; - withWriteLock([&] { _leftLoginPointerID = pointers->createPointer(PickQuery::PickType::Ray, leftPointerProperties); }); - pointers->setRenderState(leftLoginPointerID(), ""); - pointers->enablePointer(leftLoginPointerID()); + _leftLoginPointerID = pointers->createPointer(PickQuery::PickType::Ray, leftPointerProperties); + pointers->setRenderState(_leftLoginPointerID, ""); + pointers->enablePointer(_leftLoginPointerID); const unsigned int rightHand = 1; QList rightPointerTriggerProperties; @@ -192,8 +191,7 @@ void LoginPointerManager::init() { { "action", controller->getStandard()["RTClick"] }, { "button", "Primary" } }; - rightPointerTriggerProperties.append(rtClick1); - rightPointerTriggerProperties.append(rtClick2); + rightPointerTriggerProperties = QList({rtClick1, rtClick2}); QVariantMap rightPointerProperties{ { "joint", "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND" }, { "filter", PickScriptingInterface::PICK_OVERLAYS() }, @@ -206,11 +204,9 @@ void LoginPointerManager::init() { }; rightPointerProperties["renderStates"] = _renderStates; rightPointerProperties["defaultRenderStates"] = _defaultRenderStates; - withWriteLock([&] { _rightLoginPointerID = pointers->createPointer(PickQuery::PickType::Ray, rightPointerProperties); }); - pointers->setRenderState(rightLoginPointerID(), ""); - pointers->enablePointer(rightLoginPointerID()); - - + _rightLoginPointerID = pointers->createPointer(PickQuery::PickType::Ray, rightPointerProperties); + pointers->setRenderState(_rightLoginPointerID, ""); + pointers->enablePointer(_rightLoginPointerID); } void LoginPointerManager::update() { @@ -218,11 +214,11 @@ void LoginPointerManager::update() { if (pointers) { QString mode = "full"; - if (leftLoginPointerID() > PointerEvent::INVALID_POINTER_ID) { - pointers->setRenderState(leftLoginPointerID(), mode); + if (_leftLoginPointerID > PointerEvent::INVALID_POINTER_ID) { + pointers->setRenderState(_leftLoginPointerID, mode); } - if (rightLoginPointerID() > PointerEvent::INVALID_POINTER_ID) { - pointers->setRenderState(rightLoginPointerID(), mode); + if (_rightLoginPointerID > PointerEvent::INVALID_POINTER_ID) { + pointers->setRenderState(_rightLoginPointerID, mode); } } } diff --git a/interface/src/LoginPointerManager.h b/interface/src/LoginPointerManager.h index 8690f113cf..66e8f4d0cc 100644 --- a/interface/src/LoginPointerManager.h +++ b/interface/src/LoginPointerManager.h @@ -11,6 +11,7 @@ #ifndef hifi_LoginPointerManager_h #define hifi_LoginPointerManager_h #include +#include #include #include @@ -20,19 +21,14 @@ class LoginPointerManager : protected ReadWriteLockable { public: LoginPointerManager() {} - ~LoginPointerManager(); + ~LoginPointerManager() {} - void init(); + void setUp(); + void tearDown(); void update(); - const unsigned int leftLoginPointerID() const { - return resultWithReadLock([&] { return _leftLoginPointerID; }); - } - - const unsigned int rightLoginPointerID() const { - return resultWithReadLock([&] { return _rightLoginPointerID; }); - } + bool isSetUp() const { return (_leftLoginPointerID > PointerEvent::INVALID_POINTER_ID) && (_rightLoginPointerID > PointerEvent::INVALID_POINTER_ID); } private: QList _renderStates {}; @@ -40,4 +36,5 @@ private: unsigned int _leftLoginPointerID { PointerEvent::INVALID_POINTER_ID }; unsigned int _rightLoginPointerID { PointerEvent::INVALID_POINTER_ID }; }; -#endif // hifi_LoginPointerManager_h + +#endif // hifi_LoginPointerManager_h \ No newline at end of file diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 16e8af5683..bde0b5636b 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -123,10 +123,12 @@ Menu::Menu() { // Edit > Running Scripts auto action = addActionToQMenuAndActionHash(editMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J); connect(action, &QAction::triggered, [] { - static const QUrl widgetUrl("hifi/dialogs/RunningScripts.qml"); - static const QUrl tabletUrl("hifi/dialogs/TabletRunningScripts.qml"); - static const QString name("RunningScripts"); - qApp->showDialog(widgetUrl, tabletUrl, name); + if (!qApp->getLoginDialogPoppedUp()) { + static const QUrl widgetUrl("hifi/dialogs/RunningScripts.qml"); + static const QUrl tabletUrl("hifi/dialogs/TabletRunningScripts.qml"); + static const QString name("RunningScripts"); + qApp->showDialog(widgetUrl, tabletUrl, name); + } }); editMenu->addSeparator(); @@ -233,8 +235,10 @@ Menu::Menu() { // Settings > General... action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_G, nullptr, nullptr); connect(action, &QAction::triggered, [] { - qApp->showDialog(QString("hifi/dialogs/GeneralPreferencesDialog.qml"), - QString("hifi/tablet/TabletGeneralPreferences.qml"), "GeneralPreferencesDialog"); + if (!qApp->getLoginDialogPoppedUp()) { + qApp->showDialog(QString("hifi/dialogs/GeneralPreferencesDialog.qml"), + QString("hifi/tablet/TabletGeneralPreferences.qml"), "GeneralPreferencesDialog"); + } }); // Settings > Controls... diff --git a/interface/src/ui/StandAloneJSConsole.cpp b/interface/src/ui/StandAloneJSConsole.cpp index 49cf22a9eb..e6c3748d20 100644 --- a/interface/src/ui/StandAloneJSConsole.cpp +++ b/interface/src/ui/StandAloneJSConsole.cpp @@ -20,7 +20,7 @@ void StandAloneJSConsole::toggleConsole() { QMainWindow* mainWindow = qApp->getWindow(); - if (!_jsConsole) { + if (!_jsConsole && !qApp->getLoginDialogPoppedUp()) { QDialog* dialog = new QDialog(mainWindow, Qt::WindowStaysOnTopHint); QVBoxLayout* layout = new QVBoxLayout(dialog); dialog->setLayout(layout);