diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index 997cf630ea..ebc677fb00 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -75,7 +75,7 @@ Item { Item { id: errorContainer - width: parent.width + width: root.bannerWidth height: loginErrorMessageTextMetrics.height anchors { bottom: completeProfileBody.withOculus ? fields.top : buttons.top; @@ -98,16 +98,11 @@ Item { horizontalAlignment: Text.AlignHCenter text: completeProfileBody.errorString visible: true - } - Component.onCompleted: { - if (loginErrorMessageTextMetrics.width > root.bannerWidth) { - loginErrorMessage.wrapMode = Text.WordWrap; - loginErrorMessage.verticalAlignment = Text.AlignLeft; - loginErrorMessage.horizontalAlignment = Text.AlignLeft; - errorContainer.height = (loginErrorMessageTextMetrics.width / root.bannerWidth) * loginErrorMessageTextMetrics.height; - } else { - loginErrorMessage.wrapMode = Text.NoWrap; - errorContainer.height = loginErrorMessageTextMetrics.height; + onTextChanged: { + mainContainer.recalculateErrorMessage(); + } + Component.onCompleted: { + mainContainer.recalculateErrorMessage(); } } } @@ -469,6 +464,30 @@ Item { } } } + function recalculateErrorMessage() { + if (completeProfileBody.errorString !== "") { + loginErrorMessage.visible = true; + var errorLength = completeProfileBody.errorString.split(/\r\n|\r|\n/).length; + var errorStringEdited = completeProfileBody.errorString.replace(/[\n\r]+/g, "\n"); + loginErrorMessage.text = errorStringEdited; + if (errorLength > 1.0) { + loginErrorMessage.wrapMode = Text.WordWrap; + loginErrorMessage.verticalAlignment = Text.AlignLeft; + loginErrorMessage.horizontalAlignment = Text.AlignLeft; + errorContainer.height = errorLength * loginErrorMessageTextMetrics.height; + } else if (loginErrorMessageTextMetrics.width > root.bannerWidth) { + loginErrorMessage.wrapMode = Text.WordWrap; + loginErrorMessage.verticalAlignment = Text.AlignLeft; + loginErrorMessage.horizontalAlignment = Text.AlignLeft; + errorContainer.height = (loginErrorMessageTextMetrics.width / root.bannerWidth) * loginErrorMessageTextMetrics.height; + } else { + loginErrorMessage.wrapMode = Text.NoWrap; + loginErrorMessage.verticalAlignment = Text.AlignVCenter; + loginErrorMessage.horizontalAlignment = Text.AlignHCenter; + errorContainer.height = loginErrorMessageTextMetrics.height; + } + } + } } Connections { diff --git a/interface/resources/qml/LoginDialog/LoggingInBody.qml b/interface/resources/qml/LoginDialog/LoggingInBody.qml index c6b102974d..583f00583b 100644 --- a/interface/resources/qml/LoginDialog/LoggingInBody.qml +++ b/interface/resources/qml/LoginDialog/LoggingInBody.qml @@ -299,7 +299,6 @@ Item { console.log("Create Succeeded") if (loggingInBody.withOculus) { if (loggingInBody.loginDialogPoppedUp) { - loginDialog.dismissLoginDialog(); var data = { "action": "user created Oculus account successfully" }; @@ -315,7 +314,6 @@ Item { console.log("Create Failed: " + error); if (loggingInBody.withOculus) { if (loggingInBody.loginDialogPoppedUp) { - loginDialog.dismissLoginDialog(); var data = { "action": "user created Oculus account unsuccessfully" }; diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index 50730bd623..74d6f7879c 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -330,14 +330,14 @@ void LoginDialog::createFailed(QNetworkReply* reply) { if (!email.isNull() && !email.isUndefined()) { QJsonArray arr = email.toArray(); if (!arr.isEmpty()) { - reply.append((!reply.isEmpty()) ? " " : ""); + reply.append((!reply.isEmpty()) ? "\n" : ""); reply.append("Email " + arr.at(0).toString() + "."); } } if (!password.isNull() && !password.isUndefined()) { QJsonArray arr = password.toArray(); if (!arr.isEmpty()) { - reply.append((!reply.isEmpty()) ? " " : ""); + reply.append((!reply.isEmpty()) ? "\n" : ""); reply.append("Password " + arr.at(0).toString() + "."); } } diff --git a/plugins/oculus/src/OculusPlatformPlugin.cpp b/plugins/oculus/src/OculusPlatformPlugin.cpp index 0612f4c22d..0347ab08d8 100644 --- a/plugins/oculus/src/OculusPlatformPlugin.cpp +++ b/plugins/oculus/src/OculusPlatformPlugin.cpp @@ -17,9 +17,11 @@ const char* OculusAPIPlugin::NAME { "Oculus Rift" }; OculusAPIPlugin::OculusAPIPlugin() { + _session = hifi::ovr::acquireRenderSession(); } OculusAPIPlugin::~OculusAPIPlugin() { + hifi::ovr::releaseRenderSession(_session); } bool OculusAPIPlugin::isRunning() { diff --git a/plugins/oculus/src/OculusPlatformPlugin.h b/plugins/oculus/src/OculusPlatformPlugin.h index 45e399098e..c4919dfbe4 100644 --- a/plugins/oculus/src/OculusPlatformPlugin.h +++ b/plugins/oculus/src/OculusPlatformPlugin.h @@ -34,4 +34,5 @@ private: bool _nonceChanged{ false }; QString _user; ovrID _userID; + ovrSession _session; };