mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:56:55 +02:00
adding text wrapping/fixing keep me logged in setting
This commit is contained in:
parent
941050d42c
commit
b4e2b74f3d
4 changed files with 95 additions and 48 deletions
|
@ -42,8 +42,8 @@ Item {
|
||||||
maxWidth = root.width;
|
maxWidth = root.width;
|
||||||
maxHeight = root.height;
|
maxHeight = root.height;
|
||||||
if (root.isTablet === false) {
|
if (root.isTablet === false) {
|
||||||
var targetWidth = Math.max(Math.max(titleWidth, Math.max(additionalTextContainer.contentWidth,
|
var targetWidth = Math.max(Math.max(titleWidth, Math.max(additionalTextContainer.width,
|
||||||
termsContainer.contentWidth)), mainContainer.width)
|
termsContainer.width)), mainContainer.width)
|
||||||
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
|
parent.width = root.width = Math.max(d.minWidth, Math.min(d.maxWidth, targetWidth))
|
||||||
}
|
}
|
||||||
var targetHeight = Math.max(5 * hifi.dimensions.contentSpacing.y + d.minHeightButton + additionalTextContainer.height + termsContainer.height, d.maxHeight)
|
var targetHeight = Math.max(5 * hifi.dimensions.contentSpacing.y + d.minHeightButton + additionalTextContainer.height + termsContainer.height, d.maxHeight)
|
||||||
|
@ -88,7 +88,7 @@ Item {
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (loginErrorMessageTextMetrics.width > 350 && root.isTablet) {
|
if (loginErrorMessageTextMetrics.width > root.bannerWidth && root.isTablet) {
|
||||||
loginErrorMessage.wrapMode = Text.WordWrap;
|
loginErrorMessage.wrapMode = Text.WordWrap;
|
||||||
loginErrorMessage.verticalAlignment = Text.AlignLeft;
|
loginErrorMessage.verticalAlignment = Text.AlignLeft;
|
||||||
loginErrorMessage.horizontalAlignment = Text.AlignLeft;
|
loginErrorMessage.horizontalAlignment = Text.AlignLeft;
|
||||||
|
@ -148,64 +148,102 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiStylesUit.ShortcutText {
|
Item {
|
||||||
id: additionalTextContainer
|
id: additionalTextContainer
|
||||||
|
width: parent.width
|
||||||
|
height: additionalTextMetrics.height
|
||||||
anchors {
|
anchors {
|
||||||
top: buttons.bottom
|
top: buttons.bottom
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
margins: 0
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y
|
topMargin: hifi.dimensions.contentSpacing.y
|
||||||
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
text: "<a href='https://fake.link'>Already have a High Fidelity profile? Link to an existing profile here.</a>"
|
TextMetrics {
|
||||||
|
id: additionalTextMetrics
|
||||||
|
font: additionalText.font
|
||||||
|
text: "Already have a High Fidelity profile? Link to an existing profile here."
|
||||||
|
}
|
||||||
|
|
||||||
font.family: completeProfileBody.fontFamily
|
HifiStylesUit.ShortcutText {
|
||||||
font.pixelSize: completeProfileBody.fontSize
|
id: additionalText
|
||||||
font.bold: completeProfileBody.fontBold
|
text: "<a href='https://fake.link'>Already have a High Fidelity profile? Link to an existing profile here.</a>"
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
lineHeight: 2
|
|
||||||
lineHeightMode: Text.ProportionalHeight
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
linkColor: hifi.colors.blueAccent
|
|
||||||
|
|
||||||
onLinkActivated: {
|
font.family: completeProfileBody.fontFamily
|
||||||
loginDialog.isLogIn = true;
|
font.pixelSize: completeProfileBody.fontSize
|
||||||
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": "", "withSteam": true, "linkSteam": true });
|
font.bold: completeProfileBody.fontBold
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
lineHeight: 1
|
||||||
|
lineHeightMode: Text.ProportionalHeight
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
linkColor: hifi.colors.blueAccent
|
||||||
|
|
||||||
|
onLinkActivated: {
|
||||||
|
loginDialog.isLogIn = true;
|
||||||
|
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": "", "withSteam": true, "linkSteam": true });
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (additionalTextMetrics.width > root.bannerWidth && root.isTablet) {
|
||||||
|
additionalText.width = root.bannerWidth;
|
||||||
|
additionalText.wrapMode = Text.WordWrap;
|
||||||
|
additionalText.verticalAlignment = Text.AlignLeft;
|
||||||
|
additionalText.horizontalAlignment = Text.AlignLeft;
|
||||||
|
additionalTextContainer.height = 3 * additionalTextMetrics.height;
|
||||||
|
additionalTextContainer.anchors.left = buttons.left;
|
||||||
|
} else {
|
||||||
|
additionalText.anchors.centerIn = additionalTextContainer;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextMetrics {
|
Item {
|
||||||
id: termsContainerTextMetrics
|
|
||||||
font: termsContainer.font
|
|
||||||
text: completeProfileBody.termsContainerText
|
|
||||||
Component.onCompleted: {
|
|
||||||
// with the link.
|
|
||||||
termsContainer.text = qsTr("By creating this user profile, you agree to <a href='https://highfidelity.com/terms'>High Fidelity's Terms of Service</a>")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HifiStylesUit.InfoItem {
|
|
||||||
id: termsContainer
|
id: termsContainer
|
||||||
|
width: parent.width
|
||||||
|
height: termsTextMetrics.height
|
||||||
anchors {
|
anchors {
|
||||||
top: additionalTextContainer.bottom
|
top: additionalTextContainer.bottom
|
||||||
margins: 0
|
|
||||||
topMargin: 2 * hifi.dimensions.contentSpacing.y
|
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
topMargin: 2 * hifi.dimensions.contentSpacing.y
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: (parent.width - termsContainerTextMetrics.width) / 2
|
}
|
||||||
|
TextMetrics {
|
||||||
|
id: termsTextMetrics
|
||||||
|
font: termsText.font
|
||||||
|
text: completeProfileBody.termsContainerText
|
||||||
|
Component.onCompleted: {
|
||||||
|
// with the link.
|
||||||
|
termsText.text = qsTr("By creating this user profile, you agree to <a href='https://highfidelity.com/terms'>High Fidelity's Terms of Service</a>")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
text: completeProfileBody.termsContainerText
|
HifiStylesUit.InfoItem {
|
||||||
font.family: completeProfileBody.fontFamily
|
id: termsText
|
||||||
font.pixelSize: completeProfileBody.fontSize
|
text: completeProfileBody.termsContainerText
|
||||||
font.bold: completeProfileBody.fontBold
|
font.family: completeProfileBody.fontFamily
|
||||||
wrapMode: Text.WordWrap
|
font.pixelSize: completeProfileBody.fontSize
|
||||||
color: hifi.colors.lightGray
|
font.bold: completeProfileBody.fontBold
|
||||||
linkColor: hifi.colors.blueAccent
|
wrapMode: Text.WordWrap
|
||||||
lineHeight: 1
|
color: hifi.colors.lightGray
|
||||||
lineHeightMode: Text.ProportionalHeight
|
linkColor: hifi.colors.blueAccent
|
||||||
|
lineHeight: 1
|
||||||
|
lineHeightMode: Text.ProportionalHeight
|
||||||
|
|
||||||
onLinkActivated: loginDialog.openUrl(link);
|
onLinkActivated: loginDialog.openUrl(link);
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (termsTextMetrics.width > root.bannerWidth && root.isTablet) {
|
||||||
|
termsText.width = root.bannerWidth;
|
||||||
|
termsText.wrapMode = Text.WordWrap;
|
||||||
|
additionalText.verticalAlignment = Text.AlignLeft;
|
||||||
|
additionalText.horizontalAlignment = Text.AlignLeft;
|
||||||
|
termsContainer.height = 3 * termsTextMetrics.height;
|
||||||
|
termsContainer.anchors.left = buttons.left;
|
||||||
|
} else {
|
||||||
|
termsText.anchors.centerIn = termsContainer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ Item {
|
||||||
id: loginContainer
|
id: loginContainer
|
||||||
width: emailField.width
|
width: emailField.width
|
||||||
height: errorContainer.height + emailField.height + passwordField.height + 5.5 * hifi.dimensions.contentSpacing.y +
|
height: errorContainer.height + emailField.height + passwordField.height + 5.5 * hifi.dimensions.contentSpacing.y +
|
||||||
keepMeLoggedInCheckbox.height + loginButton.height + cantAccessTextMetrics.height + continueButton.height
|
keepMeLoggedInCheckbox.height + loginButton.height + cantAccessTextMetrics.height + continueButton.height + steamInfoTextMetrics.height
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: root.bannerHeight + 0.25 * parent.height
|
topMargin: root.bannerHeight + 0.25 * parent.height
|
||||||
|
@ -268,10 +268,10 @@ Item {
|
||||||
}
|
}
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
Settings.setValue("keepMeLoggedIn", checked);
|
Settings.setValue("keepMeLoggedIn", checked);
|
||||||
}
|
|
||||||
Component.onDestruction: {
|
|
||||||
if (keepMeLoggedInCheckbox.checked) {
|
if (keepMeLoggedInCheckbox.checked) {
|
||||||
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
|
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
|
||||||
|
} else {
|
||||||
|
Settings.setValue("keepMeLoggedIn/savedUsername", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,8 +309,14 @@ Item {
|
||||||
linkAccountBody.login()
|
linkAccountBody.login()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TextMetrics {
|
||||||
|
id: steamInfoTextMetrics
|
||||||
|
font: steamInfoText.font
|
||||||
|
text: steamInfoText.text
|
||||||
|
}
|
||||||
Text {
|
Text {
|
||||||
id: steamInfoText
|
id: steamInfoText
|
||||||
|
width: root.bannerWidth
|
||||||
visible: linkAccountBody.linkSteam
|
visible: linkAccountBody.linkSteam
|
||||||
anchors {
|
anchors {
|
||||||
top: loginButton.bottom
|
top: loginButton.bottom
|
||||||
|
@ -324,6 +330,11 @@ Item {
|
||||||
text: qsTr("Your Steam account information will not be exposed to others.");
|
text: qsTr("Your Steam account information will not be exposed to others.");
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (steamInfoTextMetrics.width > root.bannerWidth) {
|
||||||
|
steamInfoText.wrapMode = Text.WordWrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: cantAccessTextMetrics
|
id: cantAccessTextMetrics
|
||||||
|
|
|
@ -313,10 +313,10 @@ Item {
|
||||||
}
|
}
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
Settings.setValue("keepMeLoggedIn", checked);
|
Settings.setValue("keepMeLoggedIn", checked);
|
||||||
}
|
|
||||||
Component.onDestruction: {
|
|
||||||
if (keepMeLoggedInCheckbox.checked) {
|
if (keepMeLoggedInCheckbox.checked) {
|
||||||
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
|
Settings.setValue("keepMeLoggedIn/savedUsername", emailField.text);
|
||||||
|
} else {
|
||||||
|
Settings.setValue("keepMeLoggedIn/savedUsername", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,6 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryDestroy() {
|
function tryDestroy() {
|
||||||
canceled();
|
|
||||||
root.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
Loading…
Reference in a new issue