From 0a505617df86a58ee95460e10c7bb40b716dbc44 Mon Sep 17 00:00:00 2001 From: vladest Date: Wed, 4 Oct 2017 19:33:36 +0200 Subject: [PATCH] Implemented single keyboard instance for all Tablet login dialog items --- .../qml/LoginDialog/CompleteProfileBody.qml | 24 ++++++++++--------- .../qml/LoginDialog/LinkAccountBody.qml | 13 +++++----- .../resources/qml/LoginDialog/SignInBody.qml | 6 +++-- .../resources/qml/LoginDialog/SignUpBody.qml | 23 ++++++++++++------ .../qml/LoginDialog/UsernameCollisionBody.qml | 13 +++++++--- .../qml/dialogs/TabletLoginDialog.qml | 5 ++-- 6 files changed, 52 insertions(+), 32 deletions(-) diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index 2c6bc1082a..fe4c511f1d 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -29,11 +29,12 @@ Item { readonly property int maxHeight: 720 function resize() { - var targetWidth = Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth, - termsContainer.contentWidth)) + if (root.isTablet === false) { + 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 - - 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)) } } @@ -61,10 +62,7 @@ Item { Button { anchors.verticalCenter: parent.verticalCenter - text: qsTr("Cancel") - - onClicked: root.tryDestroy() } } @@ -96,17 +94,19 @@ Item { id: termsContainer anchors { top: additionalTextContainer.bottom - left: parent.left margins: 0 topMargin: 2 * hifi.dimensions.contentSpacing.y + horizontalCenter: parent.horizontalCenter } + width: parent.width 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 + fontSizeMode: Text.HorizontalFit + horizontalAlignment: Text.AlignVCenter onLinkActivated: loginDialog.openUrl(link) } @@ -128,8 +128,10 @@ Item { console.log("Create Failed: " + error) bodyLoader.source = "UsernameCollisionBody.qml" - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height + if (!root.isTablet) { + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } } onHandleLoginCompleted: { console.log("Login Succeeded") diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index dd38b641bb..c73aab08c3 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -45,8 +45,7 @@ Item { function resize() { var targetWidth = Math.max(titleWidth, form.contentWidth); 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; if (additionalInformation.visible) { targetWidth = Math.max(targetWidth, additionalInformation.width); @@ -118,7 +117,7 @@ Item { TextField { id: usernameField width: parent.width - + focus: true label: "Username or Email" ShortcutText { @@ -225,8 +224,10 @@ Item { onClicked: { bodyLoader.setSource("SignUpBody.qml") - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height + if (!root.isTablet) { + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } } } } @@ -255,7 +256,7 @@ Item { root.keyboardEnabled = HMD.active; root.keyboardRaised = Qt.binding( function() { return keyboardRaised; }) } - //d.resize(); + d.resize(); if (failAfterSignUp) { mainTextContainer.text = "Account created successfully." diff --git a/interface/resources/qml/LoginDialog/SignInBody.qml b/interface/resources/qml/LoginDialog/SignInBody.qml index 71ec03f7ff..c4b6c2aee1 100644 --- a/interface/resources/qml/LoginDialog/SignInBody.qml +++ b/interface/resources/qml/LoginDialog/SignInBody.qml @@ -121,8 +121,10 @@ Item { console.log("Login Failed") bodyLoader.source = "CompleteProfileBody.qml" - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height + if (!root.isTablet) { + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } } } } diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index c4056422dd..f6cf40db8e 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -44,8 +44,7 @@ Item { function resize() { var targetWidth = Math.max(titleWidth, form.contentWidth); 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; 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)) @@ -168,8 +167,10 @@ Item { onClicked: { bodyLoader.setSource("LinkAccountBody.qml") - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height + if (!root.isTablet) { + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } } } } @@ -216,7 +217,13 @@ Item { Component.onCompleted: { root.title = qsTr("Create an Account") 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(); emailField.forceActiveFocus(); @@ -247,8 +254,10 @@ Item { onHandleLoginFailed: { // we failed to login, show the LoginDialog so the user will try again bodyLoader.setSource("LinkAccountBody.qml", { "failAfterSignUp": true }) - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height + if (!root.isTablet) { + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } } } diff --git a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml index b049d7f8bb..5c212578b8 100644 --- a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml +++ b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml @@ -79,7 +79,7 @@ Item { margins: 0 topMargin: hifi.dimensions.contentSpacing.y } - width: 250 + width: parent.width placeholderText: "Choose your own" } @@ -102,7 +102,7 @@ Item { bottom: parent.bottom right: parent.right margins: 0 - topMargin: hifi.dimensions.contentSpacing.y + bottomMargin: hifi.dimensions.contentSpacing.y } spacing: hifi.dimensions.contentSpacing.x onHeightChanged: d.resize(); onWidthChanged: d.resize(); @@ -129,7 +129,14 @@ Item { Component.onCompleted: { root.title = qsTr("Complete Your Profile") 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(); } diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 334cb9304f..29276a2ccf 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -93,7 +93,6 @@ TabletModalWindow { } } - TabletModalFrame { id: mfRoot @@ -103,6 +102,7 @@ TabletModalWindow { anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.verticalCenter + verticalCenterOffset: -loginKeyboard.height / 2 } LoginDialog { @@ -126,14 +126,13 @@ TabletModalWindow { } Keyboard { + id: loginKeyboard raised: root.keyboardEnabled && root.keyboardRaised numeric: root.punctuationMode - enabled: true anchors { left: parent.left right: parent.right bottom: parent.bottom - bottomMargin: root.keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 } }