From c40a027108ce01298585fa29865c362108f8d7e4 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 17 Oct 2016 15:53:21 -0700 Subject: [PATCH] Add virtual keyboard for steam username collision --- .../qml/LoginDialog/CompleteProfileBody.qml | 26 ++++++++-- .../qml/LoginDialog/UsernameCollisionBody.qml | 47 ++++++++++--------- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index fc7eac3d00..f1b36ff6a7 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -29,8 +29,9 @@ Item { readonly property int maxHeight: 720 function resize() { - var targetWidth = Math.max(titleWidth, additionalTextContainer.contentWidth) - var targetHeight = 4 * hifi.dimensions.contentSpacing.y + buttons.height + additionalTextContainer.height + var targetWidth = Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth, + termsContainer.contentWidth)) + var targetHeight = 5 * hifi.dimensions.contentSpacing.y + buttons.height + additionalTextContainer.height + termsContainer.height root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) @@ -43,7 +44,7 @@ Item { top: parent.top horizontalCenter: parent.horizontalCenter margins: 0 - topMargin: 3 * hifi.dimensions.contentSpacing.y + topMargin: 2 * hifi.dimensions.contentSpacing.y } spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); @@ -91,6 +92,25 @@ Item { } } + 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 High Fidelity's Terms of Service") + wrapMode: Text.WordWrap + color: hifi.colors.baseGrayHighlight + lineHeight: 1 + lineHeightMode: Text.ProportionalHeight + horizontalAlignment: Text.AlignHCenter + + onLinkActivated: loginDialog.openUrl(link) + } + Component.onCompleted: { root.title = qsTr("Complete Your Profile") root.iconText = "<" diff --git a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml index b949c660d6..eafe9e4b47 100644 --- a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml +++ b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml @@ -27,6 +27,13 @@ Item { loginDialog.createAccountFromStream(textField.text) } + + property bool keyboardEnabled: false + property bool keyboardRaised: false + property bool punctuationMode: false + + onKeyboardRaisedChanged: d.resize(); + QtObject { id: d readonly property int minWidth: 480 @@ -35,15 +42,16 @@ Item { readonly property int maxHeight: 720 function resize() { - var targetWidth = Math.max(titleWidth, Math.max(mainTextContainer.contentWidth, - termsContainer.contentWidth)) + var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth) var targetHeight = mainTextContainer.height + - 2 * hifi.dimensions.contentSpacing.y + textField.height + - 5 * hifi.dimensions.contentSpacing.y + termsContainer.height + - 1 * hifi.dimensions.contentSpacing.y + buttons.height + hifi.dimensions.contentSpacing.y + textField.height + + hifi.dimensions.contentSpacing.y + buttons.height root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) + + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y) + + height = root.height } } @@ -71,39 +79,32 @@ Item { top: mainTextContainer.bottom left: parent.left margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y + topMargin: hifi.dimensions.contentSpacing.y } width: 250 placeholderText: "Choose your own" } - InfoItem { - id: termsContainer + // Override ScrollingWindow's keyboard that would be at very bottom of dialog. + Keyboard { + raised: keyboardEnabled && keyboardRaised + numeric: punctuationMode anchors { - top: textField.bottom left: parent.left - margins: 0 - topMargin: 3 * hifi.dimensions.contentSpacing.y + right: parent.right + bottom: buttons.top + bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 } - - text: qsTr("By creating this user profile, you agree to High Fidelity's Terms of Service") - wrapMode: Text.WordWrap - color: hifi.colors.baseGrayHighlight - lineHeight: 1 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - - onLinkActivated: loginDialog.openUrl(link) } Row { id: buttons anchors { - top: termsContainer.bottom + bottom: parent.bottom right: parent.right margins: 0 - topMargin: 1 * hifi.dimensions.contentSpacing.y + topMargin: hifi.dimensions.contentSpacing.y } spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); @@ -130,8 +131,10 @@ Item { Component.onCompleted: { root.title = qsTr("Complete Your Profile") root.iconText = "<" + keyboardEnabled = HMD.active; d.resize(); } + Connections { target: loginDialog onHandleCreateCompleted: {