mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:09:01 +02:00
Final commit?
This commit is contained in:
parent
1175752e1d
commit
e9d3c36873
4 changed files with 66 additions and 61 deletions
|
@ -37,72 +37,75 @@ Item {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
radius: popupRadius
|
radius: popupRadius
|
||||||
color: "white"
|
color: "white"
|
||||||
Column {
|
Item {
|
||||||
id: contentContainer
|
id: contentContainer
|
||||||
width: parent.width - 60
|
width: parent.width - 60
|
||||||
|
height: childrenRect.height
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 20
|
Item {
|
||||||
Row {
|
|
||||||
id: popupHeaderContainer
|
id: popupHeaderContainer
|
||||||
visible: headerText.text !== "" || headerGlyph.text !== ""
|
visible: headerText.text !== "" || headerGlyph.text !== ""
|
||||||
height: 30
|
height: 30
|
||||||
Column {
|
// Anchors
|
||||||
// Header Glyph
|
anchors.top: parent.top
|
||||||
HiFiGlyphs {
|
anchors.left: parent.left
|
||||||
id: headerGlyph
|
anchors.right: parent.right
|
||||||
visible: headerGlyph.text !== ""
|
// Header Glyph
|
||||||
// Size
|
HiFiGlyphs {
|
||||||
height: parent.parent.height
|
id: headerGlyph
|
||||||
// Anchors
|
visible: headerGlyph.text !== ""
|
||||||
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
|
|
||||||
// Size
|
// Size
|
||||||
width: parent.parent.width
|
height: parent.height
|
||||||
// Text alignment
|
// Anchors
|
||||||
verticalAlignment: Text.AlignVCenter
|
anchors.left: parent.left
|
||||||
horizontalAlignment: Text.AlignHLeft
|
anchors.leftMargin: -15
|
||||||
|
// Text Size
|
||||||
|
size: headerTextPixelSize*2.5
|
||||||
// Style
|
// Style
|
||||||
font.pixelSize: popupTextPixelSize
|
horizontalAlignment: Text.AlignHLeft
|
||||||
font.family: ralewayRegular.name
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: hifi.colors.darkGray
|
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
|
wrapMode: Text.WordWrap
|
||||||
textFormat: Text.StyledText
|
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 {
|
MouseArea {
|
||||||
|
|
|
@ -164,7 +164,7 @@ Item {
|
||||||
text: thisNameCard.displayName
|
text: thisNameCard.displayName
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
// Size
|
// 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
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -183,13 +183,13 @@ Item {
|
||||||
// "ADMIN" label for other users' cards
|
// "ADMIN" label for other users' cards
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: adminLabelText
|
id: adminLabelText
|
||||||
|
visible: isAdmin
|
||||||
text: "ADMIN"
|
text: "ADMIN"
|
||||||
// Text size
|
// Text size
|
||||||
size: displayNameText.size - 4
|
size: displayNameText.size - 4
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.left: displayNameText.right
|
anchors.left: displayNameText.right
|
||||||
anchors.leftMargin: 8
|
|
||||||
// Style
|
// Style
|
||||||
font.capitalization: Font.AllUppercase
|
font.capitalization: Font.AllUppercase
|
||||||
color: hifi.colors.redHighlight
|
color: hifi.colors.redHighlight
|
||||||
|
@ -200,6 +200,7 @@ Item {
|
||||||
// This Rectangle refers to the [?] popup button next to "ADMIN"
|
// This Rectangle refers to the [?] popup button next to "ADMIN"
|
||||||
Item {
|
Item {
|
||||||
id: adminLabelQuestionMark
|
id: adminLabelQuestionMark
|
||||||
|
visible: isAdmin
|
||||||
// Size
|
// Size
|
||||||
width: 20
|
width: 20
|
||||||
height: displayNameText.height
|
height: displayNameText.height
|
||||||
|
|
|
@ -28,7 +28,7 @@ Rectangle {
|
||||||
property int rowHeight: 70
|
property int rowHeight: 70
|
||||||
property int actionButtonWidth: 75
|
property int actionButtonWidth: 75
|
||||||
property int nameCardWidth: palContainer.width - actionButtonWidth*(iAmAdmin ? 4 : 2) - 4 - hifi.dimensions.scrollbarBackgroundWidth
|
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 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 var userModelData: [] // This simple list is essentially a mirror of the userModel listModel without all the extra complexities.
|
||||||
property bool iAmAdmin: false
|
property bool iAmAdmin: false
|
||||||
|
@ -223,7 +223,7 @@ Rectangle {
|
||||||
visible: !isCheckBox && !isButton
|
visible: !isCheckBox && !isButton
|
||||||
uuid: model && model.sessionId
|
uuid: model && model.sessionId
|
||||||
selected: styleData.selected
|
selected: styleData.selected
|
||||||
isAdmin: model && model.isAdmin
|
isAdmin: model && model.admin
|
||||||
// Size
|
// Size
|
||||||
width: nameCardWidth
|
width: nameCardWidth
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
@ -472,7 +472,7 @@ Rectangle {
|
||||||
var userId = message.params[0];
|
var userId = message.params[0];
|
||||||
// The text that goes in the userName field is the second parameter in the message.
|
// The text that goes in the userName field is the second parameter in the message.
|
||||||
var userName = message.params[1];
|
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 the userId is empty, we're updating "myData".
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
myData.userName = userName;
|
myData.userName = userName;
|
||||||
|
@ -485,8 +485,8 @@ Rectangle {
|
||||||
userModel.setProperty(userIndex, "userName", userName);
|
userModel.setProperty(userIndex, "userName", userName);
|
||||||
userModelData[userIndex].userName = userName; // Defensive programming
|
userModelData[userIndex].userName = userName; // Defensive programming
|
||||||
// Set the admin status appropriately
|
// Set the admin status appropriately
|
||||||
userModel.setProperty(userIndex, "isAdmin", isAdmin);
|
userModel.setProperty(userIndex, "admin", admin);
|
||||||
userModelData[userIndex].isAdmin = isAdmin; // Defensive programming
|
userModelData[userIndex].admin = admin; // Defensive programming
|
||||||
} else {
|
} else {
|
||||||
console.log("updateUsername() called with unknown UUID: ", userId);
|
console.log("updateUsername() called with unknown UUID: ", userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,8 @@ function populateUserList() {
|
||||||
displayName: avatar.sessionDisplayName,
|
displayName: avatar.sessionDisplayName,
|
||||||
userName: '',
|
userName: '',
|
||||||
sessionId: id || '',
|
sessionId: id || '',
|
||||||
audioLevel: 0.0
|
audioLevel: 0.0,
|
||||||
|
admin: false
|
||||||
};
|
};
|
||||||
// Request the username, fingerprint, and admin status from the given UUID
|
// Request the username, fingerprint, and admin status from the given UUID
|
||||||
// Username and fingerprint returns "" if the requesting user isn't an admin
|
// Username and fingerprint returns "" if the requesting user isn't an admin
|
||||||
|
|
Loading…
Reference in a new issue