Final commit?

This commit is contained in:
Zach Fox 2017-01-18 12:47:45 -08:00
parent 1175752e1d
commit e9d3c36873
4 changed files with 66 additions and 61 deletions

View file

@ -37,72 +37,75 @@ Item {
anchors.centerIn: parent
radius: popupRadius
color: "white"
Column {
Item {
id: contentContainer
width: parent.width - 60
height: childrenRect.height
anchors.centerIn: parent
spacing: 20
Row {
Item {
id: popupHeaderContainer
visible: headerText.text !== "" || headerGlyph.text !== ""
height: 30
Column {
// Header Glyph
HiFiGlyphs {
id: headerGlyph
visible: headerGlyph.text !== ""
// Size
height: parent.parent.height
// Anchors
anchors.left: parent.left
anchors.leftMargin: -15
// Text Size
size: headerTextPixelSize*2.5
// Style
horizontalAlignment: Text.AlignHLeft
verticalAlignment: Text.AlignVCenter
color: hifi.colors.darkGray
}
}
Column {
// Header Text
Text {
id: headerText
visible: headerText.text !== ""
// Size
height: parent.parent.height
// Anchors
anchors.left: parent.left
anchors.leftMargin: -15
// Text Size
font.pixelSize: headerTextPixelSize
// Style
font.family: ralewaySemiBold.name
color: hifi.colors.darkGray
horizontalAlignment: Text.AlignHLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
textFormat: Text.StyledText
}
}
}
Row {
// Popup Text
Text {
id: popupText
// Anchors
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
// Header Glyph
HiFiGlyphs {
id: headerGlyph
visible: headerGlyph.text !== ""
// Size
width: parent.parent.width
// Text alignment
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHLeft
height: parent.height
// Anchors
anchors.left: parent.left
anchors.leftMargin: -15
// Text Size
size: headerTextPixelSize*2.5
// Style
font.pixelSize: popupTextPixelSize
font.family: ralewayRegular.name
horizontalAlignment: Text.AlignHLeft
verticalAlignment: Text.AlignVCenter
color: hifi.colors.darkGray
}
// Header Text
Text {
id: headerText
visible: headerText.text !== ""
// Size
height: parent.height
// Anchors
anchors.left: headerGlyph.right
anchors.leftMargin: -5
// Text Size
font.pixelSize: headerTextPixelSize
// Style
font.family: ralewaySemiBold.name
color: hifi.colors.darkGray
horizontalAlignment: Text.AlignHLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
textFormat: Text.StyledText
}
}
// Popup Text
Text {
id: popupText
// Size
width: parent.width
// Anchors
anchors.top: popupHeaderContainer.visible ? popupHeaderContainer.bottom : parent.top
anchors.topMargin: popupHeaderContainer.visible ? 15 : 0
anchors.left: parent.left
anchors.right: parent.right
// Text alignment
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHLeft
// Style
font.pixelSize: popupTextPixelSize
font.family: ralewayRegular.name
color: hifi.colors.darkGray
wrapMode: Text.WordWrap
textFormat: Text.StyledText
}
}
}
MouseArea {

View file

@ -164,7 +164,7 @@ Item {
text: thisNameCard.displayName
elide: Text.ElideRight
// Size
width: Math.min(displayNameTextMetrics.tightBoundingRect.width, parent.width - adminLabelText.width - adminLabelQuestionMark.width)
width: isAdmin ? Math.min(displayNameTextMetrics.tightBoundingRect.width + 8, parent.width - adminLabelText.width - adminLabelQuestionMark.width + 8) : parent.width
// Anchors
anchors.top: parent.top
anchors.left: parent.left
@ -183,13 +183,13 @@ Item {
// "ADMIN" label for other users' cards
RalewaySemiBold {
id: adminLabelText
visible: isAdmin
text: "ADMIN"
// Text size
size: displayNameText.size - 4
// Anchors
anchors.verticalCenter: parent.verticalCenter
anchors.left: displayNameText.right
anchors.leftMargin: 8
// Style
font.capitalization: Font.AllUppercase
color: hifi.colors.redHighlight
@ -200,6 +200,7 @@ Item {
// This Rectangle refers to the [?] popup button next to "ADMIN"
Item {
id: adminLabelQuestionMark
visible: isAdmin
// Size
width: 20
height: displayNameText.height

View file

@ -28,7 +28,7 @@ Rectangle {
property int rowHeight: 70
property int actionButtonWidth: 75
property int nameCardWidth: palContainer.width - actionButtonWidth*(iAmAdmin ? 4 : 2) - 4 - hifi.dimensions.scrollbarBackgroundWidth
property var myData: ({displayName: "", userName: "", audioLevel: 0.0}) // valid dummy until set
property var myData: ({displayName: "", userName: "", audioLevel: 0.0, admin: true}) // valid dummy until set
property var ignored: ({}); // Keep a local list of ignored avatars & their data. Necessary because HashMap is slow to respond after ignoring.
property var userModelData: [] // This simple list is essentially a mirror of the userModel listModel without all the extra complexities.
property bool iAmAdmin: false
@ -223,7 +223,7 @@ Rectangle {
visible: !isCheckBox && !isButton
uuid: model && model.sessionId
selected: styleData.selected
isAdmin: model && model.isAdmin
isAdmin: model && model.admin
// Size
width: nameCardWidth
height: parent.height
@ -472,7 +472,7 @@ Rectangle {
var userId = message.params[0];
// The text that goes in the userName field is the second parameter in the message.
var userName = message.params[1];
var isAdmin = message.params[2];
var admin = message.params[2];
// If the userId is empty, we're updating "myData".
if (!userId) {
myData.userName = userName;
@ -485,8 +485,8 @@ Rectangle {
userModel.setProperty(userIndex, "userName", userName);
userModelData[userIndex].userName = userName; // Defensive programming
// Set the admin status appropriately
userModel.setProperty(userIndex, "isAdmin", isAdmin);
userModelData[userIndex].isAdmin = isAdmin; // Defensive programming
userModel.setProperty(userIndex, "admin", admin);
userModelData[userIndex].admin = admin; // Defensive programming
} else {
console.log("updateUsername() called with unknown UUID: ", userId);
}

View file

@ -267,7 +267,8 @@ function populateUserList() {
displayName: avatar.sessionDisplayName,
userName: '',
sessionId: id || '',
audioLevel: 0.0
audioLevel: 0.0,
admin: false
};
// Request the username, fingerprint, and admin status from the given UUID
// Username and fingerprint returns "" if the requesting user isn't an admin