adding steam linking

This commit is contained in:
Wayne Chen 2018-12-04 10:03:40 -08:00
parent dc3381d4a9
commit e7e42e3430
5 changed files with 33 additions and 50 deletions

View file

@ -27,6 +27,7 @@ Item {
readonly property bool fontBold: true
readonly property bool withSteam: withSteam
property string errorString: errorString
QtObject {
id: d
@ -94,31 +95,14 @@ Item {
// above buttons.
anchors.topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y - profileButton.height
anchors.left: parent.left;
anchors.leftMargin: (parent.width - loginErrorMessageTextMetrics.width) / 2;
color: "red";
font.family: "Cairo"
font.pixelSize: 12
text: ""
font.family: completeProfileBody.fontFamily
font.pixelSize: completeProfileBody.fontSize
text: completeProfileBody.errorString
visible: true
}
HifiStylesUit.HiFiGlyphs {
id: loggedInGlyph;
text: hifi.glyphs.steamSquare;
// color
color: "white"
// Size
size: 78;
// Anchors
anchors.left: parent.left;
anchors.leftMargin: (parent.width - loggedInGlyph.size) / 2;
anchors.top: loginErrorMessage.bottom
anchors.topMargin: 2 * hifi.dimensions.contentSpacing.y
// Alignment
horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignVCenter;
visible: false;
}
Item {
id: buttons
width: banner.width
@ -236,7 +220,7 @@ Item {
console.log("Create Succeeded")
loginDialog.loginThroughSteam();
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true });
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true, "linkSteam": false });
}
onHandleCreateFailed: {
console.log("Create Failed: " + error);

View file

@ -65,7 +65,7 @@ Item {
function login() {
loginDialog.login(emailField.text, passwordField.text);
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "withOculus": false });
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "withOculus": false, "linkSteam": linkAccountBody.linkSteam });
}
function init() {
@ -302,7 +302,7 @@ Item {
topMargin: hifi.dimensions.contentSpacing.y
}
onClicked: {
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, "errorString": errorString });
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, "errorString": "" });
}
}
HifiControlsUit.Button {
@ -386,7 +386,7 @@ Item {
}
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader,
"withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus });
"withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam });
}
Component.onCompleted: {
if (linkAccountBody.linkSteam) {
@ -512,11 +512,7 @@ Item {
case Qt.Key_Return:
event.accepted = true;
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
if (linkAccountBody.linkSteam) {
linkAccountBody.linkSteam();
} else {
linkAccountBody.login();
}
linkAccountBody.login();
break;
}
}

View file

@ -26,6 +26,7 @@ Item {
property bool fontBold: true
property bool withSteam: withSteam
property bool withOculus: withOculus
property bool linkSteam: linkSteam
QtObject {
id: d
@ -88,6 +89,11 @@ Item {
}
function loadingSuccess() {
loggingInSpinner.visible = false;
if (loggingInBody.linkSteam) {
loggingInText.text = "Linking to Steam";
loginDialog.linkSteam();
return;
}
if (loggingInBody.withSteam) {
// reset the flag.
loggingInGlyph.visible = false;
@ -247,9 +253,18 @@ Item {
Connections {
target: loginDialog
onHandleLinkCompleted: {
console.log("Link Succeeded");
loggingInBody.linkSteam = false;
loadingSuccess();
}
onHandleLinkFailed: {
console.log("Link Failed: " + error);
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "linkSteam": true, "errorString": error });
}
onHandleLoginCompleted: {
console.log("Login Succeeded")
console.log("Login Succeeded");
loadingSuccess();
}

View file

@ -67,7 +67,7 @@ Item {
function login() {
loginDialog.signup(emailField.text, usernameField.text, passwordField.text);
return;
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "withOculus": false });
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "withOculus": false, "linkSteam": false });
}
function init() {
@ -433,7 +433,7 @@ Item {
console.log("Sign Up Completed");
loginDialog.login(usernameField.text, passwordField.text);
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false });
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "linkSteam": false });
}
onHandleSignupFailed: {
console.log("Sign Up Failed")

View file

@ -25,8 +25,6 @@ Item {
readonly property int fontSize: 15
readonly property bool fontBold: true
readonly property string errorString: errorString
function create() {
mainTextContainer.visible = false
loginDialog.createAccountFromSteam(textField.text);
@ -110,7 +108,7 @@ Item {
font.family: usernameCollisionBody.fontFamily
font.pixelSize: usernameCollisionBody.fontSize
font.bold: usernameCollisionBody.fontBold
text: qsTr("Your Steam username is not available.")
text: qsTr("Your Steam username is not available.");
wrapMode: Text.WordWrap
color: hifi.colors.redAccent
lineHeight: 1
@ -194,7 +192,7 @@ Item {
fontSize: usernameCollisionBody.fontSize
fontBold: usernameCollisionBody.fontBold
onClicked: {
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": "" });
}
}
HifiControlsUit.Button {
@ -219,28 +217,18 @@ Item {
}
}
// Component.onCompleted: {
// root.text = "";
// d.resize();
// textField.focus = true;
// if (usernameCollisionBody.errorString !== "") {
// mainTextContainer.visible = true;
// mainTextContainer.text = usernameCollisionBody.errorString;
// }
// }
Connections {
target: loginDialog
onHandleCreateCompleted: {
console.log("Create Succeeded")
console.log("Create Succeeded");
loginDialog.loginThroughSteam();
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true })
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true, "linkSteam": false })
}
onHandleCreateFailed: {
console.log("Create Failed: " + error)
mainTextContainer.visible = true
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.")
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.");
}
onHandleLoginCompleted: {
console.log("Login Succeeded");