mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
adding steam linking
This commit is contained in:
parent
dc3381d4a9
commit
e7e42e3430
5 changed files with 33 additions and 50 deletions
|
@ -27,6 +27,7 @@ Item {
|
||||||
readonly property bool fontBold: true
|
readonly property bool fontBold: true
|
||||||
|
|
||||||
readonly property bool withSteam: withSteam
|
readonly property bool withSteam: withSteam
|
||||||
|
property string errorString: errorString
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -94,31 +95,14 @@ Item {
|
||||||
// above buttons.
|
// above buttons.
|
||||||
anchors.topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y - profileButton.height
|
anchors.topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y - profileButton.height
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: (parent.width - loginErrorMessageTextMetrics.width) / 2;
|
||||||
color: "red";
|
color: "red";
|
||||||
font.family: "Cairo"
|
font.family: completeProfileBody.fontFamily
|
||||||
font.pixelSize: 12
|
font.pixelSize: completeProfileBody.fontSize
|
||||||
text: ""
|
text: completeProfileBody.errorString
|
||||||
visible: true
|
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 {
|
Item {
|
||||||
id: buttons
|
id: buttons
|
||||||
width: banner.width
|
width: banner.width
|
||||||
|
@ -236,7 +220,7 @@ Item {
|
||||||
console.log("Create Succeeded")
|
console.log("Create Succeeded")
|
||||||
|
|
||||||
loginDialog.loginThroughSteam();
|
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: {
|
onHandleCreateFailed: {
|
||||||
console.log("Create Failed: " + error);
|
console.log("Create Failed: " + error);
|
||||||
|
|
|
@ -65,7 +65,7 @@ Item {
|
||||||
|
|
||||||
function login() {
|
function login() {
|
||||||
loginDialog.login(emailField.text, passwordField.text);
|
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() {
|
function init() {
|
||||||
|
@ -302,7 +302,7 @@ Item {
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
topMargin: hifi.dimensions.contentSpacing.y
|
||||||
}
|
}
|
||||||
onClicked: {
|
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 {
|
HifiControlsUit.Button {
|
||||||
|
@ -386,7 +386,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader,
|
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: {
|
Component.onCompleted: {
|
||||||
if (linkAccountBody.linkSteam) {
|
if (linkAccountBody.linkSteam) {
|
||||||
|
@ -512,11 +512,7 @@ Item {
|
||||||
case Qt.Key_Return:
|
case Qt.Key_Return:
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
|
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
|
||||||
if (linkAccountBody.linkSteam) {
|
linkAccountBody.login();
|
||||||
linkAccountBody.linkSteam();
|
|
||||||
} else {
|
|
||||||
linkAccountBody.login();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ Item {
|
||||||
property bool fontBold: true
|
property bool fontBold: true
|
||||||
property bool withSteam: withSteam
|
property bool withSteam: withSteam
|
||||||
property bool withOculus: withOculus
|
property bool withOculus: withOculus
|
||||||
|
property bool linkSteam: linkSteam
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -88,6 +89,11 @@ Item {
|
||||||
}
|
}
|
||||||
function loadingSuccess() {
|
function loadingSuccess() {
|
||||||
loggingInSpinner.visible = false;
|
loggingInSpinner.visible = false;
|
||||||
|
if (loggingInBody.linkSteam) {
|
||||||
|
loggingInText.text = "Linking to Steam";
|
||||||
|
loginDialog.linkSteam();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (loggingInBody.withSteam) {
|
if (loggingInBody.withSteam) {
|
||||||
// reset the flag.
|
// reset the flag.
|
||||||
loggingInGlyph.visible = false;
|
loggingInGlyph.visible = false;
|
||||||
|
@ -247,9 +253,18 @@ Item {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: loginDialog
|
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: {
|
onHandleLoginCompleted: {
|
||||||
console.log("Login Succeeded")
|
console.log("Login Succeeded");
|
||||||
loadingSuccess();
|
loadingSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ Item {
|
||||||
function login() {
|
function login() {
|
||||||
loginDialog.signup(emailField.text, usernameField.text, passwordField.text);
|
loginDialog.signup(emailField.text, usernameField.text, passwordField.text);
|
||||||
return;
|
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() {
|
function init() {
|
||||||
|
@ -433,7 +433,7 @@ Item {
|
||||||
console.log("Sign Up Completed");
|
console.log("Sign Up Completed");
|
||||||
|
|
||||||
loginDialog.login(usernameField.text, passwordField.text);
|
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: {
|
onHandleSignupFailed: {
|
||||||
console.log("Sign Up Failed")
|
console.log("Sign Up Failed")
|
||||||
|
|
|
@ -25,8 +25,6 @@ Item {
|
||||||
readonly property int fontSize: 15
|
readonly property int fontSize: 15
|
||||||
readonly property bool fontBold: true
|
readonly property bool fontBold: true
|
||||||
|
|
||||||
readonly property string errorString: errorString
|
|
||||||
|
|
||||||
function create() {
|
function create() {
|
||||||
mainTextContainer.visible = false
|
mainTextContainer.visible = false
|
||||||
loginDialog.createAccountFromSteam(textField.text);
|
loginDialog.createAccountFromSteam(textField.text);
|
||||||
|
@ -110,7 +108,7 @@ Item {
|
||||||
font.family: usernameCollisionBody.fontFamily
|
font.family: usernameCollisionBody.fontFamily
|
||||||
font.pixelSize: usernameCollisionBody.fontSize
|
font.pixelSize: usernameCollisionBody.fontSize
|
||||||
font.bold: usernameCollisionBody.fontBold
|
font.bold: usernameCollisionBody.fontBold
|
||||||
text: qsTr("Your Steam username is not available.")
|
text: qsTr("Your Steam username is not available.");
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
color: hifi.colors.redAccent
|
color: hifi.colors.redAccent
|
||||||
lineHeight: 1
|
lineHeight: 1
|
||||||
|
@ -194,7 +192,7 @@ Item {
|
||||||
fontSize: usernameCollisionBody.fontSize
|
fontSize: usernameCollisionBody.fontSize
|
||||||
fontBold: usernameCollisionBody.fontBold
|
fontBold: usernameCollisionBody.fontBold
|
||||||
onClicked: {
|
onClicked: {
|
||||||
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
|
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": "" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HifiControlsUit.Button {
|
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 {
|
Connections {
|
||||||
target: loginDialog
|
target: loginDialog
|
||||||
onHandleCreateCompleted: {
|
onHandleCreateCompleted: {
|
||||||
console.log("Create Succeeded")
|
console.log("Create Succeeded");
|
||||||
loginDialog.loginThroughSteam();
|
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: {
|
onHandleCreateFailed: {
|
||||||
console.log("Create Failed: " + error)
|
console.log("Create Failed: " + error)
|
||||||
|
|
||||||
mainTextContainer.visible = true
|
mainTextContainer.visible = true
|
||||||
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.")
|
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.");
|
||||||
}
|
}
|
||||||
onHandleLoginCompleted: {
|
onHandleLoginCompleted: {
|
||||||
console.log("Login Succeeded");
|
console.log("Login Succeeded");
|
||||||
|
|
Loading…
Reference in a new issue