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

View file

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