From 049282e2b35e1b768deddd8c83e11906399b14f9 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 23 Jan 2019 14:38:06 -0800 Subject: [PATCH] fixing text alignment issues, adding some oculus user log --- .../qml/LoginDialog/LoggingInBody.qml | 30 +++++++++++++++++-- .../resources/qml/LoginDialog/SignUpBody.qml | 6 ++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/LoginDialog/LoggingInBody.qml b/interface/resources/qml/LoginDialog/LoggingInBody.qml index 998f78ac8d..c6b102974d 100644 --- a/interface/resources/qml/LoginDialog/LoggingInBody.qml +++ b/interface/resources/qml/LoginDialog/LoggingInBody.qml @@ -77,6 +77,17 @@ Item { } } + Timer { + id: oculusSuccessTimer + interval: 500; + running: false; + repeat: false; + onTriggered: { + loginDialog.loginThroughOculus(); + init(); + } + } + function init() { // For the process of logging in. loggingInText.wrapMode = Text.NoWrap; @@ -287,14 +298,29 @@ Item { onHandleCreateCompleted: { console.log("Create Succeeded") if (loggingInBody.withOculus) { + if (loggingInBody.loginDialogPoppedUp) { + loginDialog.dismissLoginDialog(); + var data = { + "action": "user created Oculus account successfully" + }; + UserActivityLogger.logAction("encourageLoginDialog", data); + } loggingInBody.createOculus = false; - loggingInText.text = "Account created! Logging in to Oculus"; - loginDialog.loginThroughOculus(); + loggingInText.text = "Account created!"; + loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2; + oculusSuccessTimer.start(); } } onHandleCreateFailed: { console.log("Create Failed: " + error); if (loggingInBody.withOculus) { + if (loggingInBody.loginDialogPoppedUp) { + loginDialog.dismissLoginDialog(); + var data = { + "action": "user created Oculus account unsuccessfully" + }; + UserActivityLogger.logAction("encourageLoginDialog", data); + } bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "withOculus": loggingInBody.withOculus, "errorString": error }); } diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index 5d730260d8..64df9089a1 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -480,15 +480,15 @@ Item { if (errorString !== "") { loginErrorMessage.visible = true; + var errorLength = errorString.split(/\r\n|\r|\n/).length; var errorStringEdited = errorString.replace(/[\n\r]+/g, "\n"); loginErrorMessage.text = errorStringEdited; - loginErrorMessageTextMetrics.text = errorString; - if (loginErrorMessageTextMetrics.width > usernameField.width) { + if (errorLength > 1.0) { loginErrorMessage.width = root.bannerWidth; loginErrorMessage.wrapMode = Text.WordWrap; loginErrorMessage.verticalAlignment = Text.AlignLeft; loginErrorMessage.horizontalAlignment = Text.AlignLeft; - errorContainer.height = (loginErrorMessageTextMetrics.width / usernameField.width) * loginErrorMessageTextMetrics.height; + errorContainer.height = errorLength * loginErrorMessageTextMetrics.height; } errorContainer.anchors.bottom = usernameField.top; errorContainer.anchors.bottomMargin = hifi.dimensions.contentSpacing.y;