CR UI fixes

This commit is contained in:
Atlante45 2016-07-29 19:30:20 -07:00
parent 2af32ca60e
commit aa2ae31aab
7 changed files with 50 additions and 275 deletions

View file

@ -77,22 +77,17 @@ Item {
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }
text: "Already have a High Fidelity profile? Link to an existing profile here." text: "<a href='https://fake.link'>Already have a High Fidelity profile? Link to an existing profile here.</a>"
font.underline: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: hifi.colors.blueAccent
lineHeight: 2 lineHeight: 2
lineHeightMode: Text.ProportionalHeight lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
MouseArea { onLinkActivated: {
anchors.fill: parent bodyLoader.source = "LinkAccountBody.qml"
onClicked: { bodyLoader.item.width = root.pane.width
bodyLoader.source = "LinkAccountBody.qml" bodyLoader.item.height = root.pane.height
bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
} }
} }

View file

@ -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 <br/><b>") + email + "</b>"
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();
}
}

View file

@ -22,9 +22,8 @@ Item {
width: root.pane.width width: root.pane.width
height: root.pane.height height: root.pane.height
property bool existingEmail: false
function login() { function login() {
mainTextContainer.visible = false
loginDialog.login(usernameField.text, passwordField.text) loginDialog.login(usernameField.text, passwordField.text)
} }
@ -36,8 +35,8 @@ Item {
readonly property int maxHeight: 720 readonly property int maxHeight: 720
function resize() { function resize() {
var targetWidth = Math.max(titleWidth, mainTextContainer.visible ? mainTextContainer.contentWidth : 0) var targetWidth = Math.max(titleWidth, form.contentWidth)
var targetHeight = (mainTextContainer.visible ? mainTextContainer.height : 0) + var targetHeight = hifi.dimensions.contentSpacing.y + mainTextContainer.height +
4 * hifi.dimensions.contentSpacing.y + form.height + 4 * hifi.dimensions.contentSpacing.y + form.height +
4 * hifi.dimensions.contentSpacing.y + buttons.height 4 * hifi.dimensions.contentSpacing.y + buttons.height
@ -46,29 +45,29 @@ Item {
} }
} }
MenuItem { ShortcutText {
id: mainTextContainer id: mainTextContainer
anchors { anchors {
top: parent.top top: parent.top
horizontalCenter: parent.horizontalCenter left: parent.left
margins: 0 margins: 0
topMargin: hifi.dimensions.contentSpacing.y 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 wrapMode: Text.WordWrap
color: hifi.colors.redAccent color: hifi.colors.redAccent
lineHeight: 2 lineHeight: 1
lineHeightMode: Text.ProportionalHeight lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
Column { Column {
id: form id: form
anchors { anchors {
top: mainTextContainer.visible ? mainTextContainer.bottom : parent.top top: mainTextContainer.bottom
left: parent.left left: parent.left
margins: 0 margins: 0
topMargin: 2 * hifi.dimensions.contentSpacing.y topMargin: 2 * hifi.dimensions.contentSpacing.y
@ -93,22 +92,12 @@ Item {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
text: "Need help?" text: "<a href='https://highfidelity.com/users/password/new'>Forgot Username?</a>"
color: hifi.colors.blueAccent
font.underline: true
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
MouseArea { onLinkActivated: loginDialog.openUrl(link)
anchors.fill: parent
onClicked: {
bodyLoader.source = "RecoverPasswordBody.qml"
bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
}
} }
} }
Row { Row {
@ -130,22 +119,12 @@ Item {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
text: "Need help?" text: "<a href='https://highfidelity.com/users/password/new'>Forgot Password?</a>"
color: hifi.colors.blueAccent
font.underline: true
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
MouseArea { onLinkActivated: loginDialog.openUrl(link)
anchors.fill: parent
onClicked: {
bodyLoader.source = "RecoverPasswordBody.qml"
bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
}
} }
} }
@ -205,7 +184,7 @@ Item {
} }
onHandleLoginFailed: { onHandleLoginFailed: {
console.log("Login Failed") console.log("Login Failed")
mainTextContainer.visible = true
} }
onHandleLinkCompleted: { onHandleLinkCompleted: {
console.log("Link Succeeded") console.log("Link Succeeded")

View file

@ -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<br/>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
}
}
}

View file

@ -22,6 +22,11 @@ Item {
width: root.pane.width width: root.pane.width
height: root.pane.height height: root.pane.height
function create() {
mainTextContainer.visible = false
loginDialog.createAccountFromStream(textField.text)
}
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -82,12 +87,14 @@ Item {
topMargin: 3 * hifi.dimensions.contentSpacing.y topMargin: 3 * hifi.dimensions.contentSpacing.y
} }
text: qsTr("By creating this user profile, you agree to <a href=\"https://highfidelity.com/terms\">High Fidelity's Terms of Service</a>") text: qsTr("By creating this user profile, you agree to <a href='https://highfidelity.com/terms'>High Fidelity's Terms of Service</a>")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: hifi.colors.baseGrayHighlight color: hifi.colors.baseGrayHighlight
lineHeight: 1 lineHeight: 1
lineHeightMode: Text.ProportionalHeight lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
onLinkActivated: loginDialog.openUrl(link)
} }
Row { Row {
@ -108,9 +115,7 @@ Item {
text: qsTr("Create your profile") text: qsTr("Create your profile")
color: hifi.buttons.blue color: hifi.buttons.blue
onClicked: { onClicked: usernameCollisionBody.create()
loginDialog.createAccountFromStream(textField.text)
}
} }
Button { Button {
@ -136,6 +141,9 @@ Item {
} }
onHandleCreateFailed: { onHandleCreateFailed: {
console.log("Create Failed: " + error) console.log("Create Failed: " + error)
mainTextContainer.visible = true
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.")
} }
onHandleLoginCompleted: { onHandleLoginCompleted: {
console.log("Login Succeeded") console.log("Login Succeeded")
@ -148,4 +156,18 @@ Item {
console.log("Login Failed") 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
}
}
} }

View file

@ -132,7 +132,9 @@ void LoginDialog::createAccountFromStream(QString username) {
} }
void LoginDialog::openUrl(const QString& url) { void LoginDialog::openUrl(const QString& url) {
QDesktopServices::openUrl(url); auto offscreenUi = DependencyManager::get<OffscreenUi>();
auto browser = offscreenUi->load("Browser.qml");
browser->setProperty("url", url);
} }
void LoginDialog::sendRecoveryEmail(const QString& email) { void LoginDialog::sendRecoveryEmail(const QString& email) {

View file

@ -15,7 +15,7 @@
#include <QtCore/QUrl> #include <QtCore/QUrl>
namespace NetworkingConstants { 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 #endif // hifi_NetworkingConstants_h