mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
sign in reworked
This commit is contained in:
parent
608d42cdf7
commit
4f907aba1e
12 changed files with 248 additions and 1198 deletions
|
@ -35,6 +35,10 @@ ModalWindow {
|
||||||
|
|
||||||
keyboardOverride: true // Disable ModalWindow's keyboard.
|
keyboardOverride: true // Disable ModalWindow's keyboard.
|
||||||
|
|
||||||
|
function tryDestroy() {
|
||||||
|
root.destroy()
|
||||||
|
}
|
||||||
|
|
||||||
LoginDialog {
|
LoginDialog {
|
||||||
id: loginDialog
|
id: loginDialog
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
import QtQuick 2.4
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ Item {
|
||||||
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
|
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
|
||||||
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||||
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
|
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y);
|
||||||
|
console.log("sign in h:", targetHeight, parent.height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,30 +109,27 @@ Item {
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: form
|
id: form
|
||||||
|
width: parent.width
|
||||||
|
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: mainTextContainer.bottom
|
top: mainTextContainer.bottom
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: 2 * hifi.dimensions.contentSpacing.y
|
topMargin: 2 * hifi.dimensions.contentSpacing.y
|
||||||
}
|
}
|
||||||
spacing: 2 * hifi.dimensions.contentSpacing.y
|
spacing: 2 * hifi.dimensions.contentSpacing.y
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: usernameField
|
id: usernameField
|
||||||
anchors {
|
width: parent.width
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 350
|
|
||||||
|
|
||||||
label: "Username or Email"
|
label: "Username or Email"
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
ShortcutText {
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: usernameField.textFieldLabel.verticalCenter
|
||||||
|
left: usernameField.textFieldLabel.right
|
||||||
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
text: "<a href='https://highfidelity.com/users/password/new'>Forgot Username?</a>"
|
text: "<a href='https://highfidelity.com/users/password/new'>Forgot Username?</a>"
|
||||||
|
@ -143,23 +141,19 @@ Item {
|
||||||
onLinkActivated: loginDialog.openUrl(link)
|
onLinkActivated: loginDialog.openUrl(link)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
anchors {
|
width: parent.width
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 350
|
|
||||||
|
|
||||||
label: "Password"
|
label: "Password"
|
||||||
echoMode: TextInput.Password
|
echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
ShortcutText {
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: passwordField.textFieldLabel.verticalCenter
|
||||||
|
left: passwordField.textFieldLabel.right
|
||||||
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
text: "<a href='https://highfidelity.com/users/password/new'>Forgot Password?</a>"
|
text: "<a href='https://highfidelity.com/users/password/new'>Forgot Password?</a>"
|
||||||
|
@ -172,25 +166,86 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
CheckBoxQQC2 {
|
||||||
|
id: showPassword
|
||||||
InfoItem {
|
text: "Show password"
|
||||||
id: additionalInformation
|
|
||||||
anchors {
|
|
||||||
top: form.bottom
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: loginDialog.isSteamRunning()
|
InfoItem {
|
||||||
|
id: additionalInformation
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
margins: 0
|
||||||
|
topMargin: hifi.dimensions.contentSpacing.y
|
||||||
|
}
|
||||||
|
|
||||||
text: qsTr("Your steam account informations will not be exposed to other users.")
|
visible: loginDialog.isSteamRunning()
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
color: hifi.colors.baseGrayHighlight
|
text: qsTr("Your steam account informations will not be exposed to other users.")
|
||||||
lineHeight: 1
|
wrapMode: Text.WordWrap
|
||||||
lineHeightMode: Text.ProportionalHeight
|
color: hifi.colors.baseGrayHighlight
|
||||||
horizontalAlignment: Text.AlignHCenter
|
lineHeight: 1
|
||||||
|
lineHeightMode: Text.ProportionalHeight
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
//width: parent.width
|
||||||
|
spacing: hifi.dimensions.contentSpacing.y*2
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
//padding: 10
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: buttons
|
||||||
|
spacing: hifi.dimensions.contentSpacing.y*2
|
||||||
|
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: linkAccountButton
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 200
|
||||||
|
|
||||||
|
text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login")
|
||||||
|
color: hifi.buttons.blue
|
||||||
|
|
||||||
|
onClicked: linkAccountBody.login()
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: qsTr("Cancel")
|
||||||
|
onClicked: root.tryDestroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: leftButton
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: hifi.dimensions.contentSpacing.x
|
||||||
|
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
||||||
|
|
||||||
|
RalewaySemiBold {
|
||||||
|
size: hifi.fontSizes.inputLabel
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: qsTr("Don't have an account?")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
text: qsTr("Sign Up")
|
||||||
|
visible: !loginDialog.isSteamRunning()
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
bodyLoader.setSource("SignUpBody.qml")
|
||||||
|
bodyLoader.item.width = root.pane.width
|
||||||
|
bodyLoader.item.height = root.pane.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override ScrollingWindow's keyboard that would be at very bottom of dialog.
|
// Override ScrollingWindow's keyboard that would be at very bottom of dialog.
|
||||||
|
@ -200,65 +255,12 @@ Item {
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
bottom: buttons.top
|
bottom: parent.bottom
|
||||||
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
|
||||||
id: leftButton
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Sign Up")
|
|
||||||
visible: !loginDialog.isSteamRunning()
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
bodyLoader.setSource("SignUpBody.qml")
|
|
||||||
bodyLoader.item.width = root.pane.width
|
|
||||||
bodyLoader.item.height = root.pane.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons
|
|
||||||
anchors {
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: linkAccountButton
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 200
|
|
||||||
|
|
||||||
text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login")
|
|
||||||
color: hifi.buttons.blue
|
|
||||||
|
|
||||||
onClicked: linkAccountBody.login()
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Cancel")
|
|
||||||
|
|
||||||
onClicked: root.destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
root.title = qsTr("Sign Into High Fidelity")
|
root.title = qsTr("Sign Into High Fidelity")
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
import QtQuick 2.4
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
||||||
|
|
||||||
import "../controls-uit"
|
import "../controls-uit"
|
||||||
|
@ -18,8 +18,8 @@ import "../styles-uit"
|
||||||
Item {
|
Item {
|
||||||
id: signInBody
|
id: signInBody
|
||||||
clip: true
|
clip: true
|
||||||
width: root.pane.width
|
|
||||||
height: root.pane.height
|
height: root.pane.height
|
||||||
|
width: root.pane.width
|
||||||
|
|
||||||
property bool required: false
|
property bool required: false
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
root.destroy()
|
root.tryDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import Hifi 1.0
|
import Hifi 1.0
|
||||||
import QtQuick 2.4
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
import QtQuick.Controls.Styles 1.4 as OriginalStyles
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ Item {
|
||||||
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
|
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
|
||||||
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
|
||||||
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : 0);
|
+ (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : 0);
|
||||||
|
//console.log("sign up h:", parent.height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +238,7 @@ Item {
|
||||||
|
|
||||||
text: qsTr("Cancel")
|
text: qsTr("Cancel")
|
||||||
|
|
||||||
onClicked: root.destroy()
|
onClicked: root.tryDestroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,124 +0,0 @@
|
||||||
//
|
|
||||||
// CompleteProfileBody.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.Styles 1.4 as OriginalStyles
|
|
||||||
|
|
||||||
import "../controls-uit"
|
|
||||||
import "../styles-uit"
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: completeProfileBody
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
function resize() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
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
|
|
||||||
width: 200
|
|
||||||
|
|
||||||
text: qsTr("Create your profile")
|
|
||||||
color: hifi.buttons.blue
|
|
||||||
|
|
||||||
onClicked: loginDialog.createAccountFromStream()
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Cancel")
|
|
||||||
|
|
||||||
onClicked: bodyLoader.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
id: additionalTextContainer
|
|
||||||
anchors {
|
|
||||||
top: buttons.bottom
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
text: "<a href='https://fake.link'>Already have a High Fidelity profile? Link to an existing profile here.</a>"
|
|
||||||
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
lineHeight: 2
|
|
||||||
lineHeightMode: Text.ProportionalHeight
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
|
|
||||||
onLinkActivated: {
|
|
||||||
bodyLoader.setSource("LinkAccountBody.qml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoItem {
|
|
||||||
id: termsContainer
|
|
||||||
anchors {
|
|
||||||
top: additionalTextContainer.bottom
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: 2 * 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>")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
color: hifi.colors.baseGrayHighlight
|
|
||||||
lineHeight: 1
|
|
||||||
lineHeightMode: Text.ProportionalHeight
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
|
|
||||||
onLinkActivated: loginDialog.openUrl(link)
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loginDialogRoot.title = qsTr("Complete Your Profile")
|
|
||||||
loginDialogRoot.iconText = "<"
|
|
||||||
d.resize();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: loginDialog
|
|
||||||
onHandleCreateCompleted: {
|
|
||||||
console.log("Create Succeeded")
|
|
||||||
|
|
||||||
loginDialog.loginThroughSteam()
|
|
||||||
}
|
|
||||||
onHandleCreateFailed: {
|
|
||||||
console.log("Create Failed: " + error)
|
|
||||||
|
|
||||||
bodyLoadersetSource("UsernameCollisionBody.qml")
|
|
||||||
}
|
|
||||||
onHandleLoginCompleted: {
|
|
||||||
console.log("Login Succeeded")
|
|
||||||
|
|
||||||
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : false })
|
|
||||||
}
|
|
||||||
onHandleLoginFailed: {
|
|
||||||
console.log("Login Failed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,296 +0,0 @@
|
||||||
//
|
|
||||||
// LinkAccountBody.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: linkAccountBody
|
|
||||||
clip: true
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width
|
|
||||||
property bool failAfterSignUp: false
|
|
||||||
|
|
||||||
function login() {
|
|
||||||
mainTextContainer.visible = false
|
|
||||||
toggleLoading(true)
|
|
||||||
loginDialog.login(usernameField.text, passwordField.text)
|
|
||||||
}
|
|
||||||
|
|
||||||
property bool keyboardEnabled: false
|
|
||||||
property bool keyboardRaised: false
|
|
||||||
property bool punctuationMode: false
|
|
||||||
|
|
||||||
onKeyboardRaisedChanged: d.resize();
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
function resize() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleLoading(isLoading) {
|
|
||||||
linkAccountSpinner.visible = isLoading
|
|
||||||
form.visible = !isLoading
|
|
||||||
|
|
||||||
if (loginDialog.isSteamRunning()) {
|
|
||||||
additionalInformation.visible = !isLoading
|
|
||||||
}
|
|
||||||
|
|
||||||
leftButton.visible = !isLoading
|
|
||||||
buttons.visible = !isLoading
|
|
||||||
}
|
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
id: linkAccountSpinner
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: false
|
|
||||||
running: true
|
|
||||||
|
|
||||||
width: 48
|
|
||||||
height: 48
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
id: mainTextContainer
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
text: qsTr("Username or password incorrect.")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
color: hifi.colors.redAccent
|
|
||||||
lineHeight: 1
|
|
||||||
lineHeightMode: Text.ProportionalHeight
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: form
|
|
||||||
anchors {
|
|
||||||
top: mainTextContainer.bottom
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: 2 * hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
spacing: 2 * hifi.dimensions.contentSpacing.y
|
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: usernameField
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 350
|
|
||||||
|
|
||||||
label: "Username or Email"
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
text: "<a href='https://highfidelity.com/users/password/new'>Forgot Username?</a>"
|
|
||||||
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
linkColor: hifi.colors.blueAccent
|
|
||||||
|
|
||||||
onLinkActivated: loginDialog.openUrl(link)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: passwordField
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 350
|
|
||||||
|
|
||||||
label: "Password"
|
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
text: "<a href='https://highfidelity.com/users/password/new'>Forgot Password?</a>"
|
|
||||||
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
linkColor: hifi.colors.blueAccent
|
|
||||||
|
|
||||||
onLinkActivated: loginDialog.openUrl(link)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoItem {
|
|
||||||
id: additionalInformation
|
|
||||||
anchors {
|
|
||||||
top: form.bottom
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: loginDialog.isSteamRunning()
|
|
||||||
|
|
||||||
text: qsTr("Your steam account informations will not be exposed to other users.")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
color: hifi.colors.baseGrayHighlight
|
|
||||||
lineHeight: 1
|
|
||||||
lineHeightMode: Text.ProportionalHeight
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override ScrollingWindow's keyboard that would be at very bottom of dialog.
|
|
||||||
Keyboard {
|
|
||||||
raised: keyboardEnabled && keyboardRaised
|
|
||||||
numeric: punctuationMode
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: buttons.top
|
|
||||||
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: leftButton
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Sign Up")
|
|
||||||
visible: !loginDialog.isSteamRunning()
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
bodyLoader.setSource("SignUpBody.qml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons
|
|
||||||
anchors {
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: linkAccountButton
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 200
|
|
||||||
|
|
||||||
text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login")
|
|
||||||
color: hifi.buttons.blue
|
|
||||||
|
|
||||||
onClicked: linkAccountBody.login()
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: qsTr("Cancel")
|
|
||||||
onClicked: {
|
|
||||||
bodyLoader.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loginDialogRoot.title = qsTr("Sign Into High Fidelity")
|
|
||||||
loginDialogRoot.iconText = "<"
|
|
||||||
keyboardEnabled = HMD.active;
|
|
||||||
d.resize();
|
|
||||||
|
|
||||||
if (failAfterSignUp) {
|
|
||||||
mainTextContainer.text = "Account created successfully."
|
|
||||||
mainTextContainer.visible = true
|
|
||||||
}
|
|
||||||
|
|
||||||
usernameField.forceActiveFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: loginDialog
|
|
||||||
onHandleLoginCompleted: {
|
|
||||||
console.log("Login Succeeded, linking steam account")
|
|
||||||
|
|
||||||
if (loginDialog.isSteamRunning()) {
|
|
||||||
loginDialog.linkSteam()
|
|
||||||
} else {
|
|
||||||
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onHandleLoginFailed: {
|
|
||||||
console.log("Login Failed")
|
|
||||||
mainTextContainer.visible = true
|
|
||||||
toggleLoading(false)
|
|
||||||
}
|
|
||||||
onHandleLinkCompleted: {
|
|
||||||
console.log("Link Succeeded")
|
|
||||||
|
|
||||||
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true })
|
|
||||||
}
|
|
||||||
onHandleLinkFailed: {
|
|
||||||
console.log("Link Failed")
|
|
||||||
toggleLoading(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onPressed: {
|
|
||||||
if (!visible) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event.key) {
|
|
||||||
case Qt.Key_Enter:
|
|
||||||
case Qt.Key_Return:
|
|
||||||
event.accepted = true
|
|
||||||
linkAccountBody.login()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
//
|
|
||||||
// SignInBody.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.Styles 1.4 as OriginalStyles
|
|
||||||
|
|
||||||
import "../controls-uit"
|
|
||||||
import "../styles-uit"
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: signInBody
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
property bool required: false
|
|
||||||
|
|
||||||
function login() {
|
|
||||||
console.log("Trying to log in")
|
|
||||||
loginDialog.loginThroughSteam()
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancel() {
|
|
||||||
bodyLoader.popup()
|
|
||||||
}
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
function resize() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoItem {
|
|
||||||
id: mainTextContainer
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
text: required ? qsTr("This domain's owner requires that you sign in:")
|
|
||||||
: qsTr("Sign in to access your user account:")
|
|
||||||
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
|
|
||||||
|
|
||||||
width: undefined // invalidate so that the image's size sets the width
|
|
||||||
height: undefined // invalidate so that the image's size sets the height
|
|
||||||
focus: true
|
|
||||||
|
|
||||||
style: OriginalStyles.ButtonStyle {
|
|
||||||
background: Image {
|
|
||||||
id: buttonImage
|
|
||||||
source: "../../images/steam-sign-in.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onClicked: signInBody.login()
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Cancel");
|
|
||||||
|
|
||||||
onClicked: signInBody.cancel()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loginDialogRoot.title = required ? qsTr("Sign In Required")
|
|
||||||
: qsTr("Sign In")
|
|
||||||
loginDialogRoot.iconText = ""
|
|
||||||
d.resize();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: loginDialog
|
|
||||||
onHandleLoginCompleted: {
|
|
||||||
console.log("Login Succeeded")
|
|
||||||
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true })
|
|
||||||
}
|
|
||||||
onHandleLoginFailed: {
|
|
||||||
console.log("Login Failed")
|
|
||||||
bodyLoader.setSource("CompleteProfileBody.qml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,276 +0,0 @@
|
||||||
//
|
|
||||||
// SignUpBody.qml
|
|
||||||
//
|
|
||||||
// Created by Stephen Birarda on 7 Dec 2016
|
|
||||||
// Copyright 2016 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: signupBody
|
|
||||||
clip: true
|
|
||||||
// height: parent.height
|
|
||||||
// width: parent.width
|
|
||||||
|
|
||||||
function signup() {
|
|
||||||
mainTextContainer.visible = false
|
|
||||||
toggleLoading(true)
|
|
||||||
loginDialog.signup(emailField.text, usernameField.text, passwordField.text)
|
|
||||||
}
|
|
||||||
|
|
||||||
property bool keyboardEnabled: false
|
|
||||||
property bool keyboardRaised: false
|
|
||||||
property bool punctuationMode: false
|
|
||||||
|
|
||||||
onKeyboardRaisedChanged: d.resize();
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
function resize() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleLoading(isLoading) {
|
|
||||||
linkAccountSpinner.visible = isLoading
|
|
||||||
form.visible = !isLoading
|
|
||||||
|
|
||||||
leftButton.visible = !isLoading
|
|
||||||
buttons.visible = !isLoading
|
|
||||||
}
|
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
id: linkAccountSpinner
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: false
|
|
||||||
running: true
|
|
||||||
|
|
||||||
width: 48
|
|
||||||
height: 48
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
id: mainTextContainer
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
text: qsTr("There was an unknown error while creating your account.")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
color: hifi.colors.redAccent
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: form
|
|
||||||
anchors {
|
|
||||||
top: mainTextContainer.bottom
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: 2 * hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
spacing: 2 * hifi.dimensions.contentSpacing.y
|
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: emailField
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 300
|
|
||||||
|
|
||||||
label: "Email"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: usernameField
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 300
|
|
||||||
|
|
||||||
label: "Username"
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
text: qsTr("No spaces / special chars.")
|
|
||||||
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
|
|
||||||
color: hifi.colors.blueAccent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: passwordField
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
width: 300
|
|
||||||
|
|
||||||
label: "Password"
|
|
||||||
echoMode: TextInput.Password
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
anchors {
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
text: qsTr("At least 6 characters")
|
|
||||||
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
|
|
||||||
color: hifi.colors.blueAccent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override ScrollingWindow's keyboard that would be at very bottom of dialog.
|
|
||||||
Keyboard {
|
|
||||||
raised: keyboardEnabled && keyboardRaised
|
|
||||||
numeric: punctuationMode
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: buttons.top
|
|
||||||
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: leftButton
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Existing User")
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
bodyLoader.setSource("LinkAccountBody.qml")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons
|
|
||||||
anchors {
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: linkAccountButton
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 200
|
|
||||||
|
|
||||||
text: qsTr("Sign Up")
|
|
||||||
color: hifi.buttons.blue
|
|
||||||
|
|
||||||
onClicked: signupBody.signup()
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Cancel")
|
|
||||||
|
|
||||||
onClicked: bodyLoader.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loginDialogRoot.title = qsTr("Create an Account")
|
|
||||||
loginDialogRoot.iconText = "<"
|
|
||||||
keyboardEnabled = HMD.active;
|
|
||||||
d.resize();
|
|
||||||
|
|
||||||
emailField.forceActiveFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: loginDialog
|
|
||||||
onHandleSignupCompleted: {
|
|
||||||
console.log("Sign Up Succeeded");
|
|
||||||
|
|
||||||
// now that we have an account, login with that username and password
|
|
||||||
loginDialog.login(usernameField.text, passwordField.text)
|
|
||||||
}
|
|
||||||
onHandleSignupFailed: {
|
|
||||||
console.log("Sign Up Failed")
|
|
||||||
toggleLoading(false)
|
|
||||||
|
|
||||||
mainTextContainer.text = errorString
|
|
||||||
mainTextContainer.visible = true
|
|
||||||
|
|
||||||
d.resize();
|
|
||||||
}
|
|
||||||
onHandleLoginCompleted: {
|
|
||||||
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack": false })
|
|
||||||
}
|
|
||||||
onHandleLoginFailed: {
|
|
||||||
// we failed to login, show the LoginDialog so the user will try again
|
|
||||||
bodyLoader.setSource("LinkAccountBody.qml", { "failAfterSignUp": true })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onPressed: {
|
|
||||||
if (!visible) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event.key) {
|
|
||||||
case Qt.Key_Enter:
|
|
||||||
case Qt.Key_Return:
|
|
||||||
event.accepted = true
|
|
||||||
signupBody.signup()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,157 +0,0 @@
|
||||||
//
|
|
||||||
// UsernameCollisionBody.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: usernameCollisionBody
|
|
||||||
clip: true
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
|
|
||||||
function create() {
|
|
||||||
mainTextContainer.visible = false
|
|
||||||
loginDialog.createAccountFromStream(textField.text)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
property bool keyboardEnabled: false
|
|
||||||
property bool keyboardRaised: false
|
|
||||||
property bool punctuationMode: false
|
|
||||||
|
|
||||||
onKeyboardRaisedChanged: d.resize();
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
function resize() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShortcutText {
|
|
||||||
id: mainTextContainer
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
text: qsTr("Your Steam username is not available.")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
color: hifi.colors.redAccent
|
|
||||||
lineHeight: 1
|
|
||||||
lineHeightMode: Text.ProportionalHeight
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: textField
|
|
||||||
anchors {
|
|
||||||
top: mainTextContainer.bottom
|
|
||||||
left: parent.left
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
width: 250
|
|
||||||
|
|
||||||
placeholderText: "Choose your own"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override ScrollingWindow's keyboard that would be at very bottom of dialog.
|
|
||||||
Keyboard {
|
|
||||||
raised: keyboardEnabled && keyboardRaised
|
|
||||||
numeric: punctuationMode
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: buttons.top
|
|
||||||
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttons
|
|
||||||
anchors {
|
|
||||||
bottom: parent.bottom
|
|
||||||
right: parent.right
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
|
||||||
onHeightChanged: d.resize(); onWidthChanged: d.resize();
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 200
|
|
||||||
|
|
||||||
text: qsTr("Create your profile")
|
|
||||||
color: hifi.buttons.blue
|
|
||||||
|
|
||||||
onClicked: usernameCollisionBody.create()
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
text: qsTr("Cancel")
|
|
||||||
onClicked: bodyLoader.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
loginDialogRoot.title = qsTr("Complete Your Profile")
|
|
||||||
loginDialogRoot.iconText = "<"
|
|
||||||
keyboardEnabled = HMD.active;
|
|
||||||
d.resize();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: loginDialog
|
|
||||||
onHandleCreateCompleted: {
|
|
||||||
console.log("Create Succeeded")
|
|
||||||
|
|
||||||
loginDialog.loginThroughSteam()
|
|
||||||
}
|
|
||||||
onHandleCreateFailed: {
|
|
||||||
console.log("Create Failed: " + error)
|
|
||||||
|
|
||||||
mainTextContainer.visible = true
|
|
||||||
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.")
|
|
||||||
}
|
|
||||||
onHandleLoginCompleted: {
|
|
||||||
console.log("Login Succeeded")
|
|
||||||
|
|
||||||
bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : false })
|
|
||||||
}
|
|
||||||
onHandleLoginFailed: {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,79 +0,0 @@
|
||||||
//
|
|
||||||
// WelcomeBody.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: welcomeBody
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
property bool welcomeBack: false
|
|
||||||
|
|
||||||
function setTitle() {
|
|
||||||
loginDialogRoot.title = (welcomeBack ? qsTr("Welcome back <b>") : qsTr("Welcome <b>")) + Account.username + qsTr("</b>!")
|
|
||||||
loginDialogRoot.iconText = ""
|
|
||||||
d.resize();
|
|
||||||
}
|
|
||||||
|
|
||||||
QtObject {
|
|
||||||
id: d
|
|
||||||
function resize() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoItem {
|
|
||||||
id: mainTextContainer
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
|
||||||
}
|
|
||||||
|
|
||||||
text: qsTr("You are now signed into High Fidelity")
|
|
||||||
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: bodyLoader.popup()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
welcomeBody.setTitle()
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Account
|
|
||||||
onUsernameChanged: welcomeBody.setTitle()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -31,6 +31,7 @@ TextField {
|
||||||
font.pixelSize: hifi.fontSizes.textFieldInput
|
font.pixelSize: hifi.fontSizes.textFieldInput
|
||||||
font.italic: textField.text == ""
|
font.italic: textField.text == ""
|
||||||
height: implicitHeight + 3 // Make surrounding box higher so that highlight is vertically centered.
|
height: implicitHeight + 3 // Make surrounding box higher so that highlight is vertically centered.
|
||||||
|
property alias textFieldLabel: textFieldLabel
|
||||||
|
|
||||||
y: textFieldLabel.visible ? textFieldLabel.height + textFieldLabel.anchors.bottomMargin : 0
|
y: textFieldLabel.visible ? textFieldLabel.height + textFieldLabel.anchors.bottomMargin : 0
|
||||||
|
|
||||||
|
|
|
@ -16,48 +16,63 @@ import "../controls-uit"
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
import "../windows"
|
import "../windows"
|
||||||
|
|
||||||
|
import "../LoginDialog"
|
||||||
|
|
||||||
TabletModalWindow {
|
TabletModalWindow {
|
||||||
id: loginDialogRoot
|
id: realRoot
|
||||||
objectName: "LoginDialog"
|
objectName: "LoginDialog"
|
||||||
|
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
property bool isHMD: false
|
property bool isHMD: false
|
||||||
property bool gotoPreviousApp: false;
|
property bool gotoPreviousApp: false;
|
||||||
color: hifi.colors.baseGray
|
color: hifi.colors.baseGray
|
||||||
|
title: qsTr("Sign in to High Fidelity")
|
||||||
|
property alias titleWidth: root.titleWidth
|
||||||
|
|
||||||
|
//fake root for shared components expecting root here
|
||||||
|
property var root: QtObject {
|
||||||
|
id: root
|
||||||
|
property alias title: realRoot.title
|
||||||
|
|
||||||
|
property real width: realRoot.width
|
||||||
|
property real height: realRoot.height
|
||||||
|
|
||||||
|
property int titleWidth: 0
|
||||||
|
property string iconText: hifi.glyphs.avatar
|
||||||
|
property int iconSize: 35
|
||||||
|
|
||||||
|
property var pane: QtObject {
|
||||||
|
property real width: root.width
|
||||||
|
property real height: root.height
|
||||||
|
}
|
||||||
|
|
||||||
|
function tryDestroy() {
|
||||||
|
canceled()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//property int colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
property int colorScheme: hifi.colorSchemes.dark
|
|
||||||
property int titleWidth: 0
|
|
||||||
property string iconText: ""
|
|
||||||
property int icon: hifi.icons.none
|
|
||||||
property int iconSize: 35
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
width: parent.width
|
width: realRoot.width
|
||||||
height: parent.height
|
height: realRoot.height
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool keyboardOverride: true
|
property bool keyboardOverride: true
|
||||||
onIconChanged: updateIcon();
|
|
||||||
|
|
||||||
property var items;
|
property var items;
|
||||||
property string label: ""
|
property string label: ""
|
||||||
|
|
||||||
onTitleWidthChanged: d.resize();
|
//onTitleWidthChanged: d.resize();
|
||||||
|
|
||||||
property bool keyboardEnabled: false
|
property bool keyboardEnabled: false
|
||||||
property bool keyboardRaised: false
|
property bool keyboardRaised: false
|
||||||
property bool punctuationMode: false
|
property bool punctuationMode: false
|
||||||
|
|
||||||
onKeyboardRaisedChanged: d.resize();
|
//onKeyboardRaisedChanged: d.resize();
|
||||||
|
|
||||||
signal canceled();
|
signal canceled();
|
||||||
|
|
||||||
function updateIcon() {
|
|
||||||
if (!root) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
iconText = hifi.glyphForIcon(root.icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
property alias bodyLoader: bodyLoader
|
property alias bodyLoader: bodyLoader
|
||||||
property alias loginDialog: loginDialog
|
property alias loginDialog: loginDialog
|
||||||
property alias hifi: hifi
|
property alias hifi: hifi
|
||||||
|
@ -65,9 +80,10 @@ TabletModalWindow {
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
onCanceled: {
|
onCanceled: {
|
||||||
if (loginDialogRoot.Stack.view) {
|
if (bodyLoader.active === true) {
|
||||||
loginDialogRoot.Stack.view.pop();
|
bodyLoader.active = false
|
||||||
} else if (gotoPreviousApp) {
|
}
|
||||||
|
if (gotoPreviousApp) {
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
tablet.returnToPreviousApp();
|
tablet.returnToPreviousApp();
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,45 +91,112 @@ TabletModalWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginDialog {
|
|
||||||
id: loginDialog
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
StackView {
|
|
||||||
id: bodyLoader
|
|
||||||
property var item: currentItem
|
|
||||||
property var props
|
|
||||||
property string source: ""
|
|
||||||
|
|
||||||
onCurrentItemChanged: {
|
TabletModalFrame {
|
||||||
//cleanup source for future usage
|
id: mfRoot
|
||||||
source = ""
|
|
||||||
|
width: root.width
|
||||||
|
height: root.height + frameMarginTop
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
onHeightChanged: console.log("tablet mf h:", height)
|
||||||
|
|
||||||
|
LoginDialog {
|
||||||
|
id: loginDialog
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
topMargin: parent.frameMarginTop
|
||||||
|
leftMargin: hifi.dimensions.contentMargin.x
|
||||||
|
rightMargin: hifi.dimensions.contentMargin.x
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSource(src, props) {
|
Loader {
|
||||||
source = "../TabletLoginDialog/" + src
|
id: bodyLoader
|
||||||
bodyLoader.props = props
|
anchors.fill: parent
|
||||||
}
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
function popup() {
|
source: loginDialog.isSteamRunning() ? "../LoginDialog/SignInBody.qml" : "../LoginDialog/LinkAccountBody.qml"
|
||||||
bodyLoader.pop()
|
|
||||||
|
|
||||||
//check if last screen, if yes, dialog is popped out
|
|
||||||
if (depth === 1)
|
|
||||||
loginDialogRoot.canceled()
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 10
|
|
||||||
onSourceChanged: {
|
|
||||||
if (source !== "") {
|
|
||||||
bodyLoader.push(Qt.resolvedUrl(source), props)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
setSource(loginDialog.isSteamRunning() ?
|
|
||||||
"SignInBody.qml" :
|
|
||||||
"LinkAccountBody.qml")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onPressed: {
|
||||||
|
if (!visible) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.modifiers === Qt.ControlModifier)
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_A:
|
||||||
|
event.accepted = true
|
||||||
|
detailedText.selectAll()
|
||||||
|
break
|
||||||
|
case Qt.Key_C:
|
||||||
|
event.accepted = true
|
||||||
|
detailedText.copy()
|
||||||
|
break
|
||||||
|
case Qt.Key_Period:
|
||||||
|
if (Qt.platform.os === "osx") {
|
||||||
|
event.accepted = true
|
||||||
|
content.reject()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
} else switch (event.key) {
|
||||||
|
case Qt.Key_Escape:
|
||||||
|
case Qt.Key_Back:
|
||||||
|
event.accepted = true
|
||||||
|
destroy()
|
||||||
|
break
|
||||||
|
|
||||||
|
case Qt.Key_Enter:
|
||||||
|
case Qt.Key_Return:
|
||||||
|
event.accepted = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// LoginDialog {
|
||||||
|
// id: loginDialog
|
||||||
|
// width: parent.width
|
||||||
|
// height: parent.height
|
||||||
|
// StackView {
|
||||||
|
// id: bodyLoader
|
||||||
|
// property var item: currentItem
|
||||||
|
// property var props
|
||||||
|
// property string source: ""
|
||||||
|
|
||||||
|
// onCurrentItemChanged: {
|
||||||
|
// //cleanup source for future usage
|
||||||
|
// source = ""
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function setSource(src, props) {
|
||||||
|
// source = "../TabletLoginDialog/" + src
|
||||||
|
// bodyLoader.props = props
|
||||||
|
// }
|
||||||
|
// function popup() {
|
||||||
|
// bodyLoader.pop()
|
||||||
|
|
||||||
|
// //check if last screen, if yes, dialog is popped out
|
||||||
|
// if (depth === 1)
|
||||||
|
// loginDialogRoot.canceled()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// anchors.fill: parent
|
||||||
|
// anchors.margins: 10
|
||||||
|
// onSourceChanged: {
|
||||||
|
// if (source !== "") {
|
||||||
|
// bodyLoader.push(Qt.resolvedUrl(source), props)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Component.onCompleted: {
|
||||||
|
// setSource(loginDialog.isSteamRunning() ?
|
||||||
|
// "SignInBody.qml" :
|
||||||
|
// "LinkAccountBody.qml")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue