Merge pull request #8840 from Atlante45/keyboard

Add virtual keyboard for steam username collision
This commit is contained in:
Howard Stearns 2016-10-18 17:34:55 -07:00 committed by GitHub
commit 20ed77d425
3 changed files with 75 additions and 27 deletions

View file

@ -29,8 +29,9 @@ Item {
readonly property int maxHeight: 720 readonly property int maxHeight: 720
function resize() { function resize() {
var targetWidth = Math.max(titleWidth, additionalTextContainer.contentWidth) var targetWidth = Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth,
var targetHeight = 4 * hifi.dimensions.contentSpacing.y + buttons.height + additionalTextContainer.height 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.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
@ -43,7 +44,7 @@ Item {
top: parent.top top: parent.top
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
margins: 0 margins: 0
topMargin: 3 * hifi.dimensions.contentSpacing.y topMargin: 2 * hifi.dimensions.contentSpacing.y
} }
spacing: hifi.dimensions.contentSpacing.x spacing: hifi.dimensions.contentSpacing.x
onHeightChanged: d.resize(); onWidthChanged: d.resize(); 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 <a href='https://highfidelity.com/terms'>High Fidelity's Terms of Service</a>")
wrapMode: Text.WordWrap
color: hifi.colors.baseGrayHighlight
lineHeight: 1
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
onLinkActivated: loginDialog.openUrl(link)
}
Component.onCompleted: { Component.onCompleted: {
root.title = qsTr("Complete Your Profile") root.title = qsTr("Complete Your Profile")
root.iconText = "<" root.iconText = "<"

View file

@ -42,8 +42,14 @@ Item {
function resize() { function resize() {
var targetWidth = Math.max(titleWidth, form.contentWidth); var targetWidth = Math.max(titleWidth, form.contentWidth);
var targetHeight = hifi.dimensions.contentSpacing.y + mainTextContainer.height var targetHeight = hifi.dimensions.contentSpacing.y + mainTextContainer.height +
+ 4 * hifi.dimensions.contentSpacing.y + form.height + hifi.dimensions.contentSpacing.y + buttons.height; 4 * hifi.dimensions.contentSpacing.y + form.height +
hifi.dimensions.contentSpacing.y + buttons.height;
if (additionalInformation.visible) {
targetWidth = Math.max(targetWidth, additionalInformation.width);
targetHeight += hifi.dimensions.contentSpacing.y + additionalInformation.height
}
root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)); root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
@ -136,6 +142,25 @@ Item {
} }
InfoItem {
id: additionalInformation
anchors {
top: form.bottom
left: parent.left
margins: 0
topMargin: hifi.dimensions.contentSpacing.y
}
visible: loginDialog.isSteamRunning()
text: qsTr("Your steam account informations will not be exposed to other users.")
wrapMode: Text.WordWrap
color: hifi.colors.baseGrayHighlight
lineHeight: 1
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
}
// Override ScrollingWindow's keyboard that would be at very bottom of dialog. // Override ScrollingWindow's keyboard that would be at very bottom of dialog.
Keyboard { Keyboard {
raised: keyboardEnabled && keyboardRaised raised: keyboardEnabled && keyboardRaised

View file

@ -27,6 +27,13 @@ Item {
loginDialog.createAccountFromStream(textField.text) loginDialog.createAccountFromStream(textField.text)
} }
property bool keyboardEnabled: false
property bool keyboardRaised: false
property bool punctuationMode: false
onKeyboardRaisedChanged: d.resize();
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -35,15 +42,16 @@ Item {
readonly property int maxHeight: 720 readonly property int maxHeight: 720
function resize() { function resize() {
var targetWidth = Math.max(titleWidth, Math.max(mainTextContainer.contentWidth, var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth)
termsContainer.contentWidth))
var targetHeight = mainTextContainer.height + var targetHeight = mainTextContainer.height +
2 * hifi.dimensions.contentSpacing.y + textField.height + hifi.dimensions.contentSpacing.y + textField.height +
5 * hifi.dimensions.contentSpacing.y + termsContainer.height + hifi.dimensions.contentSpacing.y + buttons.height
1 * hifi.dimensions.contentSpacing.y + buttons.height
root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)) root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) 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 top: mainTextContainer.bottom
left: parent.left left: parent.left
margins: 0 margins: 0
topMargin: 2 * hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }
width: 250 width: 250
placeholderText: "Choose your own" placeholderText: "Choose your own"
} }
InfoItem { // Override ScrollingWindow's keyboard that would be at very bottom of dialog.
id: termsContainer Keyboard {
raised: keyboardEnabled && keyboardRaised
numeric: punctuationMode
anchors { anchors {
top: textField.bottom
left: parent.left left: parent.left
margins: 0 right: parent.right
topMargin: 3 * hifi.dimensions.contentSpacing.y bottom: buttons.top
bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
} }
text: qsTr("By creating this user profile, you agree to <a href='https://highfidelity.com/terms'>High Fidelity's Terms of Service</a>")
wrapMode: Text.WordWrap
color: hifi.colors.baseGrayHighlight
lineHeight: 1
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
onLinkActivated: loginDialog.openUrl(link)
} }
Row { Row {
id: buttons id: buttons
anchors { anchors {
top: termsContainer.bottom bottom: parent.bottom
right: parent.right right: parent.right
margins: 0 margins: 0
topMargin: 1 * hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }
spacing: hifi.dimensions.contentSpacing.x spacing: hifi.dimensions.contentSpacing.x
onHeightChanged: d.resize(); onWidthChanged: d.resize(); onHeightChanged: d.resize(); onWidthChanged: d.resize();
@ -130,8 +131,10 @@ Item {
Component.onCompleted: { Component.onCompleted: {
root.title = qsTr("Complete Your Profile") root.title = qsTr("Complete Your Profile")
root.iconText = "<" root.iconText = "<"
keyboardEnabled = HMD.active;
d.resize(); d.resize();
} }
Connections { Connections {
target: loginDialog target: loginDialog
onHandleCreateCompleted: { onHandleCreateCompleted: {