From d5381a810ec508425f362fdda0dbef6b1f5bc0c7 Mon Sep 17 00:00:00 2001 From: Nick Shaffner Date: Sat, 9 Sep 2017 12:55:28 -0700 Subject: [PATCH 01/23] brew tap homebrew/versions no longer works. (or is needed) The command now outputs: > brew tap homebrew/versions Warning: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated. nonetheless: > brew install cmake openssl still works. --- BUILD_OSX.md | 1 - 1 file changed, 1 deletion(-) diff --git a/BUILD_OSX.md b/BUILD_OSX.md index 3365627b8c..586f81def3 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -4,7 +4,6 @@ Please read the [general build guide](BUILD.md) for information on dependencies [Homebrew](https://brew.sh/) is an excellent package manager for OS X. It makes install of some High Fidelity dependencies very simple. - brew tap homebrew/versions brew install cmake openssl ### OpenSSL From 4f907aba1e1100ccc02ed15eb0f4accdfcebd734 Mon Sep 17 00:00:00 2001 From: vladest Date: Thu, 28 Sep 2017 14:49:48 +0200 Subject: [PATCH 02/23] sign in reworked --- interface/resources/qml/LoginDialog.qml | 4 + .../qml/LoginDialog/LinkAccountBody.qml | 194 ++++++------ .../resources/qml/LoginDialog/SignInBody.qml | 6 +- .../resources/qml/LoginDialog/SignUpBody.qml | 5 +- .../TabletLoginDialog/CompleteProfileBody.qml | 124 -------- .../qml/TabletLoginDialog/LinkAccountBody.qml | 296 ------------------ .../qml/TabletLoginDialog/SignInBody.qml | 109 ------- .../qml/TabletLoginDialog/SignUpBody.qml | 276 ---------------- .../UsernameCollisionBody.qml | 157 ---------- .../qml/TabletLoginDialog/WelcomeBody.qml | 79 ----- .../resources/qml/controls-uit/TextField.qml | 1 + .../qml/dialogs/TabletLoginDialog.qml | 195 ++++++++---- 12 files changed, 248 insertions(+), 1198 deletions(-) delete mode 100644 interface/resources/qml/TabletLoginDialog/CompleteProfileBody.qml delete mode 100644 interface/resources/qml/TabletLoginDialog/LinkAccountBody.qml delete mode 100644 interface/resources/qml/TabletLoginDialog/SignInBody.qml delete mode 100644 interface/resources/qml/TabletLoginDialog/SignUpBody.qml delete mode 100644 interface/resources/qml/TabletLoginDialog/UsernameCollisionBody.qml delete mode 100644 interface/resources/qml/TabletLoginDialog/WelcomeBody.qml diff --git a/interface/resources/qml/LoginDialog.qml b/interface/resources/qml/LoginDialog.qml index 2e7ff39ed6..315cda3551 100644 --- a/interface/resources/qml/LoginDialog.qml +++ b/interface/resources/qml/LoginDialog.qml @@ -35,6 +35,10 @@ ModalWindow { keyboardOverride: true // Disable ModalWindow's keyboard. + function tryDestroy() { + root.destroy() + } + LoginDialog { id: loginDialog diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index e27635dbbd..7f69e41958 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -9,7 +9,7 @@ // import Hifi 1.0 -import QtQuick 2.4 +import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 as OriginalStyles @@ -56,6 +56,7 @@ Item { 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)) + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y); + console.log("sign in h:", targetHeight, parent.height) } } @@ -108,30 +109,27 @@ Item { Column { id: form + width: parent.width + onHeightChanged: d.resize(); onWidthChanged: d.resize(); + anchors { top: mainTextContainer.bottom - left: parent.left - margins: 0 topMargin: 2 * hifi.dimensions.contentSpacing.y } spacing: 2 * hifi.dimensions.contentSpacing.y - Row { - spacing: hifi.dimensions.contentSpacing.x - TextField { - id: usernameField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 + TextField { + id: usernameField + width: parent.width - label: "Username or Email" - } + label: "Username or Email" ShortcutText { anchors { - verticalCenter: parent.verticalCenter + verticalCenter: usernameField.textFieldLabel.verticalCenter + left: usernameField.textFieldLabel.right + leftMargin: 10 } text: "Forgot Username?" @@ -143,23 +141,19 @@ Item { onLinkActivated: loginDialog.openUrl(link) } } - Row { - spacing: hifi.dimensions.contentSpacing.x - TextField { - id: passwordField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 + TextField { + id: passwordField + width: parent.width - label: "Password" - echoMode: TextInput.Password - } + label: "Password" + echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password ShortcutText { anchors { - verticalCenter: parent.verticalCenter + verticalCenter: passwordField.textFieldLabel.verticalCenter + left: passwordField.textFieldLabel.right + leftMargin: 10 } text: "Forgot Password?" @@ -172,25 +166,86 @@ Item { } } - } - - InfoItem { - id: additionalInformation - anchors { - top: form.bottom - left: parent.left - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y + CheckBoxQQC2 { + id: showPassword + text: "Show password" } - visible: loginDialog.isSteamRunning() + InfoItem { + id: additionalInformation + anchors { + left: parent.left + margins: 0 + topMargin: hifi.dimensions.contentSpacing.y + } - 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 + 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 + } + + Column { + //width: parent.width + spacing: hifi.dimensions.contentSpacing.y*2 + anchors.horizontalCenter: parent.horizontalCenter + //padding: 10 + + Row { + id: buttons + spacing: hifi.dimensions.contentSpacing.y*2 + onHeightChanged: d.resize(); onWidthChanged: d.resize(); + anchors.horizontalCenter: parent.horizontalCenter + + Button { + id: linkAccountButton + anchors.verticalCenter: parent.verticalCenter + width: 200 + + text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login") + color: hifi.buttons.blue + + onClicked: linkAccountBody.login() + } + + Button { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Cancel") + onClicked: root.tryDestroy() + } + } + + Row { + id: leftButton + + anchors.horizontalCenter: parent.horizontalCenter + spacing: hifi.dimensions.contentSpacing.x + onHeightChanged: d.resize(); onWidthChanged: d.resize(); + + RalewaySemiBold { + size: hifi.fontSizes.inputLabel + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Don't have an account?") + } + + Button { + anchors.verticalCenter: parent.verticalCenter + + text: qsTr("Sign Up") + visible: !loginDialog.isSteamRunning() + + onClicked: { + bodyLoader.setSource("SignUpBody.qml") + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } + } + } + } } // Override ScrollingWindow's keyboard that would be at very bottom of dialog. @@ -200,65 +255,12 @@ Item { anchors { left: parent.left right: parent.right - bottom: buttons.top + bottom: parent.bottom bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 } } - Row { - id: leftButton - anchors { - left: parent.left - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Sign Up") - visible: !loginDialog.isSteamRunning() - - onClicked: { - bodyLoader.setSource("SignUpBody.qml") - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } - } - } - - Row { - id: buttons - anchors { - right: parent.right - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - id: linkAccountButton - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login") - color: hifi.buttons.blue - - onClicked: linkAccountBody.login() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Cancel") - - onClicked: root.destroy() - } - } Component.onCompleted: { root.title = qsTr("Sign Into High Fidelity") diff --git a/interface/resources/qml/LoginDialog/SignInBody.qml b/interface/resources/qml/LoginDialog/SignInBody.qml index 167ed1640a..71ec03f7ff 100644 --- a/interface/resources/qml/LoginDialog/SignInBody.qml +++ b/interface/resources/qml/LoginDialog/SignInBody.qml @@ -9,7 +9,7 @@ // import Hifi 1.0 -import QtQuick 2.4 +import QtQuick 2.7 import QtQuick.Controls.Styles 1.4 as OriginalStyles import "../controls-uit" @@ -18,8 +18,8 @@ import "../styles-uit" Item { id: signInBody clip: true - width: root.pane.width height: root.pane.height + width: root.pane.width property bool required: false @@ -29,7 +29,7 @@ Item { } function cancel() { - root.destroy() + root.tryDestroy() } QtObject { diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index c0ff2d77cb..c7bfa8cfcd 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -9,7 +9,7 @@ // import Hifi 1.0 -import QtQuick 2.4 +import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 as OriginalStyles @@ -50,6 +50,7 @@ Item { 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)) + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : 0); + //console.log("sign up h:", parent.height) } } @@ -237,7 +238,7 @@ Item { text: qsTr("Cancel") - onClicked: root.destroy() + onClicked: root.tryDestroy() } } diff --git a/interface/resources/qml/TabletLoginDialog/CompleteProfileBody.qml b/interface/resources/qml/TabletLoginDialog/CompleteProfileBody.qml deleted file mode 100644 index 6024563bcf..0000000000 --- a/interface/resources/qml/TabletLoginDialog/CompleteProfileBody.qml +++ /dev/null @@ -1,124 +0,0 @@ -// -// CompleteProfileBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 -import QtQuick.Controls.Styles 1.4 as OriginalStyles - -import "../controls-uit" -import "../styles-uit" - -Item { - id: completeProfileBody - clip: true - - QtObject { - id: d - function resize() {} - } - - Row { - id: buttons - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr("Create your profile") - color: hifi.buttons.blue - - onClicked: loginDialog.createAccountFromStream() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Cancel") - - onClicked: bodyLoader.popup() - } - } - - ShortcutText { - id: additionalTextContainer - anchors { - top: buttons.bottom - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - text: "Already have a High Fidelity profile? Link to an existing profile here." - - wrapMode: Text.WordWrap - lineHeight: 2 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - - onLinkActivated: { - bodyLoader.setSource("LinkAccountBody.qml") - } - } - - 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: { - loginDialogRoot.title = qsTr("Complete Your Profile") - loginDialogRoot.iconText = "<" - d.resize(); - } - - Connections { - target: loginDialog - onHandleCreateCompleted: { - console.log("Create Succeeded") - - loginDialog.loginThroughSteam() - } - onHandleCreateFailed: { - console.log("Create Failed: " + error) - - bodyLoadersetSource("UsernameCollisionBody.qml") - } - onHandleLoginCompleted: { - console.log("Login Succeeded") - - bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : false }) - } - onHandleLoginFailed: { - console.log("Login Failed") - } - } -} diff --git a/interface/resources/qml/TabletLoginDialog/LinkAccountBody.qml b/interface/resources/qml/TabletLoginDialog/LinkAccountBody.qml deleted file mode 100644 index 8010a34250..0000000000 --- a/interface/resources/qml/TabletLoginDialog/LinkAccountBody.qml +++ /dev/null @@ -1,296 +0,0 @@ -// -// LinkAccountBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 as OriginalStyles - -import "../controls-uit" -import "../styles-uit" - -Item { - id: linkAccountBody - clip: true - height: parent.height - width: parent.width - property bool failAfterSignUp: false - - function login() { - mainTextContainer.visible = false - toggleLoading(true) - loginDialog.login(usernameField.text, passwordField.text) - } - - property bool keyboardEnabled: false - property bool keyboardRaised: false - property bool punctuationMode: false - - onKeyboardRaisedChanged: d.resize(); - - QtObject { - id: d - function resize() {} - } - - function toggleLoading(isLoading) { - linkAccountSpinner.visible = isLoading - form.visible = !isLoading - - if (loginDialog.isSteamRunning()) { - additionalInformation.visible = !isLoading - } - - leftButton.visible = !isLoading - buttons.visible = !isLoading - } - - BusyIndicator { - id: linkAccountSpinner - - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - topMargin: hifi.dimensions.contentSpacing.y - } - - visible: false - running: true - - width: 48 - height: 48 - } - - ShortcutText { - id: mainTextContainer - anchors { - top: parent.top - left: parent.left - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - visible: false - - text: qsTr("Username or password incorrect.") - wrapMode: Text.WordWrap - color: hifi.colors.redAccent - lineHeight: 1 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - } - - Column { - id: form - anchors { - top: mainTextContainer.bottom - left: parent.left - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - spacing: 2 * hifi.dimensions.contentSpacing.y - - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: usernameField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 - - label: "Username or Email" - } - - ShortcutText { - anchors { - verticalCenter: parent.verticalCenter - } - - text: "Forgot Username?" - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - linkColor: hifi.colors.blueAccent - - onLinkActivated: loginDialog.openUrl(link) - } - } - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: passwordField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 - - label: "Password" - echoMode: TextInput.Password - } - - ShortcutText { - anchors { - verticalCenter: parent.verticalCenter - } - - text: "Forgot Password?" - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - linkColor: hifi.colors.blueAccent - - onLinkActivated: loginDialog.openUrl(link) - } - } - - } - - 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. - Keyboard { - raised: keyboardEnabled && keyboardRaised - numeric: punctuationMode - anchors { - left: parent.left - right: parent.right - bottom: buttons.top - bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 - } - } - - Row { - id: leftButton - anchors { - left: parent.left - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Sign Up") - visible: !loginDialog.isSteamRunning() - - onClicked: { - bodyLoader.setSource("SignUpBody.qml") - } - } - } - - Row { - id: buttons - anchors { - right: parent.right - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - id: linkAccountButton - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login") - color: hifi.buttons.blue - - onClicked: linkAccountBody.login() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Cancel") - onClicked: { - bodyLoader.popup() - } - } - } - - Component.onCompleted: { - loginDialogRoot.title = qsTr("Sign Into High Fidelity") - loginDialogRoot.iconText = "<" - keyboardEnabled = HMD.active; - d.resize(); - - if (failAfterSignUp) { - mainTextContainer.text = "Account created successfully." - mainTextContainer.visible = true - } - - usernameField.forceActiveFocus(); - } - - Connections { - target: loginDialog - onHandleLoginCompleted: { - console.log("Login Succeeded, linking steam account") - - if (loginDialog.isSteamRunning()) { - loginDialog.linkSteam() - } else { - bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true }) - } - } - onHandleLoginFailed: { - console.log("Login Failed") - mainTextContainer.visible = true - toggleLoading(false) - } - onHandleLinkCompleted: { - console.log("Link Succeeded") - - bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true }) - } - onHandleLinkFailed: { - console.log("Link Failed") - toggleLoading(false) - } - } - - Keys.onPressed: { - if (!visible) { - return - } - - switch (event.key) { - case Qt.Key_Enter: - case Qt.Key_Return: - event.accepted = true - linkAccountBody.login() - break - } - } -} diff --git a/interface/resources/qml/TabletLoginDialog/SignInBody.qml b/interface/resources/qml/TabletLoginDialog/SignInBody.qml deleted file mode 100644 index 9cdf69c7bc..0000000000 --- a/interface/resources/qml/TabletLoginDialog/SignInBody.qml +++ /dev/null @@ -1,109 +0,0 @@ -// -// SignInBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 -import QtQuick.Controls.Styles 1.4 as OriginalStyles - -import "../controls-uit" -import "../styles-uit" - -Item { - id: signInBody - clip: true - - property bool required: false - - function login() { - console.log("Trying to log in") - loginDialog.loginThroughSteam() - } - - function cancel() { - bodyLoader.popup() - } - - QtObject { - id: d - function resize() {} - } - - InfoItem { - id: mainTextContainer - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - text: required ? qsTr("This domain's owner requires that you sign in:") - : qsTr("Sign in to access your user account:") - wrapMode: Text.WordWrap - color: hifi.colors.baseGrayHighlight - lineHeight: 2 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - } - - Row { - id: buttons - anchors { - top: mainTextContainer.bottom - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - width: undefined // invalidate so that the image's size sets the width - height: undefined // invalidate so that the image's size sets the height - focus: true - - style: OriginalStyles.ButtonStyle { - background: Image { - id: buttonImage - source: "../../images/steam-sign-in.png" - } - } - onClicked: signInBody.login() - } - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Cancel"); - - onClicked: signInBody.cancel() - } - } - - Component.onCompleted: { - loginDialogRoot.title = required ? qsTr("Sign In Required") - : qsTr("Sign In") - loginDialogRoot.iconText = "" - d.resize(); - } - - Connections { - target: loginDialog - onHandleLoginCompleted: { - console.log("Login Succeeded") - bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : true }) - } - onHandleLoginFailed: { - console.log("Login Failed") - bodyLoader.setSource("CompleteProfileBody.qml") - } - } -} diff --git a/interface/resources/qml/TabletLoginDialog/SignUpBody.qml b/interface/resources/qml/TabletLoginDialog/SignUpBody.qml deleted file mode 100644 index 2cfc0e736a..0000000000 --- a/interface/resources/qml/TabletLoginDialog/SignUpBody.qml +++ /dev/null @@ -1,276 +0,0 @@ -// -// SignUpBody.qml -// -// Created by Stephen Birarda on 7 Dec 2016 -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 as OriginalStyles - -import "../controls-uit" -import "../styles-uit" - -Item { - id: signupBody - clip: true -// height: parent.height -// width: parent.width - - function signup() { - mainTextContainer.visible = false - toggleLoading(true) - loginDialog.signup(emailField.text, usernameField.text, passwordField.text) - } - - property bool keyboardEnabled: false - property bool keyboardRaised: false - property bool punctuationMode: false - - onKeyboardRaisedChanged: d.resize(); - - QtObject { - id: d - function resize() {} - } - - function toggleLoading(isLoading) { - linkAccountSpinner.visible = isLoading - form.visible = !isLoading - - leftButton.visible = !isLoading - buttons.visible = !isLoading - } - - BusyIndicator { - id: linkAccountSpinner - - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - topMargin: hifi.dimensions.contentSpacing.y - } - - visible: false - running: true - - width: 48 - height: 48 - } - - ShortcutText { - id: mainTextContainer - anchors { - top: parent.top - left: parent.left - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - visible: false - - text: qsTr("There was an unknown error while creating your account.") - wrapMode: Text.WordWrap - color: hifi.colors.redAccent - horizontalAlignment: Text.AlignLeft - } - - Column { - id: form - anchors { - top: mainTextContainer.bottom - left: parent.left - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - spacing: 2 * hifi.dimensions.contentSpacing.y - - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: emailField - anchors { - verticalCenter: parent.verticalCenter - } - width: 300 - - label: "Email" - } - } - - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: usernameField - anchors { - verticalCenter: parent.verticalCenter - } - width: 300 - - label: "Username" - } - - ShortcutText { - anchors { - verticalCenter: parent.verticalCenter - } - - text: qsTr("No spaces / special chars.") - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - - color: hifi.colors.blueAccent - } - } - - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: passwordField - anchors { - verticalCenter: parent.verticalCenter - } - width: 300 - - label: "Password" - echoMode: TextInput.Password - } - - ShortcutText { - anchors { - verticalCenter: parent.verticalCenter - } - - text: qsTr("At least 6 characters") - - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - - color: hifi.colors.blueAccent - } - } - - } - - // Override ScrollingWindow's keyboard that would be at very bottom of dialog. - Keyboard { - raised: keyboardEnabled && keyboardRaised - numeric: punctuationMode - anchors { - left: parent.left - right: parent.right - bottom: buttons.top - bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 - } - } - - Row { - id: leftButton - anchors { - left: parent.left - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Existing User") - - onClicked: { - bodyLoader.setSource("LinkAccountBody.qml") - } - } - } - - Row { - id: buttons - anchors { - right: parent.right - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - id: linkAccountButton - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr("Sign Up") - color: hifi.buttons.blue - - onClicked: signupBody.signup() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Cancel") - - onClicked: bodyLoader.popup() - } - } - - Component.onCompleted: { - loginDialogRoot.title = qsTr("Create an Account") - loginDialogRoot.iconText = "<" - keyboardEnabled = HMD.active; - d.resize(); - - emailField.forceActiveFocus(); - } - - Connections { - target: loginDialog - onHandleSignupCompleted: { - console.log("Sign Up Succeeded"); - - // now that we have an account, login with that username and password - loginDialog.login(usernameField.text, passwordField.text) - } - onHandleSignupFailed: { - console.log("Sign Up Failed") - toggleLoading(false) - - mainTextContainer.text = errorString - mainTextContainer.visible = true - - d.resize(); - } - onHandleLoginCompleted: { - bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack": false }) - } - onHandleLoginFailed: { - // we failed to login, show the LoginDialog so the user will try again - bodyLoader.setSource("LinkAccountBody.qml", { "failAfterSignUp": true }) - } - } - - Keys.onPressed: { - if (!visible) { - return - } - - switch (event.key) { - case Qt.Key_Enter: - case Qt.Key_Return: - event.accepted = true - signupBody.signup() - break - } - } -} diff --git a/interface/resources/qml/TabletLoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/TabletLoginDialog/UsernameCollisionBody.qml deleted file mode 100644 index 9e5b01d339..0000000000 --- a/interface/resources/qml/TabletLoginDialog/UsernameCollisionBody.qml +++ /dev/null @@ -1,157 +0,0 @@ -// -// UsernameCollisionBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 as OriginalStyles - -import "../controls-uit" -import "../styles-uit" - -Item { - id: usernameCollisionBody - clip: true - width: parent.width - height: parent.height - - function create() { - mainTextContainer.visible = false - loginDialog.createAccountFromStream(textField.text) - } - - - property bool keyboardEnabled: false - property bool keyboardRaised: false - property bool punctuationMode: false - - onKeyboardRaisedChanged: d.resize(); - - QtObject { - id: d - function resize() {} - } - - ShortcutText { - id: mainTextContainer - anchors { - top: parent.top - left: parent.left - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - text: qsTr("Your Steam username is not available.") - wrapMode: Text.WordWrap - color: hifi.colors.redAccent - lineHeight: 1 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - } - - - TextField { - id: textField - anchors { - top: mainTextContainer.bottom - left: parent.left - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - width: 250 - - placeholderText: "Choose your own" - } - - // Override ScrollingWindow's keyboard that would be at very bottom of dialog. - Keyboard { - raised: keyboardEnabled && keyboardRaised - numeric: punctuationMode - anchors { - left: parent.left - right: parent.right - bottom: buttons.top - bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 - } - } - - Row { - id: buttons - anchors { - bottom: parent.bottom - right: parent.right - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr("Create your profile") - color: hifi.buttons.blue - - onClicked: usernameCollisionBody.create() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Cancel") - onClicked: bodyLoader.popup() - } - } - - Component.onCompleted: { - loginDialogRoot.title = qsTr("Complete Your Profile") - loginDialogRoot.iconText = "<" - keyboardEnabled = HMD.active; - d.resize(); - } - - Connections { - target: loginDialog - onHandleCreateCompleted: { - console.log("Create Succeeded") - - loginDialog.loginThroughSteam() - } - onHandleCreateFailed: { - console.log("Create Failed: " + error) - - mainTextContainer.visible = true - mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.") - } - onHandleLoginCompleted: { - console.log("Login Succeeded") - - bodyLoader.setSource("WelcomeBody.qml", { "welcomeBack" : false }) - } - onHandleLoginFailed: { - console.log("Login Failed") - } - } - - Keys.onPressed: { - if (!visible) { - return - } - - switch (event.key) { - case Qt.Key_Enter: - case Qt.Key_Return: - event.accepted = true - usernameCollisionBody.create() - break - } - } -} diff --git a/interface/resources/qml/TabletLoginDialog/WelcomeBody.qml b/interface/resources/qml/TabletLoginDialog/WelcomeBody.qml deleted file mode 100644 index 5ec259ca96..0000000000 --- a/interface/resources/qml/TabletLoginDialog/WelcomeBody.qml +++ /dev/null @@ -1,79 +0,0 @@ -// -// WelcomeBody.qml -// -// Created by Clement on 7/18/16 -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -import Hifi 1.0 -import QtQuick 2.4 - -import "../controls-uit" -import "../styles-uit" - -Item { - id: welcomeBody - clip: true - - property bool welcomeBack: false - - function setTitle() { - loginDialogRoot.title = (welcomeBack ? qsTr("Welcome back ") : qsTr("Welcome ")) + Account.username + qsTr("!") - loginDialogRoot.iconText = "" - d.resize(); - } - - QtObject { - id: d - function resize() {} - } - - InfoItem { - id: mainTextContainer - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } - - text: qsTr("You are now signed into High Fidelity") - wrapMode: Text.WordWrap - color: hifi.colors.baseGrayHighlight - lineHeight: 2 - lineHeightMode: Text.ProportionalHeight - horizontalAlignment: Text.AlignHCenter - } - - Row { - id: buttons - anchors { - top: mainTextContainer.bottom - horizontalCenter: parent.horizontalCenter - margins: 0 - topMargin: 2 * hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Close"); - - onClicked: bodyLoader.popup() - } - } - - Component.onCompleted: { - welcomeBody.setTitle() - } - - Connections { - target: Account - onUsernameChanged: welcomeBody.setTitle() - } -} diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index 65fab00700..a1c98b54d4 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -31,6 +31,7 @@ TextField { font.pixelSize: hifi.fontSizes.textFieldInput font.italic: textField.text == "" height: implicitHeight + 3 // Make surrounding box higher so that highlight is vertically centered. + property alias textFieldLabel: textFieldLabel y: textFieldLabel.visible ? textFieldLabel.height + textFieldLabel.anchors.bottomMargin : 0 diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 36ca480b24..ae00cb3d40 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -16,48 +16,63 @@ import "../controls-uit" import "../styles-uit" import "../windows" +import "../LoginDialog" + TabletModalWindow { - id: loginDialogRoot + id: realRoot objectName: "LoginDialog" signal sendToScript(var message); property bool isHMD: false property bool gotoPreviousApp: false; color: hifi.colors.baseGray + title: qsTr("Sign in to High Fidelity") + property alias titleWidth: root.titleWidth + + //fake root for shared components expecting root here + property var root: QtObject { + id: root + property alias title: realRoot.title + + property real width: realRoot.width + property real height: realRoot.height + + property int titleWidth: 0 + property string iconText: hifi.glyphs.avatar + property int iconSize: 35 + + property var pane: QtObject { + property real width: root.width + property real height: root.height + } + + function tryDestroy() { + canceled() + } + } + + //property int colorScheme: hifi.colorSchemes.dark - property int colorScheme: hifi.colorSchemes.dark - property int titleWidth: 0 - property string iconText: "" - property int icon: hifi.icons.none - property int iconSize: 35 MouseArea { - width: parent.width - height: parent.height + width: realRoot.width + height: realRoot.height } property bool keyboardOverride: true - onIconChanged: updateIcon(); property var items; property string label: "" - onTitleWidthChanged: d.resize(); + //onTitleWidthChanged: d.resize(); property bool keyboardEnabled: false property bool keyboardRaised: false property bool punctuationMode: false - onKeyboardRaisedChanged: d.resize(); + //onKeyboardRaisedChanged: d.resize(); signal canceled(); - function updateIcon() { - if (!root) { - return; - } - iconText = hifi.glyphForIcon(root.icon); - } - property alias bodyLoader: bodyLoader property alias loginDialog: loginDialog property alias hifi: hifi @@ -65,9 +80,10 @@ TabletModalWindow { HifiConstants { id: hifi } onCanceled: { - if (loginDialogRoot.Stack.view) { - loginDialogRoot.Stack.view.pop(); - } else if (gotoPreviousApp) { + if (bodyLoader.active === true) { + bodyLoader.active = false + } + if (gotoPreviousApp) { var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); tablet.returnToPreviousApp(); } else { @@ -75,45 +91,112 @@ TabletModalWindow { } } - LoginDialog { - id: loginDialog - width: parent.width - height: parent.height - StackView { - id: bodyLoader - property var item: currentItem - property var props - property string source: "" - onCurrentItemChanged: { - //cleanup source for future usage - source = "" + TabletModalFrame { + id: mfRoot + + width: root.width + height: root.height + frameMarginTop + + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + onHeightChanged: console.log("tablet mf h:", height) + + LoginDialog { + id: loginDialog + + anchors { + fill: parent + topMargin: parent.frameMarginTop + leftMargin: hifi.dimensions.contentMargin.x + rightMargin: hifi.dimensions.contentMargin.x + horizontalCenter: parent.horizontalCenter } - function setSource(src, props) { - source = "../TabletLoginDialog/" + src - bodyLoader.props = props - } - function popup() { - bodyLoader.pop() - - //check if last screen, if yes, dialog is popped out - if (depth === 1) - loginDialogRoot.canceled() - } - - anchors.fill: parent - anchors.margins: 10 - onSourceChanged: { - if (source !== "") { - bodyLoader.push(Qt.resolvedUrl(source), props) - } - } - Component.onCompleted: { - setSource(loginDialog.isSteamRunning() ? - "SignInBody.qml" : - "LinkAccountBody.qml") + Loader { + id: bodyLoader + anchors.fill: parent + anchors.horizontalCenter: parent.horizontalCenter + source: loginDialog.isSteamRunning() ? "../LoginDialog/SignInBody.qml" : "../LoginDialog/LinkAccountBody.qml" } } } + + Keys.onPressed: { + if (!visible) { + return + } + + if (event.modifiers === Qt.ControlModifier) + switch (event.key) { + case Qt.Key_A: + event.accepted = true + detailedText.selectAll() + break + case Qt.Key_C: + event.accepted = true + detailedText.copy() + break + case Qt.Key_Period: + if (Qt.platform.os === "osx") { + event.accepted = true + content.reject() + } + break + } else switch (event.key) { + case Qt.Key_Escape: + case Qt.Key_Back: + event.accepted = true + destroy() + break + + case Qt.Key_Enter: + case Qt.Key_Return: + event.accepted = true + break + } + } +// LoginDialog { +// id: loginDialog +// width: parent.width +// height: parent.height +// StackView { +// id: bodyLoader +// property var item: currentItem +// property var props +// property string source: "" + +// onCurrentItemChanged: { +// //cleanup source for future usage +// source = "" +// } + +// function setSource(src, props) { +// source = "../TabletLoginDialog/" + src +// bodyLoader.props = props +// } +// function popup() { +// bodyLoader.pop() + +// //check if last screen, if yes, dialog is popped out +// if (depth === 1) +// loginDialogRoot.canceled() +// } + +// anchors.fill: parent +// anchors.margins: 10 +// onSourceChanged: { +// if (source !== "") { +// bodyLoader.push(Qt.resolvedUrl(source), props) +// } +// } +// Component.onCompleted: { +// setSource(loginDialog.isSteamRunning() ? +// "SignInBody.qml" : +// "LinkAccountBody.qml") +// } +// } +// } } From 769c57208c3307ad88761e14b3efab6f91abb557 Mon Sep 17 00:00:00 2001 From: vladest Date: Thu, 28 Sep 2017 21:35:41 +0200 Subject: [PATCH 03/23] Signup ready --- .../qml/LoginDialog/LinkAccountBody.qml | 104 +++++------ .../resources/qml/LoginDialog/SignUpBody.qml | 170 ++++++++---------- .../qml/dialogs/TabletLoginDialog.qml | 2 +- interface/src/main.cpp | 4 +- 4 files changed, 120 insertions(+), 160 deletions(-) diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index 7f69e41958..26e90eb9a6 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -45,8 +45,8 @@ 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/* + + hifi.dimensions.contentSpacing.y + buttons.height*/; if (additionalInformation.visible) { targetWidth = Math.max(targetWidth, additionalInformation.width); @@ -56,7 +56,7 @@ Item { 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)) + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y); - console.log("sign in h:", targetHeight, parent.height) + console.log("sign in h:", targetHeight, parent.height, form.height) } } @@ -67,9 +67,6 @@ Item { if (loginDialog.isSteamRunning()) { additionalInformation.visible = !isLoading } - - leftButton.visible = !isLoading - buttons.visible = !isLoading } BusyIndicator { @@ -173,11 +170,6 @@ Item { InfoItem { id: additionalInformation - anchors { - left: parent.left - margins: 0 - topMargin: hifi.dimensions.contentSpacing.y - } visible: loginDialog.isSteamRunning() @@ -189,65 +181,59 @@ Item { horizontalAlignment: Text.AlignHCenter } - Column { - //width: parent.width + Row { + id: buttons spacing: hifi.dimensions.contentSpacing.y*2 + onHeightChanged: d.resize(); onWidthChanged: d.resize(); anchors.horizontalCenter: parent.horizontalCenter - //padding: 10 - Row { - id: buttons - spacing: hifi.dimensions.contentSpacing.y*2 - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - anchors.horizontalCenter: parent.horizontalCenter + Button { + id: linkAccountButton + anchors.verticalCenter: parent.verticalCenter + width: 200 - Button { - id: linkAccountButton - anchors.verticalCenter: parent.verticalCenter - width: 200 + text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login") + color: hifi.buttons.blue - text: qsTr(loginDialog.isSteamRunning() ? "Link Account" : "Login") - color: hifi.buttons.blue - - onClicked: linkAccountBody.login() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Cancel") - onClicked: root.tryDestroy() - } + onClicked: linkAccountBody.login() } - Row { - id: leftButton + Button { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Cancel") + onClicked: root.tryDestroy() + } + } - anchors.horizontalCenter: parent.horizontalCenter - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); + Row { + id: leftButton - RalewaySemiBold { - size: hifi.fontSizes.inputLabel - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Don't have an account?") - } + anchors.horizontalCenter: parent.horizontalCenter + spacing: hifi.dimensions.contentSpacing.y*2 + onHeightChanged: d.resize(); onWidthChanged: d.resize(); - Button { - anchors.verticalCenter: parent.verticalCenter + RalewaySemiBold { + size: hifi.fontSizes.inputLabel + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Don't have an account?") + } - text: qsTr("Sign Up") - visible: !loginDialog.isSteamRunning() + Button { + anchors.verticalCenter: parent.verticalCenter - onClicked: { - bodyLoader.setSource("SignUpBody.qml") - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } + text: qsTr("Sign Up") + visible: !loginDialog.isSteamRunning() + + onClicked: { + bodyLoader.setSource("SignUpBody.qml") + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height } } } } + // Override ScrollingWindow's keyboard that would be at very bottom of dialog. Keyboard { raised: keyboardEnabled && keyboardRaised @@ -266,7 +252,7 @@ Item { root.title = qsTr("Sign Into High Fidelity") root.iconText = "<" keyboardEnabled = HMD.active; - d.resize(); + //d.resize(); if (failAfterSignUp) { mainTextContainer.text = "Account created successfully." @@ -313,11 +299,11 @@ Item { } switch (event.key) { - case Qt.Key_Enter: - case Qt.Key_Return: - event.accepted = true - linkAccountBody.login() - break + case Qt.Key_Enter: + case Qt.Key_Return: + event.accepted = true + linkAccountBody.login() + break } } } diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index c7bfa8cfcd..aef20c7a61 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -44,13 +44,13 @@ 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/* + + hifi.dimensions.contentSpacing.y + buttons.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)) + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : 0); - //console.log("sign up h:", parent.height) + console.log("sign up h:", parent.height, targetHeight, form.height) } } @@ -97,44 +97,31 @@ Item { Column { id: form + width: parent.width + onHeightChanged: d.resize(); onWidthChanged: d.resize(); + anchors { top: mainTextContainer.bottom - left: parent.left - margins: 0 topMargin: 2 * hifi.dimensions.contentSpacing.y } spacing: 2 * hifi.dimensions.contentSpacing.y - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: emailField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 - - label: "Email" - } + TextField { + id: emailField + width: parent.width + label: "Email" } - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: usernameField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 - - label: "Username" - } + TextField { + id: usernameField + width: parent.width + label: "Username" ShortcutText { anchors { - verticalCenter: parent.verticalCenter + verticalCenter: parent.textFieldLabel.verticalCenter + left: parent.textFieldLabel.right + leftMargin: 10 } text: qsTr("No spaces / special chars.") @@ -146,23 +133,17 @@ Item { } } - Row { - spacing: hifi.dimensions.contentSpacing.x - - TextField { - id: passwordField - anchors { - verticalCenter: parent.verticalCenter - } - width: 350 - - label: "Password" - echoMode: TextInput.Password - } + TextField { + id: passwordField + width: parent.width + label: "Password" + echoMode: TextInput.Password ShortcutText { anchors { - verticalCenter: parent.verticalCenter + verticalCenter: parent.textFieldLabel.verticalCenter + left: parent.textFieldLabel.right + leftMargin: 10 } text: qsTr("At least 6 characters") @@ -174,6 +155,51 @@ Item { } } + Row { + id: leftButton + anchors.horizontalCenter: parent.horizontalCenter + + spacing: hifi.dimensions.contentSpacing.x + onHeightChanged: d.resize(); onWidthChanged: d.resize(); + + Button { + anchors.verticalCenter: parent.verticalCenter + + text: qsTr("Existing User") + + onClicked: { + bodyLoader.setSource("LinkAccountBody.qml") + bodyLoader.item.width = root.pane.width + bodyLoader.item.height = root.pane.height + } + } + } + + Row { + id: buttons + anchors.horizontalCenter: parent.horizontalCenter + spacing: hifi.dimensions.contentSpacing.x + onHeightChanged: d.resize(); onWidthChanged: d.resize(); + + Button { + id: linkAccountButton + anchors.verticalCenter: parent.verticalCenter + width: 200 + + text: qsTr("Sign Up") + color: hifi.buttons.blue + + onClicked: signupBody.signup() + } + + Button { + anchors.verticalCenter: parent.verticalCenter + + text: qsTr("Cancel") + + onClicked: root.tryDestroy() + } + } } // Override ScrollingWindow's keyboard that would be at very bottom of dialog. @@ -183,65 +209,11 @@ Item { anchors { left: parent.left right: parent.right - bottom: buttons.top + bottom: parent.bottom bottomMargin: keyboardRaised ? 2 * hifi.dimensions.contentSpacing.y : 0 } } - Row { - id: leftButton - anchors { - left: parent.left - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Existing User") - - onClicked: { - bodyLoader.setSource("LinkAccountBody.qml") - bodyLoader.item.width = root.pane.width - bodyLoader.item.height = root.pane.height - } - } - } - - Row { - id: buttons - anchors { - right: parent.right - bottom: parent.bottom - bottomMargin: hifi.dimensions.contentSpacing.y - } - spacing: hifi.dimensions.contentSpacing.x - onHeightChanged: d.resize(); onWidthChanged: d.resize(); - - Button { - id: linkAccountButton - anchors.verticalCenter: parent.verticalCenter - width: 200 - - text: qsTr("Sign Up") - color: hifi.buttons.blue - - onClicked: signupBody.signup() - } - - Button { - anchors.verticalCenter: parent.verticalCenter - - text: qsTr("Cancel") - - onClicked: root.tryDestroy() - } - } - Component.onCompleted: { root.title = qsTr("Create an Account") root.iconText = "<" diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index ae00cb3d40..78221ab6cb 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -96,7 +96,7 @@ TabletModalWindow { id: mfRoot width: root.width - height: root.height + frameMarginTop + height: root.height //+ frameMarginTop anchors { horizontalCenter: parent.horizontalCenter diff --git a/interface/src/main.cpp b/interface/src/main.cpp index cb90160cfe..334715ef04 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -48,7 +48,9 @@ int main(int argc, const char* argv[]) { static QString BUG_SPLAT_APPLICATION_NAME = "Interface"; CrashReporter crashReporter { BUG_SPLAT_DATABASE, BUG_SPLAT_APPLICATION_NAME, BuildInfo::VERSION }; #endif - +#ifdef Q_OS_UNIX + QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); +#endif disableQtBearerPoll(); // Fixes wifi ping spikes QElapsedTimer startupTime; From 4023c4014957f9163543aaea9744a2ff513b7f57 Mon Sep 17 00:00:00 2001 From: vladest Date: Thu, 28 Sep 2017 22:55:01 +0200 Subject: [PATCH 04/23] Cleanup --- .../qml/LoginDialog/CompleteProfileBody.qml | 2 +- .../qml/LoginDialog/LinkAccountBody.qml | 2 - .../resources/qml/LoginDialog/SignUpBody.qml | 1 - .../qml/LoginDialog/UsernameCollisionBody.qml | 2 +- .../resources/qml/LoginDialog/WelcomeBody.qml | 2 +- .../qml/dialogs/TabletLoginDialog.qml | 48 ++----------------- 6 files changed, 7 insertions(+), 50 deletions(-) diff --git a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml index e06ce239ab..2c6bc1082a 100644 --- a/interface/resources/qml/LoginDialog/CompleteProfileBody.qml +++ b/interface/resources/qml/LoginDialog/CompleteProfileBody.qml @@ -65,7 +65,7 @@ Item { text: qsTr("Cancel") - onClicked: root.destroy() + onClicked: root.tryDestroy() } } diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index 26e90eb9a6..13462804c3 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -56,7 +56,6 @@ Item { 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)) + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : hifi.dimensions.contentSpacing.y); - console.log("sign in h:", targetHeight, parent.height, form.height) } } @@ -233,7 +232,6 @@ Item { } } - // Override ScrollingWindow's keyboard that would be at very bottom of dialog. Keyboard { raised: keyboardEnabled && keyboardRaised diff --git a/interface/resources/qml/LoginDialog/SignUpBody.qml b/interface/resources/qml/LoginDialog/SignUpBody.qml index aef20c7a61..c4056422dd 100644 --- a/interface/resources/qml/LoginDialog/SignUpBody.qml +++ b/interface/resources/qml/LoginDialog/SignUpBody.qml @@ -50,7 +50,6 @@ Item { 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)) + (keyboardEnabled && keyboardRaised ? (200 + 2 * hifi.dimensions.contentSpacing.y) : 0); - console.log("sign up h:", parent.height, targetHeight, form.height) } } diff --git a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml index 18c831b3a9..b049d7f8bb 100644 --- a/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml +++ b/interface/resources/qml/LoginDialog/UsernameCollisionBody.qml @@ -122,7 +122,7 @@ Item { text: qsTr("Cancel") - onClicked: root.destroy() + onClicked: root.tryDestroy() } } diff --git a/interface/resources/qml/LoginDialog/WelcomeBody.qml b/interface/resources/qml/LoginDialog/WelcomeBody.qml index eb91956532..551ec263b7 100644 --- a/interface/resources/qml/LoginDialog/WelcomeBody.qml +++ b/interface/resources/qml/LoginDialog/WelcomeBody.qml @@ -77,7 +77,7 @@ Item { text: qsTr("Close"); - onClicked: root.destroy() + onClicked: root.tryDestroy() } } diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 78221ab6cb..6cf7394cf0 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -47,8 +47,10 @@ TabletModalWindow { } function tryDestroy() { + console.log("tryDestroy") canceled() } + Component.onDestruction: console.log("root dying") } //property int colorScheme: hifi.colorSchemes.dark @@ -81,7 +83,7 @@ TabletModalWindow { onCanceled: { if (bodyLoader.active === true) { - bodyLoader.active = false + //bodyLoader.active = false } if (gotoPreviousApp) { var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); @@ -96,13 +98,12 @@ TabletModalWindow { id: mfRoot width: root.width - height: root.height //+ frameMarginTop + height: root.height + frameMarginTop + hifi.dimensions.contentMargin.x anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.verticalCenter } - onHeightChanged: console.log("tablet mf h:", height) LoginDialog { id: loginDialog @@ -158,45 +159,4 @@ TabletModalWindow { break } } -// LoginDialog { -// id: loginDialog -// width: parent.width -// height: parent.height -// StackView { -// id: bodyLoader -// property var item: currentItem -// property var props -// property string source: "" - -// onCurrentItemChanged: { -// //cleanup source for future usage -// source = "" -// } - -// function setSource(src, props) { -// source = "../TabletLoginDialog/" + src -// bodyLoader.props = props -// } -// function popup() { -// bodyLoader.pop() - -// //check if last screen, if yes, dialog is popped out -// if (depth === 1) -// loginDialogRoot.canceled() -// } - -// anchors.fill: parent -// anchors.margins: 10 -// onSourceChanged: { -// if (source !== "") { -// bodyLoader.push(Qt.resolvedUrl(source), props) -// } -// } -// Component.onCompleted: { -// setSource(loginDialog.isSteamRunning() ? -// "SignInBody.qml" : -// "LinkAccountBody.qml") -// } -// } -// } } From d3cd034d614cc9285baf4ca7bb975c721ba07ae9 Mon Sep 17 00:00:00 2001 From: vladest Date: Fri, 29 Sep 2017 16:33:52 +0200 Subject: [PATCH 05/23] Cleanup --- interface/resources/qml/dialogs/TabletLoginDialog.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 6cf7394cf0..f4f7a5848c 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -47,10 +47,8 @@ TabletModalWindow { } function tryDestroy() { - console.log("tryDestroy") canceled() } - Component.onDestruction: console.log("root dying") } //property int colorScheme: hifi.colorSchemes.dark From 96b6a2f013678afcf7c30be3916cb73505cf4953 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 28 Sep 2017 16:07:15 -0700 Subject: [PATCH 06/23] Fix entity add after incomplete rezCertified implementation (cherry picked from commit 0f66fb41fd3ff2b58c4fcdef8f5145830559e3bf) --- libraries/entities/src/EntityTree.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 5c5aee97ff..c8675bdcba 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -1148,11 +1148,8 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c } else if (!senderNode->getCanRez() && !senderNode->getCanRezTmp()) { failedAdd = true; qCDebug(entities) << "User without 'rez rights' [" << senderNode->getUUID() - << "] attempted to add an entity ID:" << entityItemID; - // FIXME after Cert ID property integrated - } else if (/*!properties.getCertificateID().isNull() && */!senderNode->getCanRezCertified() && !senderNode->getCanRezTmpCertified()) { - qCDebug(entities) << "User without 'certified rez rights' [" << senderNode->getUUID() - << "] attempted to add a certified entity with ID:" << entityItemID; + << "] attempted to add an entity ID:" << entityItemID; + } else { // this is a new entity... assign a new entityID properties.setCreated(properties.getLastEdited()); From 4fd447949776adceb83f7dd920f361031652c6c7 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 28 Sep 2017 16:20:09 -0700 Subject: [PATCH 07/23] Oculus: Bug fix for head offset on large/small scaled avatars. (cherry picked from commit d8e2cbf871fd1b10a7507b979e832f65e13f8c44) --- plugins/oculus/src/OculusControllerManager.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/oculus/src/OculusControllerManager.cpp b/plugins/oculus/src/OculusControllerManager.cpp index 6f7be26554..d0c717bd20 100644 --- a/plugins/oculus/src/OculusControllerManager.cpp +++ b/plugins/oculus/src/OculusControllerManager.cpp @@ -334,10 +334,8 @@ void OculusControllerManager::TouchDevice::handleHeadPose(float deltaTime, glm::mat4 defaultHeadOffset = glm::inverse(inputCalibrationData.defaultCenterEyeMat) * inputCalibrationData.defaultHeadMat; - controller::Pose hmdHeadPose = pose.transform(sensorToAvatar); - pose.valid = true; - _poseStateMap[controller::HEAD] = hmdHeadPose.postTransform(defaultHeadOffset); + _poseStateMap[controller::HEAD] = pose.postTransform(defaultHeadOffset).transform(sensorToAvatar); } void OculusControllerManager::TouchDevice::handleRotationForUntrackedHand(const controller::InputCalibrationData& inputCalibrationData, From b8ea6c22fa55cdc840a0f803433ff745edc873a0 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 29 Sep 2017 11:14:29 -0700 Subject: [PATCH 08/23] no tpose when switching avatars (cherry picked from commit fcfac9efc0b4787872eda616165cc70f43be093c) --- libraries/animation/src/Rig.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 86a1e629b4..712c728dcb 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -249,6 +249,7 @@ void Rig::reset(const FBXGeometry& geometry) { _rightShoulderJointIndex = _rightElbowJointIndex >= 0 ? geometry.joints.at(_rightElbowJointIndex).parentIndex : -1; if (!_animGraphURL.isEmpty()) { + _animNode.reset(); initAnimGraph(_animGraphURL); } } @@ -1619,7 +1620,7 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo } void Rig::initAnimGraph(const QUrl& url) { - if (_animGraphURL != url) { + if (_animGraphURL != url || !_animNode) { _animGraphURL = url; _animNode.reset(); From 572986bfad264e63ff25481ce0cc3decbe128cf2 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 29 Sep 2017 17:48:59 -0700 Subject: [PATCH 09/23] fix modeloverlay visible change (cherry picked from commit 0bb27a7165a874766b7625928fd00eed444d87af) --- interface/src/ui/overlays/Base3DOverlay.h | 2 +- interface/src/ui/overlays/ModelOverlay.cpp | 39 ++++++++++++++-------- interface/src/ui/overlays/ModelOverlay.h | 8 ++++- interface/src/ui/overlays/Overlay.h | 2 +- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/interface/src/ui/overlays/Base3DOverlay.h b/interface/src/ui/overlays/Base3DOverlay.h index 93a973e60a..3e65f163e2 100644 --- a/interface/src/ui/overlays/Base3DOverlay.h +++ b/interface/src/ui/overlays/Base3DOverlay.h @@ -47,7 +47,7 @@ public: void setIsSolid(bool isSolid) { _isSolid = isSolid; } void setIsDashedLine(bool isDashedLine) { _isDashedLine = isDashedLine; } void setIgnoreRayIntersection(bool value) { _ignoreRayIntersection = value; } - void setDrawInFront(bool value) { _drawInFront = value; } + virtual void setDrawInFront(bool value) { _drawInFront = value; } void setIsGrabbable(bool value) { _isGrabbable = value; } virtual AABox getBounds() const override = 0; diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index ca5ca54144..d19668af37 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -60,6 +60,24 @@ void ModelOverlay::update(float deltatime) { _model->simulate(deltatime); } _isLoaded = _model->isActive(); + + // check to see if when we added our model to the scene they were ready, if they were not ready, then + // fix them up in the scene + render::ScenePointer scene = qApp->getMain3DScene(); + render::Transaction transaction; + if (_model->needsFixupInScene()) { + _model->removeFromScene(scene, transaction); + _model->addToScene(scene, transaction); + } + if (_visibleDirty) { + _visibleDirty = false; + _model->setVisibleInScene(getVisible(), scene); + } + if (_drawInFrontDirty) { + _drawInFrontDirty = false; + _model->setLayeredInFront(getDrawInFront(), scene); + } + scene->enqueueTransaction(transaction); } bool ModelOverlay::addToScene(Overlay::Pointer overlay, const render::ScenePointer& scene, render::Transaction& transaction) { @@ -73,21 +91,14 @@ void ModelOverlay::removeFromScene(Overlay::Pointer overlay, const render::Scene _model->removeFromScene(scene, transaction); } -void ModelOverlay::render(RenderArgs* args) { +void ModelOverlay::setVisible(bool visible) { + Overlay::setVisible(visible); + _visibleDirty = true; +} - // check to see if when we added our model to the scene they were ready, if they were not ready, then - // fix them up in the scene - render::ScenePointer scene = qApp->getMain3DScene(); - render::Transaction transaction; - if (_model->needsFixupInScene()) { - _model->removeFromScene(scene, transaction); - _model->addToScene(scene, transaction); - } - - _model->setVisibleInScene(_visible, scene); - _model->setLayeredInFront(getDrawInFront(), scene); - - scene->enqueueTransaction(transaction); +void ModelOverlay::setDrawInFront(bool drawInFront) { + Base3DOverlay::setDrawInFront(drawInFront); + _drawInFrontDirty = true; } void ModelOverlay::setProperties(const QVariantMap& properties) { diff --git a/interface/src/ui/overlays/ModelOverlay.h b/interface/src/ui/overlays/ModelOverlay.h index 8d8429b29e..c1403cadbe 100644 --- a/interface/src/ui/overlays/ModelOverlay.h +++ b/interface/src/ui/overlays/ModelOverlay.h @@ -28,7 +28,7 @@ public: ModelOverlay(const ModelOverlay* modelOverlay); virtual void update(float deltatime) override; - virtual void render(RenderArgs* args) override; + virtual void render(RenderArgs* args) override {}; void setProperties(const QVariantMap& properties) override; QVariant getProperty(const QString& property) override; virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance, @@ -45,6 +45,9 @@ public: float getLoadPriority() const { return _loadPriority; } + void setVisible(bool visible) override; + void setDrawInFront(bool drawInFront) override; + protected: Transform evalRenderTransform() override; @@ -62,6 +65,9 @@ private: bool _updateModel = { false }; bool _scaleToFit = { false }; float _loadPriority { 0.0f }; + + bool _visibleDirty { false }; + bool _drawInFrontDirty { false }; }; #endif // hifi_ModelOverlay_h diff --git a/interface/src/ui/overlays/Overlay.h b/interface/src/ui/overlays/Overlay.h index db2979b4d5..775c597397 100644 --- a/interface/src/ui/overlays/Overlay.h +++ b/interface/src/ui/overlays/Overlay.h @@ -73,7 +73,7 @@ public: float getAlphaPulse() const { return _alphaPulse; } // setters - void setVisible(bool visible) { _visible = visible; } + virtual void setVisible(bool visible) { _visible = visible; } void setDrawHUDLayer(bool drawHUDLayer); void setColor(const xColor& color) { _color = color; } void setAlpha(float alpha) { _alpha = alpha; } From 7dfa80f666a00a31d3973fff12233725e41b93fd Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 28 Sep 2017 18:03:22 -0700 Subject: [PATCH 10/23] Bug fix for offset of animated parts of oculus touch controller display Ensure position/rotations are updated with a consistent scale and are animated correctly as the controller values change. --- .../system/controllers/controllerDisplay.js | 153 +++++++++--------- 1 file changed, 74 insertions(+), 79 deletions(-) diff --git a/scripts/system/controllers/controllerDisplay.js b/scripts/system/controllers/controllerDisplay.js index af8cfa74f4..3c2794cf96 100644 --- a/scripts/system/controllers/controllerDisplay.js +++ b/scripts/system/controllers/controllerDisplay.js @@ -49,6 +49,7 @@ createControllerDisplay = function(config) { partOverlays: {}, parts: {}, mappingName: "mapping-display-" + Math.random(), + partValues: {}, setVisible: function(visible) { for (var i = 0; i < this.overlays.length; ++i) { @@ -109,12 +110,53 @@ createControllerDisplay = function(config) { for (var partName in controller.parts) { overlayID = this.overlays[i++]; var part = controller.parts[partName]; - var partPosition = Vec3.multiply(sensorScaleFactor, Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, part.naturalPosition))); - var partDimensions = Vec3.multiply(sensorScaleFactor, part.naturalDimensions); - Overlays.editOverlay(overlayID, { - dimensions: partDimensions, - localPosition: partPosition - }); + localPosition = Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, part.naturalPosition)); + var localRotation; + var value = this.partValues[partName]; + var offset, rotation; + if (value !== undefined) { + if (part.type === "linear") { + var axis = Vec3.multiplyQbyV(controller.rotation, part.axis); + offset = Vec3.multiply(part.maxTranslation * value, axis); + localPosition = Vec3.sum(localPosition, offset); + localRotation = undefined; + } else if (part.type === "joystick") { + rotation = Quat.fromPitchYawRollDegrees(value.y * part.xHalfAngle, 0, value.x * part.yHalfAngle); + if (part.originOffset) { + offset = Vec3.multiplyQbyV(rotation, part.originOffset); + offset = Vec3.subtract(part.originOffset, offset); + } else { + offset = { x: 0, y: 0, z: 0 }; + } + localPosition = Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, Vec3.sum(offset, part.naturalPosition))); + localRotation = Quat.multiply(controller.rotation, rotation); + } else if (part.type === "rotational") { + value = clamp(value, part.minValue, part.maxValue); + var pct = (value - part.minValue) / part.maxValue; + var angle = pct * part.maxAngle; + rotation = Quat.angleAxis(angle, part.axis); + if (part.origin) { + offset = Vec3.multiplyQbyV(rotation, part.origin); + offset = Vec3.subtract(offset, part.origin); + } else { + offset = { x: 0, y: 0, z: 0 }; + } + localPosition = Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, Vec3.sum(offset, part.naturalPosition))); + localRotation = Quat.multiply(controller.rotation, rotation); + } + } + if (localRotation !== undefined) { + Overlays.editOverlay(overlayID, { + dimensions: Vec3.multiply(sensorScaleFactor, part.naturalDimensions), + localPosition: Vec3.multiply(sensorScaleFactor, localPosition), + localRotation: localRotation + }); + } else { + Overlays.editOverlay(overlayID, { + dimensions: Vec3.multiply(sensorScaleFactor, part.naturalDimensions), + localPosition: Vec3.multiply(sensorScaleFactor, localPosition) + }); + } } } } @@ -172,29 +214,13 @@ createControllerDisplay = function(config) { if (part.type === "rotational") { var input = resolveHardware(part.input); print("Mapping to: ", part.input, input); - mapping.from([input]).peek().to(function(controller, overlayID, part) { + mapping.from([input]).peek().to(function(partName) { return function(value) { - value = clamp(value, part.minValue, part.maxValue); - - var pct = (value - part.minValue) / part.maxValue; - var angle = pct * part.maxAngle; - var rotation = Quat.angleAxis(angle, part.axis); - - var offset = { x: 0, y: 0, z: 0 }; - if (part.origin) { - offset = Vec3.multiplyQbyV(rotation, part.origin); - offset = Vec3.subtract(offset, part.origin); - } - - var partPosition = Vec3.sum(controller.position, - Vec3.multiplyQbyV(controller.rotation, Vec3.sum(offset, part.naturalPosition))); - - Overlays.editOverlay(overlayID, { - localPosition: partPosition, - localRotation: Quat.multiply(controller.rotation, rotation) - }); + // insert the most recent controller value into controllerDisplay.partValues. + controllerDisplay.partValues[partName] = value; + controllerDisplay.resize(MyAvatar.sensorToWorldScale); }; - }(controller, overlayID, part)); + }(partName)); } else if (part.type === "touchpad") { var visibleInput = resolveHardware(part.visibleInput); var xInput = resolveHardware(part.xInput); @@ -210,69 +236,38 @@ createControllerDisplay = function(config) { mapping.from([yInput]).peek().invert().to(function(value) { }); } else if (part.type === "joystick") { - (function(controller, overlayID, part) { + (function(part, partName) { var xInput = resolveHardware(part.xInput); var yInput = resolveHardware(part.yInput); - - var xvalue = 0; - var yvalue = 0; - - function calculatePositionAndRotation(xValue, yValue) { - var rotation = Quat.fromPitchYawRollDegrees(yValue * part.xHalfAngle, 0, xValue * part.yHalfAngle); - - var offset = { x: 0, y: 0, z: 0 }; - if (part.originOffset) { - offset = Vec3.multiplyQbyV(rotation, part.originOffset); - offset = Vec3.subtract(part.originOffset, offset); - } - - var partPosition = Vec3.sum(controller.position, - Vec3.multiplyQbyV(controller.rotation, Vec3.sum(offset, part.naturalPosition))); - - var partRotation = Quat.multiply(controller.rotation, rotation); - - return { - position: partPosition, - rotation: partRotation - }; - } - mapping.from([xInput]).peek().to(function(value) { - xvalue = value; - var posRot = calculatePositionAndRotation(xvalue, yvalue); - Overlays.editOverlay(overlayID, { - localPosition: posRot.position, - localRotation: posRot.rotation - }); + // insert the most recent controller value into controllerDisplay.partValues. + if (controllerDisplay.partValues[partName]) { + controllerDisplay.partValues[partName].x = value; + } else { + controllerDisplay.partValues[partName] = {x: value, y: 0}; + } + controllerDisplay.resize(MyAvatar.sensorToWorldScale); }); - mapping.from([yInput]).peek().to(function(value) { - yvalue = value; - var posRot = calculatePositionAndRotation(xvalue, yvalue); - Overlays.editOverlay(overlayID, { - localPosition: posRot.position, - localRotation: posRot.rotation - }); + // insert the most recent controller value into controllerDisplay.partValues. + if (controllerDisplay.partValues[partName]) { + controllerDisplay.partValues[partName].y = value; + } else { + controllerDisplay.partValues[partName] = {x: 0, y: value}; + } + controllerDisplay.resize(MyAvatar.sensorToWorldScale); }); - })(controller, overlayID, part); + })(part, partName); } else if (part.type === "linear") { - (function(controller, overlayID, part) { + (function(part, partName) { var input = resolveHardware(part.input); - mapping.from([input]).peek().to(function(value) { - var axis = Vec3.multiplyQbyV(controller.rotation, part.axis); - var offset = Vec3.multiply(part.maxTranslation * value, axis); - - var partPosition = Vec3.sum(controller.position, Vec3.multiplyQbyV(controller.rotation, part.naturalPosition)); - var position = Vec3.sum(partPosition, offset); - - Overlays.editOverlay(overlayID, { - localPosition: position - }); + // insert the most recent controller value into controllerDisplay.partValues. + controllerDisplay.partValues[partName] = value; + controllerDisplay.resize(MyAvatar.sensorToWorldScale); }); - - })(controller, overlayID, part); + })(part, partName); } else if (part.type === "static") { // do nothing From bf39eb9a77dadd889f6593b9ae39c97ba2235c83 Mon Sep 17 00:00:00 2001 From: vladest Date: Mon, 2 Oct 2017 20:02:55 +0200 Subject: [PATCH 11/23] Test Tablet keyboard specific --- interface/resources/qml/LoginDialog.qml | 2 ++ .../qml/LoginDialog/LinkAccountBody.qml | 11 ++++++--- .../qml/dialogs/TabletLoginDialog.qml | 24 +++++++++++++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/LoginDialog.qml b/interface/resources/qml/LoginDialog.qml index 315cda3551..e21e8b7354 100644 --- a/interface/resources/qml/LoginDialog.qml +++ b/interface/resources/qml/LoginDialog.qml @@ -27,6 +27,8 @@ ModalWindow { destroyOnHidden: true visible: true + readonly property bool isTablet: false + property string iconText: "" property int iconSize: 50 diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index 13462804c3..dd38b641bb 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -244,12 +244,17 @@ Item { } } - - Component.onCompleted: { root.title = qsTr("Sign Into High Fidelity") 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(); if (failAfterSignUp) { diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index f4f7a5848c..334cb9304f 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -32,8 +32,14 @@ TabletModalWindow { //fake root for shared components expecting root here property var root: QtObject { id: root - property alias title: realRoot.title + property bool keyboardEnabled: false + property bool keyboardRaised: false + property bool punctuationMode: false + + readonly property bool isTablet: true + + property alias title: realRoot.title property real width: realRoot.width property real height: realRoot.height @@ -65,10 +71,6 @@ TabletModalWindow { //onTitleWidthChanged: d.resize(); - property bool keyboardEnabled: false - property bool keyboardRaised: false - property bool punctuationMode: false - //onKeyboardRaisedChanged: d.resize(); signal canceled(); @@ -123,6 +125,18 @@ TabletModalWindow { } } + Keyboard { + 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 + } + } + Keys.onPressed: { if (!visible) { return From a6f254551166707a3bd62a277f28bafd592c8710 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 3 Oct 2017 12:51:37 -0700 Subject: [PATCH 12/23] fix local t pose --- libraries/animation/src/Rig.cpp | 4 +++- libraries/animation/src/Rig.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 712c728dcb..0897c26a12 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1620,13 +1620,14 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo } void Rig::initAnimGraph(const QUrl& url) { - if (_animGraphURL != url || !_animNode) { + if (_animGraphURL != url || (!_animNode && !_animLoading)) { _animGraphURL = url; _animNode.reset(); // load the anim graph _animLoader.reset(new AnimNodeLoader(url)); + _animLoading = true; connect(_animLoader.get(), &AnimNodeLoader::success, [this](AnimNode::Pointer nodeIn) { _animNode = nodeIn; _animNode->setSkeleton(_animSkeleton); @@ -1637,6 +1638,7 @@ void Rig::initAnimGraph(const QUrl& url) { _userAnimState = { UserAnimState::None, "", 30.0f, false, 0.0f, 0.0f }; overrideAnimation(origState.url, origState.fps, origState.loop, origState.firstFrame, origState.lastFrame); } + _animLoading = false; emit onLoadComplete(); }); diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index eabc62ab75..18d49c5f1e 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -303,6 +303,7 @@ protected: std::shared_ptr _animNode; std::shared_ptr _animSkeleton; std::unique_ptr _animLoader; + bool _animLoading { false }; AnimVariantMap _animVars; enum class RigRole { Idle = 0, From 33e9a71000c95d3ab4d8434023b3a9f8aa859b2c Mon Sep 17 00:00:00 2001 From: druiz17 Date: Tue, 3 Oct 2017 12:51:51 -0700 Subject: [PATCH 13/23] grab attachments --- .../controllers/controllerModules/nearParentGrabEntity.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 9323f651a2..70d91bf1ec 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -223,7 +223,7 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); (distance > NEAR_GRAB_RADIUS * sensorScaleFactor)) { continue; } - if (entityIsGrabbable(props)) { + if (entityIsGrabbable(props) || entityIsCloneable(props)) { // give haptic feedback if (props.id !== this.hapticTargetID) { Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand); From 6b3d89d18f23dc2b02b0099c5f3acf9c6d8e5355 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Tue, 3 Oct 2017 14:13:37 -0700 Subject: [PATCH 14/23] fix hudlaser module --- .../system/controllers/controllerModules/hudOverlayPointer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/controllers/controllerModules/hudOverlayPointer.js b/scripts/system/controllers/controllerModules/hudOverlayPointer.js index e13c8e2f20..912eeccadb 100644 --- a/scripts/system/controllers/controllerModules/hudOverlayPointer.js +++ b/scripts/system/controllers/controllerModules/hudOverlayPointer.js @@ -178,7 +178,7 @@ } var hudRayPick = controllerData.hudRayPicks[this.hand]; var point2d = this.calculateNewReticlePosition(hudRayPick.intersection); - if (!Window.isPointOnDesktopWindow(point2d) && !controllerData.triggerClicks[this.hand]) { + if (!Window.isPointOnDesktopWindow(point2d) && !this.triggerClicked) { this.exitModule(); return false; } From c9d2d40e1e0817e197ff385364e2c0d88eb0b23f Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 3 Oct 2017 14:44:11 -0700 Subject: [PATCH 15/23] possibly fix registration offset issue --- libraries/entities/src/EntityItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 107af837fe..cd00a7a211 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1368,7 +1368,7 @@ void EntityItem::recordCreationTime() { const Transform EntityItem::getTransformToCenter(bool& success) const { Transform result = getTransform(success); if (getRegistrationPoint() != ENTITY_ITEM_HALF_VEC3) { // If it is not already centered, translate to center - result.postTranslate(ENTITY_ITEM_HALF_VEC3 - getRegistrationPoint()); // Position to center + result.postTranslate((ENTITY_ITEM_HALF_VEC3 - getRegistrationPoint()) * getDimensions()); // Position to center } return result; } From fc6e5df2cbb52a105a9b8118126a9148fdadf145 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 3 Oct 2017 15:02:21 -0700 Subject: [PATCH 16/23] fix text/web registration point usage --- libraries/entities/src/TextEntityItem.cpp | 2 +- libraries/entities/src/WebEntityItem.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/TextEntityItem.cpp b/libraries/entities/src/TextEntityItem.cpp index 1d8cb50a4b..3ade5879c5 100644 --- a/libraries/entities/src/TextEntityItem.cpp +++ b/libraries/entities/src/TextEntityItem.cpp @@ -136,7 +136,7 @@ bool TextEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const glm::vec2 xyDimensions(dimensions.x, dimensions.y); glm::quat rotation = getRotation(); glm::vec3 position = getPosition() + rotation * - (dimensions * (getRegistrationPoint() - ENTITY_ITEM_DEFAULT_REGISTRATION_POINT)); + (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); // FIXME - should set face and surfaceNormal return findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance); diff --git a/libraries/entities/src/WebEntityItem.cpp b/libraries/entities/src/WebEntityItem.cpp index 61c6c8d80e..9595f2959c 100644 --- a/libraries/entities/src/WebEntityItem.cpp +++ b/libraries/entities/src/WebEntityItem.cpp @@ -112,7 +112,7 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g glm::vec3 dimensions = getDimensions(); glm::vec2 xyDimensions(dimensions.x, dimensions.y); glm::quat rotation = getRotation(); - glm::vec3 position = getPosition() + rotation * (dimensions * (getRegistrationPoint() - ENTITY_ITEM_DEFAULT_REGISTRATION_POINT)); + glm::vec3 position = getPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint())); if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) { surfaceNormal = rotation * Vectors::UNIT_Z; From 0614fd9b4fafddfa60f8f3d4c367453d20865af0 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 3 Oct 2017 15:27:35 -0700 Subject: [PATCH 17/23] fix AvatarManger::findRayIntersection from script thread --- interface/src/avatar/AvatarManager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/AvatarManager.h b/interface/src/avatar/AvatarManager.h index cef6bd4c9c..39a4f7a4af 100644 --- a/interface/src/avatar/AvatarManager.h +++ b/interface/src/avatar/AvatarManager.h @@ -73,9 +73,9 @@ public: Q_INVOKABLE RayToAvatarIntersectionResult findRayIntersection(const PickRay& ray, const QScriptValue& avatarIdsToInclude = QScriptValue(), const QScriptValue& avatarIdsToDiscard = QScriptValue()); - RayToAvatarIntersectionResult findRayIntersectionVector(const PickRay& ray, - const QVector& avatarsToInclude, - const QVector& avatarsToDiscard); + Q_INVOKABLE RayToAvatarIntersectionResult findRayIntersectionVector(const PickRay& ray, + const QVector& avatarsToInclude, + const QVector& avatarsToDiscard); // TODO: remove this HACK once we settle on optimal default sort coefficients Q_INVOKABLE float getAvatarSortCoefficient(const QString& name); From ad9677f63e3b7e3efdf89f4e443631f7f82c0321 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Thu, 28 Sep 2017 11:18:40 -0700 Subject: [PATCH 18/23] fixing grabbing and tablet bugs --- .../controllerModules/equipEntity.js | 16 +++++++++++++--- .../controllerModules/farActionGrabEntity.js | 4 ++-- .../controllerModules/tabletStylusInput.js | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/scripts/system/controllers/controllerModules/equipEntity.js b/scripts/system/controllers/controllerModules/equipEntity.js index 29db02c6de..4978f225ce 100644 --- a/scripts/system/controllers/controllerModules/equipEntity.js +++ b/scripts/system/controllers/controllerModules/equipEntity.js @@ -255,6 +255,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.messageGrabEntity = false; this.grabEntityProps = null; this.shouldSendStart = false; + this.equipedWithSecondary = false; this.parameters = makeDispatcherModuleParameters( 300, @@ -370,6 +371,10 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa return this.rawSecondaryValue < BUMPER_ON_VALUE; }; + this.secondarySmoothedSqueezed = function() { + return this.rawSecondaryValue > BUMPER_ON_VALUE; + }; + this.chooseNearEquipHotspots = function(candidateEntityProps, controllerData) { var _this = this; var collectedHotspots = flatten(candidateEntityProps.map(function(props) { @@ -592,11 +597,13 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa // if the potentialHotspot os not cloneable and locked return null if (potentialEquipHotspot && - ((this.triggerSmoothedSqueezed() && !this.waitForTriggerRelease) || this.messageGrabEntity)) { + (((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) || + this.messageGrabEntity)) { this.grabbedHotspot = potentialEquipHotspot; this.targetEntityID = this.grabbedHotspot.entityID; this.startEquipEntity(controllerData); this.messageGrabEnity = false; + this.equipedWithSecondary = this.secondarySmoothedSqueezed(); return makeRunningValues(true, [potentialEquipHotspot.entityID], []); } else { return makeRunningValues(false, [], []); @@ -627,7 +634,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa return this.checkNearbyHotspots(controllerData, deltaTime, timestamp); } - if (controllerData.secondaryValues[this.hand]) { + if (controllerData.secondaryValues[this.hand] && !this.equipedWithSecondary) { // this.secondaryReleased() will always be true when not depressed // so we cannot simply rely on that for release - ensure that the // trigger was first "prepared" by being pushed in before the release @@ -644,7 +651,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa var dropDetected = this.dropGestureProcess(deltaTime); - if (this.triggerSmoothedReleased()) { + if (this.triggerSmoothedReleased() || this.secondaryReleased()) { if (this.shouldSendStart) { // we don't want to send startEquip message until the trigger is released. otherwise, // guns etc will fire right as they are equipped. @@ -653,6 +660,9 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa this.shouldSendStart = false; } this.waitForTriggerRelease = false; + if (this.secondaryReleased() && this.equipedWithSecondary) { + this.equipedWithSecondary = false; + } } if (dropDetected && this.prevDropDetected !== dropDetected) { diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 5c31c859e9..c5b82f75f0 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -132,7 +132,7 @@ Script.include("/~/system/libraries/controllers.js"); this.updateLaserPointer = function(controllerData) { var SEARCH_SPHERE_SIZE = 0.011; var MIN_SPHERE_SIZE = 0.0005; - var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE); + var radius = Math.max(1.2 * SEARCH_SPHERE_SIZE * this.intersectionDistance, MIN_SPHERE_SIZE) * MyAvatar.sensorToWorldScale; var dim = {x: radius, y: radius, z: radius}; var mode = "hold"; if (!this.distanceHolding && !this.distanceRotating) { @@ -424,7 +424,7 @@ Script.include("/~/system/libraries/controllers.js"); this.laserPointerOff(); return makeRunningValues(false, [], []); } - + this.intersectionDistance = controllerData.rayPicks[this.hand].distance; this.updateLaserPointer(controllerData); var otherModuleName =this.hand === RIGHT_HAND ? "LeftFarActionGrabEntity" : "RightFarActionGrabEntity"; diff --git a/scripts/system/controllers/controllerModules/tabletStylusInput.js b/scripts/system/controllers/controllerModules/tabletStylusInput.js index def958b223..0a3b2b8adc 100644 --- a/scripts/system/controllers/controllerModules/tabletStylusInput.js +++ b/scripts/system/controllers/controllerModules/tabletStylusInput.js @@ -152,6 +152,20 @@ Script.include("/~/system/libraries/controllers.js"); } }; + this.updateStylus = function() { + if (this.stylus) { + var X_ROT_NEG_90 = { x: -0.70710678, y: 0, z: 0, w: 0.70710678 }; + var modelOrientation = Quat.multiply(this.stylusTip.orientation, X_ROT_NEG_90); + var modelPositionOffset = Vec3.multiplyQbyV(modelOrientation, { x: 0, y: 0, z: MyAvatar.sensorToWorldScale * -WEB_STYLUS_LENGTH / 2 }); + + var stylusProps = { + position: Vec3.sum(this.stylusTip.position, modelPositionOffset), + rotation: modelOrientation + }; + Overlays.editOverlay(this.stylus, stylusProps); + } + }; + this.showStylus = function() { if (this.stylus) { return; @@ -320,6 +334,7 @@ Script.include("/~/system/libraries/controllers.js"); if (this.isNearStylusTarget) { if (!this.useFingerInsteadOfStylus) { this.showStylus(); + this.updateStylus(); } else { this.pointFinger(true); } @@ -335,7 +350,7 @@ Script.include("/~/system/libraries/controllers.js"); var SCALED_TABLET_MAX_HOVER_DISTANCE = TABLET_MAX_HOVER_DISTANCE * sensorScaleFactor; if (nearestStylusTarget && nearestStylusTarget.distance > SCALED_TABLET_MIN_TOUCH_DISTANCE && - nearestStylusTarget.distance < SCALED_TABLET_MAX_HOVER_DISTANCE) { + nearestStylusTarget.distance < SCALED_TABLET_MAX_HOVER_DISTANCE && !this.getOtherHandController().stylusTouchingTarget) { this.requestTouchFocus(nearestStylusTarget); From 13feec89c272736c03b129b8ac1de0354d45f1e7 Mon Sep 17 00:00:00 2001 From: druiz17 Date: Thu, 28 Sep 2017 13:23:28 -0700 Subject: [PATCH 19/23] remove update stylus --- .../controllerModules/tabletStylusInput.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/system/controllers/controllerModules/tabletStylusInput.js b/scripts/system/controllers/controllerModules/tabletStylusInput.js index 0a3b2b8adc..36ed7920dd 100644 --- a/scripts/system/controllers/controllerModules/tabletStylusInput.js +++ b/scripts/system/controllers/controllerModules/tabletStylusInput.js @@ -152,20 +152,6 @@ Script.include("/~/system/libraries/controllers.js"); } }; - this.updateStylus = function() { - if (this.stylus) { - var X_ROT_NEG_90 = { x: -0.70710678, y: 0, z: 0, w: 0.70710678 }; - var modelOrientation = Quat.multiply(this.stylusTip.orientation, X_ROT_NEG_90); - var modelPositionOffset = Vec3.multiplyQbyV(modelOrientation, { x: 0, y: 0, z: MyAvatar.sensorToWorldScale * -WEB_STYLUS_LENGTH / 2 }); - - var stylusProps = { - position: Vec3.sum(this.stylusTip.position, modelPositionOffset), - rotation: modelOrientation - }; - Overlays.editOverlay(this.stylus, stylusProps); - } - }; - this.showStylus = function() { if (this.stylus) { return; @@ -334,7 +320,6 @@ Script.include("/~/system/libraries/controllers.js"); if (this.isNearStylusTarget) { if (!this.useFingerInsteadOfStylus) { this.showStylus(); - this.updateStylus(); } else { this.pointFinger(true); } From fcafbef109892041f55c38d9e0ea1482ad97bded Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 4 Oct 2017 09:34:32 -0700 Subject: [PATCH 20/23] Fix buying free items using Commerce system --- interface/resources/qml/hifi/commerce/checkout/Checkout.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index 77180f7bab..32f324aea9 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -35,7 +35,7 @@ Rectangle { property string itemHref; property double balanceAfterPurchase; property bool alreadyOwned: false; - property int itemPrice; + property int itemPrice: -1; property bool itemIsJson: true; property bool shouldBuyWithControlledFailure: false; property bool debugCheckoutSuccess: false; @@ -339,7 +339,7 @@ Rectangle { } FiraSansSemiBold { id: itemPriceText; - text: root.itemPrice; + text: (root.itemPrice === -1) ? "--" : root.itemPrice; // Text size size: 26; // Anchors From 0a505617df86a58ee95460e10c7bb40b716dbc44 Mon Sep 17 00:00:00 2001 From: vladest Date: Wed, 4 Oct 2017 19:33:36 +0200 Subject: [PATCH 21/23] 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 } } From 1ed10ecf59ccb400eb43b508640d529ac0b00613 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 4 Oct 2017 11:05:17 -0700 Subject: [PATCH 22/23] Fix passphrase crash --- interface/src/commerce/QmlCommerce.cpp | 4 +++- interface/src/commerce/Wallet.cpp | 4 +++- interface/src/commerce/Wallet.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/interface/src/commerce/QmlCommerce.cpp b/interface/src/commerce/QmlCommerce.cpp index dbd84594bc..9f8847e8c7 100644 --- a/interface/src/commerce/QmlCommerce.cpp +++ b/interface/src/commerce/QmlCommerce.cpp @@ -119,7 +119,9 @@ void QmlCommerce::history() { void QmlCommerce::changePassphrase(const QString& oldPassphrase, const QString& newPassphrase) { auto wallet = DependencyManager::get(); - if ((wallet->getPassphrase()->isEmpty() || wallet->getPassphrase() == oldPassphrase) && !newPassphrase.isEmpty()) { + if (wallet->getPassphrase()->isEmpty()) { + emit changePassphraseStatusResult(wallet->setPassphrase(newPassphrase)); + } else if (wallet->getPassphrase() == oldPassphrase && !newPassphrase.isEmpty()) { emit changePassphraseStatusResult(wallet->changePassphrase(newPassphrase)); } else { emit changePassphraseStatusResult(false); diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index cc2039da48..079e3a9479 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -293,13 +293,15 @@ Wallet::~Wallet() { } } -void Wallet::setPassphrase(const QString& passphrase) { +bool Wallet::setPassphrase(const QString& passphrase) { if (_passphrase) { delete _passphrase; } _passphrase = new QString(passphrase); _publicKeys.clear(); + + return true; } bool Wallet::writeSecurityImage(const QPixmap* pixmap, const QString& outputFilePath) { diff --git a/interface/src/commerce/Wallet.h b/interface/src/commerce/Wallet.h index 807080e6ea..acf9f8e45e 100644 --- a/interface/src/commerce/Wallet.h +++ b/interface/src/commerce/Wallet.h @@ -42,7 +42,7 @@ public: void setCKey(const QByteArray& ckey) { _ckey = ckey; } QByteArray getCKey() { return _ckey; } - void setPassphrase(const QString& passphrase); + bool setPassphrase(const QString& passphrase); QString* getPassphrase() { return _passphrase; } bool getPassphraseIsCached() { return !(_passphrase->isEmpty()); } bool walletIsAuthenticatedWithPassphrase(); From 86e8076362ce1f39547aa6845d14231c7c916df3 Mon Sep 17 00:00:00 2001 From: vladest Date: Wed, 4 Oct 2017 20:30:25 +0200 Subject: [PATCH 23/23] Fix puntuation mode --- interface/resources/qml/dialogs/TabletLoginDialog.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index 29276a2ccf..9722f31144 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -28,6 +28,7 @@ TabletModalWindow { color: hifi.colors.baseGray title: qsTr("Sign in to High Fidelity") property alias titleWidth: root.titleWidth + property alias punctuationMode: root.punctuationMode //fake root for shared components expecting root here property var root: QtObject {