Merge branch 'loginInitiative2' of https://github.com/wayne-chen/hifi into loginInitiative2

This commit is contained in:
Wayne Chen 2018-12-06 09:05:07 -08:00
commit 89a216a5ec
14 changed files with 70 additions and 91 deletions

View file

@ -54,7 +54,7 @@ FocusScope {
Image { Image {
z: -10 z: -10
id: loginDialogBackground id: loginDialogBackground
source: "LoginDialog/background.jpg" source: "LoginDialog/images/background.jpg"
anchors.fill: parent anchors.fill: parent
} }
@ -63,7 +63,7 @@ FocusScope {
id: opaqueRect id: opaqueRect
height: parent.height height: parent.height
width: parent.width width: parent.width
opacity: 0.5 opacity: 0.25
color: "black" color: "black"
} }

View file

@ -61,23 +61,39 @@ Item {
id: contentItem id: contentItem
anchors.fill: parent anchors.fill: parent
TextMetrics { Item {
id: loginErrorMessageTextMetrics id: errorContainer
font: loginErrorMessage.font width: parent.width
text: loginErrorMessage.text height: loginErrorMessageTextMetrics.height
} anchors {
Text { bottom: buttons.top;
id: loginErrorMessage bottomMargin: hifi.dimensions.contentSpacing.y;
anchors.top: parent.top; left: buttons.left;
// above buttons. }
anchors.topMargin: (parent.height - additionalTextContainer.height) / 2 - hifi.dimensions.contentSpacing.y - profileButton.height TextMetrics {
anchors.left: parent.left; id: loginErrorMessageTextMetrics
anchors.leftMargin: (parent.width - loginErrorMessageTextMetrics.width) / 2; font: loginErrorMessage.font
color: "red"; text: loginErrorMessage.text
font.family: completeProfileBody.fontFamily }
font.pixelSize: completeProfileBody.fontSize Text {
text: completeProfileBody.errorString id: loginErrorMessage;
visible: true width: root.bannerWidth
color: "red";
font.family: signUpBody.fontFamily
font.pixelSize: 18
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: completeProfileBody.errorString
visible: true
}
Component.onCompleted: {
if (loginErrorMessageTextMetrics.width > 350 && root.isTablet) {
loginErrorMessage.wrapMode = Text.WordWrap;
loginErrorMessage.verticalAlignment = Text.AlignLeft;
loginErrorMessage.horizontalAlignment = Text.AlignLeft;
errorContainer.height = 2 * loginErrorMessageTextMetrics.height;
}
}
} }
Item { Item {

View file

@ -165,7 +165,9 @@ Item {
} }
onFocusChanged: { onFocusChanged: {
root.text = ""; root.text = "";
root.isPassword = !focus; if (focus) {
root.isPassword = false;
}
} }
} }
HifiControlsUit.TextField { HifiControlsUit.TextField {
@ -471,7 +473,7 @@ Item {
onFocusEnabled: { onFocusEnabled: {
Qt.callLater(function() { Qt.callLater(function() {
emailField.forceActiveFocus(); emailField.forceActiveFocus();
}) });
} }
} }
@ -482,6 +484,9 @@ Item {
root.text = ""; root.text = "";
d.resize(); d.resize();
init(); init();
Qt.callLater(function() {
emailField.forceActiveFocus();
});
} }
Keys.onPressed: { Keys.onPressed: {

View file

@ -72,10 +72,9 @@ Item {
loggingInGlyph.visible = true; loggingInGlyph.visible = true;
loggingInText.text = "Logging in to Steam"; loggingInText.text = "Logging in to Steam";
loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2; loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2;
} else if (loggingInBody.withOculus) { } else if (loggingInBody.withOculus) {
loggingInGlyph.visible = true;
loggingInGlyph.text = hifi.glyphs.oculus; loggingInGlyph.text = hifi.glyphs.oculus;
loggingInGlyph.visible = true;
loggingInText.text = "Logging in to Oculus"; loggingInText.text = "Logging in to Oculus";
loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2; loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2;
} else { } else {
@ -95,16 +94,12 @@ Item {
if (loggingInBody.withSteam) { if (loggingInBody.withSteam) {
// reset the flag. // reset the flag.
loggingInGlyph.visible = false; loggingInGlyph.visible = false;
loggingInText.text = "You are now logged into Steam!" loggingInText.text = "You are now logged into Steam!";
loggingInText.anchors.centerIn = loggingInHeader;
loggingInText.anchors.bottom = loggingInHeader.bottom;
loggedInGlyph.visible = true; loggedInGlyph.visible = true;
} else if (loggingInBody.withOculus) { } else if (loggingInBody.withOculus) {
// reset the flag. // reset the flag.
loggingInGlyph.visible = false; loggingInGlyph.visible = false;
loggingInText.text = "You are now logged into Oculus!" loggingInText.text = "You are now logged into Oculus!";
loggingInText.anchors.centerIn = loggingInHeader;
loggingInText.anchors.bottom = loggingInHeader.bottom;
loggedInGlyph.text = hifi.glyphs.oculus; loggedInGlyph.text = hifi.glyphs.oculus;
loggedInGlyph.visible = true; loggedInGlyph.visible = true;
} else { } else {
@ -119,30 +114,6 @@ Item {
height: root.height height: root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize(); onHeightChanged: d.resize(); onWidthChanged: d.resize();
Rectangle {
id: opaqueRect
height: parent.height
width: parent.width
opacity: 0.7
color: "black"
}
Item {
id: bannerContainer
width: parent.width
height: banner.height
anchors {
top: parent.top
topMargin: 0.18 * parent.height
}
Image {
id: banner
anchors.centerIn: parent
source: "../../images/high-fidelity-banner.svg"
horizontalAlignment: Image.AlignHCenter
}
}
Item { Item {
id: loggingInContainer id: loggingInContainer
width: parent.width width: parent.width
@ -176,7 +147,7 @@ Item {
// Alignment // Alignment
horizontalAlignment: Text.AlignHCenter; horizontalAlignment: Text.AlignHCenter;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
visible: loggingInBody.withSteam; visible: loggingInBody.withSteam || loggingInBody.withOculus;
} }
TextMetrics { TextMetrics {
@ -210,7 +181,7 @@ Item {
} }
AnimatedImage { AnimatedImage {
id: loggingInSpinner id: loggingInSpinner
source: "../../icons/loader-snake-64-w.gif" source: "images/loader-snake-298-b.gif"
width: 128 width: 128
height: width height: width
anchors.left: parent.left; anchors.left: parent.left;
@ -254,7 +225,7 @@ Item {
onHandleLinkCompleted: { onHandleLinkCompleted: {
console.log("Link Succeeded"); console.log("Link Succeeded");
loggingInBody.linkSteam = false; loggingInBody.linkSteam = false;
loadingSuccess(); loggingInBody.loadingSuccess();
} }
onHandleLinkFailed: { onHandleLinkFailed: {
console.log("Link Failed: " + error); console.log("Link Failed: " + error);
@ -263,7 +234,7 @@ Item {
onHandleLoginCompleted: { onHandleLoginCompleted: {
console.log("Login Succeeded"); console.log("Login Succeeded");
loadingSuccess(); loggingInBody.loadingSuccess();
} }
onHandleLoginFailed: { onHandleLoginFailed: {

View file

@ -85,30 +85,6 @@ Item {
height: root.height height: root.height
onHeightChanged: d.resize(); onWidthChanged: d.resize(); 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: loginContainer.top
bottomMargin: 0.07 * parent.height
}
Image {
id: banner
anchors.centerIn: parent
source: "../../images/high-fidelity-banner.svg"
horizontalAlignment: Image.AlignHCenter
}
}
Item { Item {
id: loginContainer id: loginContainer
width: usernameField.width width: usernameField.width
@ -189,7 +165,9 @@ Item {
} }
onFocusChanged: { onFocusChanged: {
root.text = ""; root.text = "";
root.isPassword = !focus; if (focus) {
root.isPassword = false;
}
} }
} }
@ -232,7 +210,9 @@ Item {
} }
onFocusChanged: { onFocusChanged: {
root.text = ""; root.text = "";
root.isPassword = !focus; if (focus) {
root.isPassword = false;
}
} }
} }
HifiControlsUit.TextField { HifiControlsUit.TextField {
@ -346,13 +326,12 @@ Item {
} }
HifiControlsUit.Button { HifiControlsUit.Button {
id: cancelButton id: cancelButton
width: emailField.width / 2 width: (emailField.width - hifi.dimensions.contentSpacing.x) / 2
height: d.minHeightButton height: d.minHeightButton
anchors { anchors {
top: keepMeLoggedInCheckbox.bottom top: keepMeLoggedInCheckbox.bottom
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
left: parent.left left: parent.left
leftMargin: (parent.width - passwordField.width) / 2
} }
color: hifi.buttons.noneBorderlessWhite color: hifi.buttons.noneBorderlessWhite
text: qsTr("CANCEL") text: qsTr("CANCEL")
@ -365,7 +344,7 @@ Item {
} }
HifiControlsUit.Button { HifiControlsUit.Button {
id: signUpButton id: signUpButton
width: emailField.width / 2 width: (emailField.width - hifi.dimensions.contentSpacing.x) / 2
height: d.minHeightButton height: d.minHeightButton
color: hifi.buttons.blue color: hifi.buttons.blue
text: qsTr("Sign Up") text: qsTr("Sign Up")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 KiB

View file

Before

Width:  |  Height:  |  Size: 272 KiB

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View file

@ -55,7 +55,7 @@ FocusScope {
Image { Image {
z: -10 z: -10
id: loginDialogBackground id: loginDialogBackground
source: "LoginDialog/background.jpg" source: "LoginDialog/images/background.jpg"
anchors.fill: parent anchors.fill: parent
} }
@ -64,7 +64,7 @@ FocusScope {
id: opaqueRect id: opaqueRect
height: parent.height height: parent.height
width: parent.width width: parent.width
opacity: 0.5 opacity: 0.25
color: "black" color: "black"
} }

View file

@ -94,7 +94,7 @@ FocusScope {
Image { Image {
z: -10 z: -10
id: loginDialogBackground id: loginDialogBackground
source: "../LoginDialog/background_tablet.jpg" source: "../LoginDialog/images/background_tablet.jpg"
anchors.fill: parent anchors.fill: parent
} }
@ -120,7 +120,7 @@ FocusScope {
id: opaqueRect id: opaqueRect
height: parent.height height: parent.height
width: parent.width width: parent.width
opacity: 0.5 opacity: 0.25
color: "black" color: "black"
} }

View file

@ -3789,7 +3789,7 @@ bool Application::event(QEvent* event) {
} }
// Allow focused Entities and Overlays to handle keyboard input // Allow focused Entities and Overlays to handle keyboard input
if (isKeyEvent(event->type()) && handleKeyEventForFocusedEntityOrOverlay(event)) { if (isKeyEvent(event->type()) && handleKeyEventForFocusedEntityOrOverlay(event) && !qApp->getLoginDialogPoppedUp()) {
return true; return true;
} }
@ -3902,6 +3902,10 @@ bool Application::eventFilter(QObject* object, QEvent* event) {
static bool _altPressed{ false }; static bool _altPressed{ false };
void Application::keyPressEvent(QKeyEvent* event) { void Application::keyPressEvent(QKeyEvent* event) {
if (isHMDMode() && qApp->getLoginDialogPoppedUp()) {
return;
}
_altPressed = event->key() == Qt::Key_Alt; _altPressed = event->key() == Qt::Key_Alt;
if (!event->isAutoRepeat()) { if (!event->isAutoRepeat()) {
@ -4145,6 +4149,10 @@ void Application::keyPressEvent(QKeyEvent* event) {
} }
void Application::keyReleaseEvent(QKeyEvent* event) { void Application::keyReleaseEvent(QKeyEvent* event) {
if (isHMDMode() && qApp->getLoginDialogPoppedUp()) {
return;
}
if (!event->isAutoRepeat()) { if (!event->isAutoRepeat()) {
_keysPressed.remove(event->key()); _keysPressed.remove(event->key());
} }