Style changes

This commit is contained in:
Zach Fox 2017-01-16 13:18:24 -08:00
parent 32e330320e
commit 3b56f46206
2 changed files with 23 additions and 14 deletions

View file

@ -28,7 +28,7 @@ Item {
property string uuid: "" property string uuid: ""
property string displayName: "" property string displayName: ""
property string userName: "" property string userName: ""
property int displayTextHeight: 18 property real displayNameTextPixelSize: 18
property int usernameTextHeight: 12 property int usernameTextHeight: 12
property real audioLevel: 0.0 property real audioLevel: 0.0
property bool isMyCard: false property bool isMyCard: false
@ -68,7 +68,7 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: -10 anchors.leftMargin: -10
// Style // Style
color: "#C5C5C5" color: hifi.colors.textFieldLightBackground
border.color: hifi.colors.blueHighlight border.color: hifi.colors.blueHighlight
border.width: 0 border.width: 0
TextInput { TextInput {
@ -77,23 +77,30 @@ Item {
text: thisNameCard.displayName text: thisNameCard.displayName
maximumLength: 64 maximumLength: 64
clip: true clip: true
// Size
width: parent.width
height: parent.height
// Anchors // Anchors
anchors.fill: parent anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10 anchors.leftMargin: 10
anchors.rightMargin: editGlyph.implicitWidth + editGlyph.anchors.rightMargin anchors.rightMargin: editGlyph.implicitWidth + editGlyph.anchors.rightMargin
// Text Positioning
verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: TextInput.AlignLeft
// Style // Style
color: hifi.colors.darkGray color: hifi.colors.darkGray
FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; } FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; }
font.family: firaSansSemiBold.name font.family: firaSansSemiBold.name
font.pointSize: thisNameCard.displayTextHeight font.pixelSize: displayNameTextPixelSize
selectionColor: hifi.colors.blueHighlight
selectedTextColor: "black"
// Text Positioning
verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: TextInput.AlignLeft
// Signals // Signals
onEditingFinished: { onEditingFinished: {
pal.sendToScript({method: 'displayNameUpdate', params: text}) pal.sendToScript({method: 'displayNameUpdate', params: text})
focus = false focus = false
myDisplayName.border.width = 0 myDisplayName.border.width = 0
color = hifi.colors.darkGray
} }
} }
MouseArea { MouseArea {
@ -101,23 +108,24 @@ Item {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
myDisplayName.border.width = 3 myDisplayName.border.width = 1
myDisplayNameText.focus ? myDisplayNameText.cursorPosition = myDisplayNameText.positionAt(mouseX, mouseY, TextInput.CursorOnCharacter) : myDisplayNameText.selectAll(); myDisplayNameText.focus ? myDisplayNameText.cursorPosition = myDisplayNameText.positionAt(mouseX, mouseY, TextInput.CursorOnCharacter) : myDisplayNameText.selectAll();
myDisplayNameText.focus = true myDisplayNameText.focus = true
myDisplayNameText.color = "black"
} }
onDoubleClicked: { onDoubleClicked: {
myDisplayNameText.selectAll(); myDisplayNameText.selectAll();
myDisplayNameText.focus = true; myDisplayNameText.focus = true;
} }
onEntered: myDisplayName.color = hifi.colors.lightGrayText onEntered: myDisplayName.color = hifi.colors.lightGrayText
onExited: myDisplayName.color = "#C5C5C5" onExited: myDisplayName.color = hifi.colors.textFieldLightBackground
} }
// Edit pencil glyph // Edit pencil glyph
HiFiGlyphs { HiFiGlyphs {
id: editGlyph id: editGlyph
text: hifi.glyphs.editPencil text: hifi.glyphs.editPencil
// Size // Text Size
size: thisNameCard.displayTextHeight*1.5 size: displayNameTextPixelSize*1.5
// Anchors // Anchors
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 5 anchors.rightMargin: 5
@ -150,7 +158,7 @@ Item {
// Anchors // Anchors
anchors.top: parent.top anchors.top: parent.top
// Text Size // Text Size
size: thisNameCard.displayTextHeight size: displayNameTextPixelSize
// Text Positioning // Text Positioning
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
// Style // Style
@ -189,7 +197,7 @@ Item {
Rectangle { Rectangle {
id: nameCardVUMeter id: nameCardVUMeter
// Size // Size
width: isMyCard ? gainSlider.width : ((gainSlider.value - gainSlider.minimumValue)/(gainSlider.maximumValue - gainSlider.minimumValue)) * parent.width width: isMyCard ? myDisplayName.width - 20 : ((gainSlider.value - gainSlider.minimumValue)/(gainSlider.maximumValue - gainSlider.minimumValue)) * parent.width
height: 8 height: 8
// Anchors // Anchors
anchors.top: spacer.bottom anchors.top: spacer.bottom

View file

@ -1047,7 +1047,7 @@ bool AvatarData::processAvatarIdentity(const Identity& identity) {
} }
if (identity.displayName != _displayName) { if (identity.displayName != _displayName) {
setDisplayName(identity.displayName); _displayName = identity.displayName;
hasIdentityChanged = true; hasIdentityChanged = true;
} }
maybeUpdateSessionDisplayNameFromTransport(identity.sessionDisplayName); maybeUpdateSessionDisplayNameFromTransport(identity.sessionDisplayName);
@ -1094,6 +1094,7 @@ void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) {
void AvatarData::setDisplayName(const QString& displayName) { void AvatarData::setDisplayName(const QString& displayName) {
_displayName = displayName; _displayName = displayName;
DependencyManager::get<NodeList>()->getDomainHandler().softReset(); DependencyManager::get<NodeList>()->getDomainHandler().softReset();
qCDebug(avatars) << "Changing display name for avatar to" << displayName; qCDebug(avatars) << "Changing display name for avatar to" << displayName;