From aa2ae31aab3b5b9b6fe4b9359f40ee5e3efa9600 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Fri, 29 Jul 2016 19:30:20 -0700 Subject: [PATCH] CR UI fixes --- .../qml/LoginDialog/CompleteProfileBody.qml | 15 +- .../qml/LoginDialog/EmailSentBody.qml | 83 ----------- .../qml/LoginDialog/LinkAccountBody.qml | 51 ++----- .../qml/LoginDialog/RecoverPasswordBody.qml | 140 ------------------ .../qml/LoginDialog/UsernameCollisionBody.qml | 30 +++- interface/src/ui/LoginDialog.cpp | 4 +- .../networking/src/NetworkingConstants.h | 2 +- 7 files changed, 50 insertions(+), 275 deletions(-) delete mode 100644 interface/resources/qml/LoginDialog/EmailSentBody.qml delete mode 100644 interface/resources/qml/LoginDialog/RecoverPasswordBody.qml diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index 12d2cee73e..fc7eac3d00 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -77,22 +77,17 @@ Item { topMargin: hifi.dimensions.contentSpacing.y } - text: "Already have a High Fidelity profile? Link to an existing profile here." + text: "Already have a High Fidelity profile? Link to an existing profile here." - font.underline: true wrapMode: Text.WordWrap - color: hifi.colors.blueAccent lineHeight: 2 lineHeightMode: Text.ProportionalHeight horizontalAlignment: Text.AlignHCenter - MouseArea { - anchors.fill: parent - onClicked: { - bodyLoader.source = "LinkAccountBody.qml" - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } + onLinkActivated: { + bodyLoader.source = "LinkAccountBody.qml" + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height } } diff --git a/interface/resources/qml/LoginDialog/EmailSentBody.qml b/interface/resources/qml/LoginDialog/EmailSentBody.qml deleted file mode 100644 index 489385864b..0000000000 --- a/interface/resources/qml/LoginDialog/EmailSentBody.qml +++ /dev/null @@ -1,83 +0,0 @@ -// -// EmailSentBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 - -import "../controls-uit" -import "../styles-uit" - -Item { - id: emailSentBody - clip: true - width: root.pane.width - height: root.pane.height - - property string email: "" - - QtObject { - id: d - readonly property int minWidth: 480 - readonly property int maxWidth: 1280 - readonly property int minHeight: 120 - readonly property int maxHeight: 720 - - function resize() { - var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth) - var targetHeight = mainTextContainer.height + 3 * hifi.dimensions.contentSpacing.y + buttons.height - - root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) - root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) - } - } - - MenuItem { - id: mainTextContainer - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - text: qsTr("An email with instructions on reseting your password was sent to
") + email + "" - wrapMode: Text.WordWrap - color: hifi.colors.baseGrayHighlight - lineHeight: 2 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - } - - Row { - id: buttons - anchors { - top: mainTextContainer.bottom - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Close"); - - onClicked: root.destroy() - } - } - - Component.onCompleted: { - root.title = qsTr("Email Sent") - root.iconText = "" - d.resize(); - } -} diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index da5f0f1a42..137556964f 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -22,9 +22,8 @@ Item { width: root.pane.width height: root.pane.height - property bool existingEmail: false - function login() { + mainTextContainer.visible = false loginDialog.login(usernameField.text, passwordField.text) } @@ -36,8 +35,8 @@ Item { readonly property int maxHeight: 720 function resize() { - var targetWidth = Math.max(titleWidth, mainTextContainer.visible ? mainTextContainer.contentWidth : 0) - var targetHeight = (mainTextContainer.visible ? mainTextContainer.height : 0) + + var targetWidth = Math.max(titleWidth, form.contentWidth) + var targetHeight = hifi.dimensions.contentSpacing.y + mainTextContainer.height + 4 * hifi.dimensions.contentSpacing.y + form.height + 4 * hifi.dimensions.contentSpacing.y + buttons.height @@ -46,29 +45,29 @@ Item { } } - MenuItem { + ShortcutText { id: mainTextContainer anchors { top: parent.top - horizontalCenter: parent.horizontalCenter + left: parent.left margins: 0 topMargin: hifi.dimensions.contentSpacing.y } - visible: existingEmail - text: qsTr("Your Steam account's email matches an existing High Fidelity Profile") + visible: false + + text: qsTr("Username or password incorrect.") wrapMode: Text.WordWrap color: hifi.colors.redAccent - lineHeight: 2 + lineHeight: 1 lineHeightMode: Text.ProportionalHeight horizontalAlignment: Text.AlignHCenter } - Column { id: form anchors { - top: mainTextContainer.visible ? mainTextContainer.bottom : parent.top + top: mainTextContainer.bottom left: parent.left margins: 0 topMargin: 2 * hifi.dimensions.contentSpacing.y @@ -93,22 +92,12 @@ Item { verticalCenter: parent.verticalCenter } - text: "Need help?" - - color: hifi.colors.blueAccent - font.underline: true + text: "Forgot Username?" verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - MouseArea { - anchors.fill: parent - onClicked: { - bodyLoader.source = "RecoverPasswordBody.qml" - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } - } + onLinkActivated: loginDialog.openUrl(link) } } Row { @@ -130,22 +119,12 @@ Item { verticalCenter: parent.verticalCenter } - text: "Need help?" - - color: hifi.colors.blueAccent - font.underline: true + text: "Forgot Password?" verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - MouseArea { - anchors.fill: parent - onClicked: { - bodyLoader.source = "RecoverPasswordBody.qml" - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } - } + onLinkActivated: loginDialog.openUrl(link) } } @@ -205,7 +184,7 @@ Item { } onHandleLoginFailed: { console.log("Login Failed") - + mainTextContainer.visible = true } onHandleLinkCompleted: { console.log("Link Succeeded") diff --git a/interface/resources/qml/LoginDialog/RecoverPasswordBody.qml b/interface/resources/qml/LoginDialog/RecoverPasswordBody.qml deleted file mode 100644 index 3c6e101e2a..0000000000 --- a/interface/resources/qml/LoginDialog/RecoverPasswordBody.qml +++ /dev/null @@ -1,140 +0,0 @@ -// -// RecoverPasswordBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 as OriginalStyles - -import "../controls-uit" -import "../styles-uit" - -Item { - id: recoverPasswordBody - clip: true - width: root.pane.width - height: root.pane.height - - function send() { - loginDialog.sendRecoveryEmail(emailField.text) - - bodyLoader.setSource("EmailSentBody.qml", { "email": emailField.text }) - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } - - QtObject { - id: d - readonly property int minWidth: 480 - readonly property int maxWidth: 1280 - readonly property int minHeight: 120 - readonly property int maxHeight: 720 - - function resize() { - var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth) - var targetHeight = mainTextContainer.height + - 3 * hifi.dimensions.contentSpacing.y + emailField.height + - 4 * hifi.dimensions.contentSpacing.y + buttons.height - - root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) - root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) - } - } - - MenuItem { - id: mainTextContainer - anchors { - top: parent.top - left: parent.left - right: parent.right - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - text: qsTr("In order to help you reset your password, we will send an
email with instructions to your email address.") - wrapMode: Text.WordWrap - color: hifi.colors.baseGrayHighlight - lineHeight: 1 - horizontalAlignment: Text.AlignHLeft - } - - - TextField { - id: emailField - anchors { - top: mainTextContainer.bottom - left: parent.left - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - - width: 350 - - label: "Email address" - - Component.onCompleted: { - emailField.forceActiveFocus() - } - } - - Row { - id: buttons - anchors { - top: emailField.bottom - right: parent.right - margins: 0 - topMargin: 3 * hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr("Send recovery email") - color: hifi.buttons.blue - - onClicked: recoverPasswordBody.send() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Back") - - onClicked: { - bodyLoader.source = "LinkAccountBody.qml" - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } - } - } - - Component.onCompleted: { - root.title = qsTr("Recover Password") - root.iconText = "<" - d.resize(); - } - - Keys.onPressed: { - if (!visible) { - return - } - - switch (event.key) { - case Qt.Key_Enter: - case Qt.Key_Return: - event.accepted = true - recoverPasswordBody.send() - break - } - } -} diff --git a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml index f0663631a8..7e22b11f8b 100644 --- a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml +++ b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml @@ -22,6 +22,11 @@ Item { width: root.pane.width height: root.pane.height + function create() { + mainTextContainer.visible = false + loginDialog.createAccountFromStream(textField.text) + } + QtObject { id: d readonly property int minWidth: 480 @@ -82,12 +87,14 @@ Item { topMargin: 3 * hifi.dimensions.contentSpacing.y } - text: qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service") + text: qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service") wrapMode: Text.WordWrap color: hifi.colors.baseGrayHighlight lineHeight: 1 lineHeightMode: Text.ProportionalHeight horizontalAlignment: Text.AlignHCenter + + onLinkActivated: loginDialog.openUrl(link) } Row { @@ -108,9 +115,7 @@ Item { text: qsTr("Create your profile") color: hifi.buttons.blue - onClicked: { - loginDialog.createAccountFromStream(textField.text) - } + onClicked: usernameCollisionBody.create() } Button { @@ -136,6 +141,9 @@ Item { } onHandleCreateFailed: { console.log("Create Failed: " + error) + + mainTextContainer.visible = true + mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.") } onHandleLoginCompleted: { console.log("Login Succeeded") @@ -148,4 +156,18 @@ Item { console.log("Login Failed") } } + + Keys.onPressed: { + if (!visible) { + return + } + + switch (event.key) { + case Qt.Key_Enter: + case Qt.Key_Return: + event.accepted = true + usernameCollisionBody.create() + break + } + } } diff --git a/interface/src/ui/LoginDialog.cpp b/interface/src/ui/LoginDialog.cpp index b65e111b16..78aacb1216 100644 --- a/interface/src/ui/LoginDialog.cpp +++ b/interface/src/ui/LoginDialog.cpp @@ -132,7 +132,9 @@ void LoginDialog::createAccountFromStream(QString username) { } void LoginDialog::openUrl(const QString& url) { - QDesktopServices::openUrl(url); + auto offscreenUi = DependencyManager::get(); + auto browser = offscreenUi->load("Browser.qml"); + browser->setProperty("url", url); } void LoginDialog::sendRecoveryEmail(const QString& email) { diff --git a/libraries/networking/src/NetworkingConstants.h b/libraries/networking/src/NetworkingConstants.h index 154470201f..bbbaa5ebbe 100644 --- a/libraries/networking/src/NetworkingConstants.h +++ b/libraries/networking/src/NetworkingConstants.h @@ -15,7 +15,7 @@ #include namespace NetworkingConstants { - const QUrl METAVERSE_SERVER_URL = QUrl("https://hifi.ngrok.io"); + const QUrl METAVERSE_SERVER_URL = QUrl("http://10.0.0.146:8080"); } #endif // hifi_NetworkingConstants_h