change short username to 14 characters, displaying as normal text

This commit is contained in:
Wayne Chen 2019-02-26 12:26:50 -08:00
parent 650b34c463
commit 028cce5394
2 changed files with 5 additions and 20 deletions

View file

@ -134,8 +134,7 @@ Item {
Text {
id: loginText
anchors.right: parent.right
visible: !Account.loggedIn
text: qsTr("Log in")
text: Account.loggedIn ? tabletRoot.usernameShort : qsTr("Log in")
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignRight
font.pixelSize: 18
@ -144,29 +143,15 @@ Item {
}
TextMetrics {
id: loginTextMetrics
text: Account.loggedIn ? tabletRoot.usernameShort : loginText.text
text: loginText.text
font: loginText.font
}
HifiStylesUit.ShortcutText {
anchors.right: parent.right
visible: Account.loggedIn
text: "<a href='https://highfidelity.com'>" + tabletRoot.usernameShort + "</a>"
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignRight
font.pixelSize: 18
font.bold: true
font.family: "Rawline"
linkColor: hifi.colors.blueAccent
}
MouseArea {
anchors.fill: parent
onClicked: {
if (!Account.loggedIn) {
DialogsManager.showLoginDialog();
} else {
Account.logOut();
}
}
}

View file

@ -178,10 +178,10 @@ Rectangle {
function setUsername(newUsername) {
username = newUsername;
usernameShort = newUsername.substring(0, 8);
usernameShort = newUsername.substring(0, 14);
if (newUsername.length > 8) {
usernameShort = usernameShort + "..."
if (newUsername.length > 14) {
usernameShort = usernameShort + "..."
}
}