adding more qml for oculus login

This commit is contained in:
Wayne Chen 2019-01-14 08:36:56 -08:00
parent 39a68a88f0
commit ca0916886a
3 changed files with 27 additions and 13 deletions

View file

@ -78,14 +78,18 @@ Item {
loginDialog.isLogIn = true; loginDialog.isLogIn = true;
loginErrorMessage.text = linkAccountBody.errorString; loginErrorMessage.text = linkAccountBody.errorString;
loginErrorMessage.visible = (linkAccountBody.errorString !== ""); loginErrorMessage.visible = (linkAccountBody.errorString !== "");
if (loginErrorMessageTextMetrics.width > emailField.width) {
loginErrorMessage.wrapMode = Text.WordWrap;
errorContainer.height = (loginErrorMessageTextMetrics.width / emailField.width) * loginErrorMessageTextMetrics.height;
}
loginButton.text = (!linkAccountBody.linkSteam && !linkAccountBody.linkOculus) ? "Log In" : "Link Account"; loginButton.text = (!linkAccountBody.linkSteam && !linkAccountBody.linkOculus) ? "Log In" : "Link Account";
loginButton.color = hifi.buttons.blue; loginButton.color = hifi.buttons.blue;
emailField.placeholderText = "Username or Email"; emailField.placeholderText = "Username or Email";
var savedUsername = Settings.getValue("keepMeLoggedIn/savedUsername", ""); var savedUsername = Settings.getValue("keepMeLoggedIn/savedUsername", "");
emailField.text = keepMeLoggedInCheckbox.checked ? savedUsername === "Unknown user" ? "" : savedUsername : ""; emailField.text = keepMeLoggedInCheckbox.checked ? savedUsername === "Unknown user" ? "" : savedUsername : "";
if (linkAccountBody.linkSteam || linkAccountBody.linkOculus) { if (linkAccountBody.linkSteam || linkAccountBody.linkOculus) {
steamInfoText.anchors.top = passwordField.bottom; linkInfoText.anchors.top = passwordField.bottom;
keepMeLoggedInCheckbox.anchors.top = steamInfoText.bottom; keepMeLoggedInCheckbox.anchors.top = linkInfoText.bottom;
loginButton.width = (passwordField.width - hifi.dimensions.contentSpacing.x) / 2; loginButton.width = (passwordField.width - hifi.dimensions.contentSpacing.x) / 2;
loginButton.anchors.right = emailField.right; loginButton.anchors.right = emailField.right;
} else { } else {
@ -111,7 +115,7 @@ Item {
id: loginContainer id: loginContainer
width: emailField.width width: emailField.width
height: errorContainer.height + emailField.height + passwordField.height + 5.5 * hifi.dimensions.contentSpacing.y + height: errorContainer.height + emailField.height + passwordField.height + 5.5 * hifi.dimensions.contentSpacing.y +
keepMeLoggedInCheckbox.height + loginButton.height + cantAccessTextMetrics.height + continueButton.height + steamInfoTextMetrics.height keepMeLoggedInCheckbox.height + loginButton.height + cantAccessTextMetrics.height + continueButton.height + linkInfoTextMetrics.height
anchors { anchors {
top: parent.top top: parent.top
topMargin: root.bannerHeight + 0.25 * parent.height topMargin: root.bannerHeight + 0.25 * parent.height
@ -121,7 +125,7 @@ Item {
Item { Item {
id: errorContainer id: errorContainer
width: loginErrorMessageTextMetrics.width width: parent.width
height: loginErrorMessageTextMetrics.height height: loginErrorMessageTextMetrics.height
anchors { anchors {
bottom: emailField.top; bottom: emailField.top;
@ -317,12 +321,12 @@ Item {
} }
} }
TextMetrics { TextMetrics {
id: steamInfoTextMetrics id: linkInfoTextMetrics
font: steamInfoText.font font: linkInfoText.font
text: steamInfoText.text text: linkInfoText.text
} }
Text { Text {
id: steamInfoText id: linkInfoText
width: root.bannerWidth width: root.bannerWidth
visible: linkAccountBody.linkSteam || linkAccountBody.linkOculus visible: linkAccountBody.linkSteam || linkAccountBody.linkOculus
anchors { anchors {
@ -334,12 +338,17 @@ Item {
font.family: linkAccountBody.fontFamily font.family: linkAccountBody.fontFamily
font.pixelSize: linkAccountBody.textFieldFontSize font.pixelSize: linkAccountBody.textFieldFontSize
color: "white" color: "white"
text: qsTr("Your Steam account information will not be exposed to others."); text: qsTr("");
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
Component.onCompleted: { Component.onCompleted: {
if (steamInfoTextMetrics.width > root.bannerWidth) { if (linkAccountBody.linkOculus) {
steamInfoText.wrapMode = Text.WordWrap; linkInfoText.text = qsTr("Your Oculus account information will not be exposed to others.");
} else if (linkAccountBody.linkSteam) {
linkInfoText.text = qsTr("Your Steam account information will not be exposed to others.");
}
if (linkInfoTextMetrics.width > root.bannerWidth) {
linkInfoText.wrapMode = Text.WordWrap;
} }
} }
} }

View file

@ -28,10 +28,14 @@ Item {
property bool withSteam: withSteam property bool withSteam: withSteam
property bool withOculus: withOculus property bool withOculus: withOculus
function create() { function create() {
mainTextContainer.visible = false mainTextContainer.visible = false
loginDialog.createAccountFromSteam(textField.text); if (usernameCollisionBody.withOculus) {
loginDialog.createAccountFromOculus(textField.text);
} else if (usernameCollisionBody.withSteam) {
loginDialog.createAccountFromSteam(textField.text);
}
} }
property bool keyboardEnabled: false property bool keyboardEnabled: false

View file

@ -80,6 +80,7 @@ void OculusAPIPlugin::handleOVREvents() {
if (!ovr_Message_IsError(message)) { if (!ovr_Message_IsError(message)) {
ovrUserProofHandle userProof = ovr_Message_GetUserProof(message); ovrUserProofHandle userProof = ovr_Message_GetUserProof(message);
_nonce = ovr_UserProof_GetNonce(userProof); _nonce = ovr_UserProof_GetNonce(userProof);
qCDebug(oculusLog) << "Oculus Platform nonce retrieval succeeded: " << _nonce;
} else { } else {
qCDebug(oculusLog) << "Oculus Platform nonce retrieval failed" << QString(ovr_Error_GetMessage(ovr_Message_GetError(message))); qCDebug(oculusLog) << "Oculus Platform nonce retrieval failed" << QString(ovr_Error_GetMessage(ovr_Message_GetError(message)));
_nonce = ""; _nonce = "";