From e9d3c36873ea57f42c48f1a824c859734228fc42 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 18 Jan 2017 12:47:45 -0800 Subject: [PATCH] Final commit? --- .../resources/qml/hifi/LetterboxMessage.qml | 109 +++++++++--------- interface/resources/qml/hifi/NameCard.qml | 5 +- interface/resources/qml/hifi/Pal.qml | 10 +- scripts/system/pal.js | 3 +- 4 files changed, 66 insertions(+), 61 deletions(-) diff --git a/interface/resources/qml/hifi/LetterboxMessage.qml b/interface/resources/qml/hifi/LetterboxMessage.qml index 66699eb753..e50d1de547 100644 --- a/interface/resources/qml/hifi/LetterboxMessage.qml +++ b/interface/resources/qml/hifi/LetterboxMessage.qml @@ -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 { diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index 08fa14ff97..745c100202 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -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 diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index dc6f698947..fe14016931 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -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); } diff --git a/scripts/system/pal.js b/scripts/system/pal.js index b95e9bdb87..7c6b8662c7 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -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