fixing some text, turning off lasers until they intersect login overlay

This commit is contained in:
Wayne Chen 2018-11-28 19:17:30 -08:00
parent 527f8a2b59
commit b0fb7778cf
7 changed files with 236 additions and 169 deletions

View file

@ -0,0 +1,157 @@
//
// CantAccessBody.qml
//
// Created by Wayne Chen on 11/28/18
// Copyright 2018 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 controlsUit 1.0 as HifiControlsUit
import stylesUit 1.0 as HifiStylesUit
Item {
id: cantAccessBody
clip: true
width: root.width
height: root.height
property int textFieldHeight: 31
property string fontFamily: "Raleway"
property int fontSize: 15
// property int textFieldFontSize: !root.isTablet ? !root.isOverlay : hifi.fontSizes.textFieldInput ? hifi.fontSizes.textFieldInput : 18
property int textFontSize: 24
property bool fontBold: true
QtObject {
id: d
readonly property int minWidth: 480
readonly property int minWidthButton: !root.isTablet ? 256 : 174
property int maxWidth: root.isTablet ? 1280 : root.width
readonly property int minHeight: 120
// readonly property int minHeightButton: !root.isTablet ? 56 : 42
readonly property int minHeightButton: 36
property int maxHeight: root.isTablet ? 720 : root.height
function resize() {
maxWidth = root.isTablet ? 1280 : root.width;
maxHeight = root.isTablet ? 720 : root.height;
var targetWidth = Math.max(titleWidth, mainContainer.width);
var targetHeight = hifi.dimensions.contentSpacing.y + mainContainer.height + 4 * hifi.dimensions.contentSpacing.y;
var newWidth = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth));
if (!isNaN(newWidth)) {
parent.width = root.width = newWidth;
}
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight)) + hifi.dimensions.contentSpacing.y;
}
}
Item {
id: mainContainer
anchors.fill: parent
onHeightChanged: d.resize(); onWidthChanged: d.resize();
Rectangle {
id: opaqueRect
height: parent.height
width: parent.width
opacity: 0.9
color: "black"
}
Item {
id: bannerContainer
width: parent.width
height: banner.height
anchors {
bottom: textContainer.top
bottomMargin: 0.125 * parent.height
}
Image {
id: banner
anchors.centerIn: parent
source: "../../images/high-fidelity-banner.svg"
horizontalAlignment: Image.AlignHCenter
}
}
Item {
id: textContainer
width: parent.width
height: 0.45 * parent.height
anchors {
top: parent.top
topMargin: bannerContainer.height + 0.25 * parent.height
left: parent.left
}
TextMetrics {
id: titleTextMetrics
font: titleText.font
text: titleText.text
}
Text {
id: titleText
anchors {
top: parent.top
topMargin: 0.2 * parent.height
left: parent.left
leftMargin: (parent.width - titleTextMetrics.width) / 2
}
text: qsTr("Can't Access Account")
font.pixelSize: cantAccessBody.textFontSize + 10
font.bold: cantAccessBody.fontBold
color: "white"
lineHeight: 2
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
}
TextMetrics {
id: bodyTextMetrics
font: bodyText.font
text: bodyText.text
}
Text {
id: bodyText
anchors {
top: titleText.bottom
topMargin: hifi.dimensions.contentSpacing.y
left: parent.left
leftMargin: (parent.width - bodyTextMetrics.width) / 2
}
text: qsTr("Please navigate to your default browser to recover your account.\nIf you are in a VR headset, please take it off.")
font.pixelSize: cantAccessBody.textFontSize
color: "white"
wrapMode: Text.WordWrap
lineHeight: 2
lineHeightMode: Text.ProportionalHeight
horizontalAlignment: Text.AlignHCenter
}
}
HifiControlsUit.Button {
id: okButton
height: d.minHeightButton
anchors {
bottom: parent.bottom
right: parent.right
margins: 3 * hifi.dimensions.contentSpacing.y
}
text: qsTr("OK")
fontFamily: cantAccessBody.fontFamily
fontSize: cantAccessBody.fontSize
fontBold: cantAccessBody.fontBold
onClicked: {
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": ""});
}
}
}
Component.onCompleted: {
d.resize();
}
}

View file

@ -100,8 +100,8 @@ Item {
width: parent.width
height: banner.height
anchors {
top: parent.top
topMargin: 0.03 * parent.height
bottom: loginContainer.top
bottomMargin: 0.125 * parent.height
}
Image {
id: banner
@ -110,14 +110,15 @@ Item {
horizontalAlignment: Image.AlignHCenter
}
}
Item {
id: loginContainer
width: parent.width
height: parent.height - (bannerContainer.height + 1.5 * hifi.dimensions.contentSpacing.y)
width: emailField.width
height: 0.45 * parent.height
anchors {
top: bannerContainer.bottom
topMargin: 1.5 * hifi.dimensions.contentSpacing.y
top: parent.top
topMargin: bannerContainer.height + 0.25 * parent.height
left: parent.left
leftMargin: (parent.width - emailField.width) / 2
}
Item {
id: errorContainer
@ -152,9 +153,7 @@ Item {
font.pixelSize: linkAccountBody.textFieldFontSize
anchors {
top: parent.top
topMargin: 0.2 * root.height
left: parent.left
leftMargin: (parent.width - emailField.width) / 2
topMargin: loginErrorMessage.height
}
placeholderText: "Username or Email"
activeFocusOnPress: true
@ -194,8 +193,6 @@ Item {
anchors {
top: emailField.bottom
topMargin: 1.5 * hifi.dimensions.contentSpacing.y
left: parent.left
leftMargin: (parent.width - emailField.width) / 2
}
onFocusChanged: {
@ -317,7 +314,8 @@ Item {
linkColor: hifi.colors.blueAccent
onLinkActivated: {
Tablet.playSound(TabletEnums.ButtonClick);
loginDialog.openUrl(link)
loginDialog.openUrl(link);
bodyLoader.setSource("CantAccessBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
}
}
HifiControlsUit.Button {
@ -361,52 +359,52 @@ Item {
}
}
Item {
id: signUpContainer
width: emailField.width
height: emailField.height
}
Item {
id: signUpContainer
width: loginContainer.width
height: signUpTextMetrics.height
anchors {
left: loginContainer.left
top: loginContainer.bottom
// topMargin: 0.25 * parent.height
}
TextMetrics {
id: signUpTextMetrics
font: signUpText.font
text: signUpText.text
}
Text {
id: signUpText
text: qsTr("Don't have an account?")
anchors {
left: emailField.left
bottom: parent.bottom
bottomMargin: 0.25 * parent.height
left: parent.left
}
TextMetrics {
id: signUpTextMetrics
font: signUpText.font
text: signUpText.text
}
Text {
id: signUpText
text: qsTr("Don't have an account?")
anchors {
left: parent.left
}
lineHeight: 1
color: "white"
font.family: linkAccountBody.fontFamily
font.pixelSize: 18
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
lineHeight: 1
color: "white"
font.family: linkAccountBody.fontFamily
font.pixelSize: 18
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
HifiStylesUit.ShortcutText {
id: signUpShortcutText
z: 10
font.family: linkAccountBody.fontFamily
font.pixelSize: 18
anchors {
left: signUpText.right
leftMargin: hifi.dimensions.contentSpacing.x
}
HifiStylesUit.ShortcutText {
id: signUpShortcutText
z: 10
font.family: linkAccountBody.fontFamily
font.pixelSize: 18
anchors {
left: signUpText.right
leftMargin: hifi.dimensions.contentSpacing.x
}
text: "<a href='https://highfidelity.com'>Sign Up</a>"
text: "<a href='https://highfidelity.com'>Sign Up</a>"
linkColor: hifi.colors.blueAccent
onLinkActivated: {
Tablet.playSound(TabletEnums.ButtonClick);
bodyLoader.setSource("SignUpBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader,
"errorString": "" });
}
linkColor: hifi.colors.blueAccent
onLinkActivated: {
Tablet.playSound(TabletEnums.ButtonClick);
bodyLoader.setSource("SignUpBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader,
"errorString": "" });
}
}
}
@ -430,6 +428,7 @@ Item {
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
visible: loginDialog.getLoginDialogPoppedUp()
onClicked: {
if (loginDialog.getLoginDialogPoppedUp()) {
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")

View file

@ -59,8 +59,7 @@ Item {
parent.width = root.width = newWidth;
}
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);
parent.height = root.height = Math.max(d.minHeight, Math.min(d.maxHeight, targetHeight) + hifi.dimensions.contentSpacing.y;
}
}
@ -103,13 +102,14 @@ Item {
color: "black"
}
Item {
id: bannerContainer
width: parent.width
height: banner.height
anchors {
top: parent.top
topMargin: 85
bottom: loginContainer.top
bottomMargin: 0.125 * parent.height
}
Image {
id: banner
@ -118,14 +118,15 @@ Item {
horizontalAlignment: Image.AlignHCenter
}
}
Item {
id: loginContainer
width: parent.width
height: parent.height - (bannerContainer.height + 1.5 * hifi.dimensions.contentSpacing.y)
width: usernameField.width
height: parent.height - bannerContainer.height
anchors {
top: bannerContainer.bottom
topMargin: 1.5 * hifi.dimensions.contentSpacing.y
top: parent.top
topMargin: bannerContainer.height + 0.25 * parent.height
left: parent.left
leftMargin: (parent.width - usernameField.width) / 2
}
visible: true
@ -134,9 +135,9 @@ Item {
width: loginErrorMessageTextMetrics.width
height: loginErrorMessageTextMetrics.height
anchors {
bottom: emailField.top;
bottomMargin: 2;
left: emailField.left;
bottom: usernameField.top;
bottomMargin: hifi.dimensions.contentSpacing.y;
left: usernameField.left;
}
TextMetrics {
id: loginErrorMessageTextMetrics
@ -163,9 +164,7 @@ Item {
font.pixelSize: signUpBody.textFieldFontSize
anchors {
top: parent.top
topMargin: 0.2 * parent.height
left: parent.left
leftMargin: (parent.width - usernameField.width) / 2
topMargin: loginErrorMessage.height
}
focus: true
Keys.onPressed: {
@ -207,8 +206,6 @@ Item {
height: signUpBody.textFieldHeight
anchors {
top: parent.top
left: parent.left
leftMargin: (parent.width - emailField.width) / 2
}
placeholderText: "Username or Email"
font.pixelSize: signUpBody.textFieldFontSize
@ -255,8 +252,6 @@ Item {
anchors {
top: emailField.bottom
topMargin: 1.5 * hifi.dimensions.contentSpacing.y
left: parent.left
leftMargin: (parent.width - emailField.width) / 2
}
onFocusChanged: {
@ -360,7 +355,7 @@ Item {
}
HifiControlsUit.Button {
id: cancelButton
width: 1.2 * cancelButtonTextMetrics.width
width: emailField.width / 2
height: d.minHeightButton
anchors {
top: keepMeLoggedInCheckbox.bottom
@ -379,7 +374,7 @@ Item {
}
HifiControlsUit.Button {
id: signUpButton
width: d.minWidthButton
width: emailField.width / 2
height: d.minHeightButton
color: hifi.buttons.blue
text: qsTr("Sign Up")

View file

@ -1,90 +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 controlsUit 1.0
import stylesUit 1.0
Item {
id: welcomeBody
clip: true
width: root.pane.width
height: root.pane.height
property bool welcomeBack: false
function setTitle() {
root.title = (welcomeBack ? qsTr("Welcome back <b>") : qsTr("Welcome <b>")) + Account.username + qsTr("</b>!")
root.iconText = ""
d.resize();
}
QtObject {
id: d
readonly property int minWidth: 480
readonly property int maxWidth: 1280
readonly property int minHeight: 120
readonly property int maxHeight: 720
function resize() {
var targetWidth = Math.max(titleWidth, mainTextContainer.contentWidth)
var targetHeight = mainTextContainer.height + 3 * 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))
}
}
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: root.tryDestroy()
}
}
Component.onCompleted: welcomeBody.setTitle()
Connections {
target: Account
onUsernameChanged: welcomeBody.setTitle()
}
}

View file

@ -6267,7 +6267,7 @@ void Application::update(float deltaTime) {
_overlays.update(deltaTime);
}
if (!_loginDialogOverlayID.isNull()) {
_loginStateManager.update(getMyAvatar()->getDominantHand());
_loginStateManager.update(getMyAvatar()->getDominantHand(), _loginDialogOverlayID);
updateLoginDialogOverlayPosition();
}
@ -8631,7 +8631,7 @@ void Application::createLoginDialogOverlay() {
auto offset = headLookVec * 0.7f;
auto overlayPosition = (cameraPosition + offset) + (upVec * -0.1f);
const glm::vec2 LOGIN_OVERLAY_DIMENSIONS{ 0.5f, 0.5f };
const glm::vec2 LOGIN_OVERLAY_DIMENSIONS{ 0.89f, 0.5f };
QVariantMap overlayProperties = {
{ "name", "LoginDialogOverlay" },
{ "url", OVERLAY_LOGIN_DIALOG_URL },

View file

@ -210,7 +210,7 @@ void LoginStateManager::setUp() {
pointers->enablePointer(_rightLoginPointerID);
}
void LoginStateManager::update(const QString dominantHand) {
void LoginStateManager::update(const QString dominantHand, const QUuid loginOverlayID) {
if (!isSetUp()) {
return;
}
@ -223,6 +223,12 @@ void LoginStateManager::update(const QString dominantHand) {
QString mode = "full";
auto rightObjectID = raypicks->getPrevRayPickResult(_rightLoginPointerID)["objectID"].toUuid();
auto leftObjectID = raypicks->getPrevRayPickResult(_leftLoginPointerID)["objectID"].toUuid();
if (leftObjectID.isNull() || leftObjectID != loginOverlayID) {
pointers->setRenderState(_leftLoginPointerID, "");
}
if (rightObjectID.isNull() || rightObjectID != loginOverlayID) {
pointers->setRenderState(_leftLoginPointerID, "");
}
if (_dominantHand == "left" && !leftObjectID.isNull()) {
// dominant is left.
pointers->setRenderState(_rightLoginPointerID, "");

View file

@ -26,7 +26,7 @@ public:
void setUp();
void tearDown();
void update(const QString dominantHand);
void update(const QString dominantHand, const QUuid loginOverlayID);
bool isSetUp() const { return (_leftLoginPointerID > PointerEvent::INVALID_POINTER_ID) && (_rightLoginPointerID > PointerEvent::INVALID_POINTER_ID); }