Implemented single keyboard instance for all Tablet login dialog items

This commit is contained in:
vladest 2017-10-04 19:33:36 +02:00
parent 6fddf49988
commit 0a505617df
6 changed files with 52 additions and 32 deletions

View file

@ -29,11 +29,12 @@ Item {
readonly property int maxHeight: 720 readonly property int maxHeight: 720
function resize() { function resize() {
var targetWidth = Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth, if (root.isTablet === false) {
termsContainer.contentWidth)) var targetWidth = Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth,
termsContainer.contentWidth))
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
}
var targetHeight = 5 * hifi.dimensions.contentSpacing.y + buttons.height + additionalTextContainer.height + termsContainer.height var targetHeight = 5 * hifi.dimensions.contentSpacing.y + buttons.height + additionalTextContainer.height + termsContainer.height
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
} }
} }
@ -61,10 +62,7 @@ Item {
Button { Button {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: qsTr("Cancel") text: qsTr("Cancel")
onClicked: root.tryDestroy() onClicked: root.tryDestroy()
} }
} }
@ -96,17 +94,19 @@ Item {
id: termsContainer id: termsContainer
anchors { anchors {
top: additionalTextContainer.bottom top: additionalTextContainer.bottom
left: parent.left
margins: 0 margins: 0
topMargin: 2 * hifi.dimensions.contentSpacing.y topMargin: 2 * hifi.dimensions.contentSpacing.y
horizontalCenter: parent.horizontalCenter
} }
width: parent.width
text: qsTr("By creating this user profile, you agree to <a href='https://highfidelity.com/terms'>High Fidelity's Terms of Service</a>") 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 wrapMode: Text.WordWrap
color: hifi.colors.baseGrayHighlight color: hifi.colors.baseGrayHighlight
lineHeight: 1 lineHeight: 1
lineHeightMode: Text.ProportionalHeight lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter fontSizeMode: Text.HorizontalFit
horizontalAlignment: Text.AlignVCenter
onLinkActivated: loginDialog.openUrl(link) onLinkActivated: loginDialog.openUrl(link)
} }
@ -128,8 +128,10 @@ Item {
console.log("Create Failed: " + error) console.log("Create Failed: " + error)
bodyLoader.source = "UsernameCollisionBody.qml" bodyLoader.source = "UsernameCollisionBody.qml"
bodyLoader.item.width = root.pane.width if (!root.isTablet) {
bodyLoader.item.height = root.pane.height bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
} }
onHandleLoginCompleted: { onHandleLoginCompleted: {
console.log("Login Succeeded") console.log("Login Succeeded")

View file

@ -45,8 +45,7 @@ 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/* + 4 * hifi.dimensions.contentSpacing.y + form.height;
hifi.dimensions.contentSpacing.y + buttons.height*/;
if (additionalInformation.visible) { if (additionalInformation.visible) {
targetWidth = Math.max(targetWidth, additionalInformation.width); targetWidth = Math.max(targetWidth, additionalInformation.width);
@ -118,7 +117,7 @@ Item {
TextField { TextField {
id: usernameField id: usernameField
width: parent.width width: parent.width
focus: true
label: "Username or Email" label: "Username or Email"
ShortcutText { ShortcutText {
@ -225,8 +224,10 @@ Item {
onClicked: { onClicked: {
bodyLoader.setSource("SignUpBody.qml") bodyLoader.setSource("SignUpBody.qml")
bodyLoader.item.width = root.pane.width if (!root.isTablet) {
bodyLoader.item.height = root.pane.height bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
} }
} }
} }
@ -255,7 +256,7 @@ Item {
root.keyboardEnabled = HMD.active; root.keyboardEnabled = HMD.active;
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })
} }
//d.resize(); d.resize();
if (failAfterSignUp) { if (failAfterSignUp) {
mainTextContainer.text = "Account created successfully." mainTextContainer.text = "Account created successfully."

View file

@ -121,8 +121,10 @@ Item {
console.log("Login Failed") console.log("Login Failed")
bodyLoader.source = "CompleteProfileBody.qml" bodyLoader.source = "CompleteProfileBody.qml"
bodyLoader.item.width = root.pane.width if (!root.isTablet) {
bodyLoader.item.height = root.pane.height bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
} }
} }
} }

View file

@ -44,8 +44,7 @@ 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/* + 4 * hifi.dimensions.contentSpacing.y + form.height;
hifi.dimensions.contentSpacing.y + buttons.height*/;
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth)); parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight))
@ -168,8 +167,10 @@ Item {
onClicked: { onClicked: {
bodyLoader.setSource("LinkAccountBody.qml") bodyLoader.setSource("LinkAccountBody.qml")
bodyLoader.item.width = root.pane.width if (!root.isTablet) {
bodyLoader.item.height = root.pane.height bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
} }
} }
} }
@ -216,7 +217,13 @@ Item {
Component.onCompleted: { Component.onCompleted: {
root.title = qsTr("Create an Account") root.title = qsTr("Create an Account")
root.iconText = "<" root.iconText = "<"
keyboardEnabled = HMD.active; //dont rise local keyboard
keyboardEnabled = !root.isTablet && HMD.active;
//but rise Tablet's one instead for Tablet interface
if (root.isTablet) {
root.keyboardEnabled = HMD.active;
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })
}
d.resize(); d.resize();
emailField.forceActiveFocus(); emailField.forceActiveFocus();
@ -247,8 +254,10 @@ Item {
onHandleLoginFailed: { onHandleLoginFailed: {
// we failed to login, show the LoginDialog so the user will try again // we failed to login, show the LoginDialog so the user will try again
bodyLoader.setSource("LinkAccountBody.qml", { "failAfterSignUp": true }) bodyLoader.setSource("LinkAccountBody.qml", { "failAfterSignUp": true })
bodyLoader.item.width = root.pane.width if (!root.isTablet) {
bodyLoader.item.height = root.pane.height bodyLoader.item.width = root.pane.width
bodyLoader.item.height = root.pane.height
}
} }
} }

View file

@ -79,7 +79,7 @@ Item {
margins: 0 margins: 0
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }
width: 250 width: parent.width
placeholderText: "Choose your own" placeholderText: "Choose your own"
} }
@ -102,7 +102,7 @@ Item {
bottom: parent.bottom bottom: parent.bottom
right: parent.right right: parent.right
margins: 0 margins: 0
topMargin: hifi.dimensions.contentSpacing.y bottomMargin: 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();
@ -129,7 +129,14 @@ Item {
Component.onCompleted: { Component.onCompleted: {
root.title = qsTr("Complete Your Profile") root.title = qsTr("Complete Your Profile")
root.iconText = "<" root.iconText = "<"
keyboardEnabled = HMD.active; //dont rise local keyboard
keyboardEnabled = !root.isTablet && HMD.active;
//but rise Tablet's one instead for Tablet interface
if (root.isTablet) {
root.keyboardEnabled = HMD.active;
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })
}
d.resize(); d.resize();
} }

View file

@ -93,7 +93,6 @@ TabletModalWindow {
} }
} }
TabletModalFrame { TabletModalFrame {
id: mfRoot id: mfRoot
@ -103,6 +102,7 @@ TabletModalWindow {
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
verticalCenterOffset: -loginKeyboard.height / 2
} }
LoginDialog { LoginDialog {
@ -126,14 +126,13 @@ TabletModalWindow {
} }
Keyboard { Keyboard {
id: loginKeyboard
raised: root.keyboardEnabled && root.keyboardRaised raised: root.keyboardEnabled && root.keyboardRaised
numeric: root.punctuationMode numeric: root.punctuationMode
enabled: true
anchors { anchors {
left: parent.left left: parent.left
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
bottomMargin: root.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0
} }
} }