Checkpoint

This commit is contained in:
Zach Fox 2017-01-17 16:30:15 -08:00
parent 346cfbfe02
commit 202d4e8107
3 changed files with 89 additions and 21 deletions

View file

@ -15,7 +15,12 @@ import "../styles-uit"
Item {
property alias text: popupText.text
property alias headerGlyph: headerGlyph.text
property alias headerText: headerText.text
property real popupRadius: hifi.dimensions.borderRadius
property real headerTextPixelSize: 22
FontLoader { id: ralewayRegular; source: "../../fonts/Raleway-Regular.ttf"; }
FontLoader { id: ralewaySemiBold; source: "../../fonts/Raleway-SemiBold.ttf"; }
visible: false
id: letterbox
anchors.fill: parent
@ -27,19 +32,73 @@ Item {
}
Rectangle {
width: Math.max(parent.width * 0.75, 400)
height: popupText.contentHeight*1.5
height: contentContainer.height*1.5
anchors.centerIn: parent
radius: popupRadius
color: "white"
FiraSansSemiBold {
id: popupText
size: hifi.fontSizes.textFieldInput
color: hifi.colors.darkGray
horizontalAlignment: Text.AlignHCenter
anchors.fill: parent
anchors.leftMargin: 15
anchors.rightMargin: 15
wrapMode: Text.WordWrap
Item {
id: contentContainer
anchors.centerIn: parent
anchors.margins: 20
height: childrenRect.height
Item {
id: popupHeaderContainer
visible: headerText.text !== "" || glyphText.text !== ""
// Size
width: parent.width
height: childrenRect.height
// Anchors
anchors.top: parent.top
anchors.left: parent.left
// Header Glyph
HiFiGlyphs {
id: headerGlyph
visible: headerText.text !== ""
// Text Size
size: headerTextPixelSize * 2.5
// Anchors
anchors.top: parent.top
anchors.left: parent.left
anchors.rightMargin: 5
// Style
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: hifi.colors.darkGray
}
Text {
id: headerText
visible: headerGlyph.text !== ""
// Text Size
font.pixelSize: headerTextPixelSize
// Anchors
anchors.top: parent.top
anchors.left: headerGlyph.right
// Style
font.family: ralewaySemiBold.name
color: hifi.colors.darkGray
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
textFormat: Text.StyledText
}
}
Text {
id: popupText
// Anchors
anchors.top: popupHeaderContainer.visible ? popupHeaderContainer.anchors.bottom : parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
// Text alignment
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
// Style
font.pixelSize: hifi.fontSizes.textFieldInput
font.family: ralewayRegular.name
color: hifi.colors.darkGray
wrapMode: Text.WordWrap
textFormat: Text.StyledText
}
}
}
MouseArea {

View file

@ -163,6 +163,8 @@ Item {
// Properties
text: thisNameCard.displayName
elide: Text.ElideRight
// Size
width: Math.min(displayNameTextMetrics.tightBoundingRect.width, parent.width - adminLabelText.width - adminLabelQuestionMark.width)
// Anchors
anchors.top: parent.top
anchors.left: parent.left
@ -173,6 +175,11 @@ Item {
// Style
color: hifi.colors.darkGray
}
TextMetrics {
id: displayNameTextMetrics
font: displayNameText.font
text: displayNameText.text
}
// "ADMIN" label for other users' cards
RalewaySemiBold {
id: adminLabelText
@ -192,6 +199,7 @@ Item {
}
// This Rectangle refers to the [?] popup button next to "ADMIN"
Item {
id: adminLabelQuestionMark
// Size
width: 20
height: displayNameText.height
@ -199,7 +207,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
anchors.left: adminLabelText.right
RalewayRegular {
id: adminLabelQuestionMark
id: adminLabelQuestionMarkText
text: "[?]"
size: adminLabelText.size
font.capitalization: Font.AllUppercase
@ -212,10 +220,9 @@ Item {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
hoverEnabled: true
onClicked: letterbox('Silencing a user mutes their microphone. Silenced users can unmute themselves by clicking the "UNMUTE" button on their HUD.\n\n' +
"Banning a user will remove them from this domain and prevent them from returning. You can un-ban users from your domain's settings page.)")
onEntered: adminLabelQuestionMark.color = "#94132e"
onExited: adminLabelQuestionMark.color = hifi.colors.redHighlight
onClicked: letterbox("This user is an admin on this domain. Admins can <b>Silence</b> and <b>Ban</b> other users at their discretion - so be extra nice!", hifi.glyphs.question, "Domain Admin")
onEntered: adminLabelQuestionMarkText.color = "#94132e"
onExited: adminLabelQuestionMarkText.color = hifi.colors.redHighlight
}
}
}

View file

@ -41,8 +41,10 @@ Rectangle {
id: letterboxMessage
z: 999 // Force the popup on top of everything else
}
function letterbox(message) {
function letterbox(message, headerGlyph, headerText) {
letterboxMessage.text = message
letterboxMessage.headerGlyph = headerGlyph
letterboxMessage.headerText = headerText
letterboxMessage.visible = true
letterboxMessage.popupRadius = 0
}
@ -372,7 +374,7 @@ Rectangle {
hoverEnabled: true
onClicked: letterbox("Bold names in the list are Avatar Display Names.\n" +
"If a Display Name isn't set, a unique Session Display Name is assigned." +
"\n\nAdministrators of this domain can also see the Username or Machine ID associated with each avatar present.")
"\n\nAdministrators of this domain can also see the Username or Machine ID associated with each avatar present.", "", "")
onEntered: helpText.color = hifi.colors.baseGrayHighlight
onExited: helpText.color = hifi.colors.darkGray
}
@ -402,7 +404,7 @@ Rectangle {
acceptedButtons: Qt.LeftButton
hoverEnabled: true
onClicked: letterbox('Silencing a user mutes their microphone. Silenced users can unmute themselves by clicking the "UNMUTE" button on their HUD.\n\n' +
"Banning a user will remove them from this domain and prevent them from returning. You can un-ban users from your domain's settings page.)")
"Banning a user will remove them from this domain and prevent them from returning. You can un-ban users from your domain's settings page.)", "", "")
onEntered: adminHelpText.color = "#94132e"
onExited: adminHelpText.color = hifi.colors.redHighlight
}
@ -447,9 +449,9 @@ Rectangle {
var selected = message.params[1];
var userIndex = findSessionIndex(sessionIds[0]);
if (sessionIds.length > 1) {
letterbox('Only one user can be selected at a time.');
letterbox('Only one user can be selected at a time.', "", "");
} else if (userIndex < 0) {
letterbox('The last editor is not among this list of users.');
letterbox('The last editor is not among this list of users.', "", "");
} else {
if (selected) {
table.selection.clear(); // for now, no multi-select
@ -499,7 +501,7 @@ Rectangle {
userModel.setProperty(userIndex, "audioLevel", audioLevel);
userModelData[userIndex].audioLevel = audioLevel; // Defensive programming
} else {
console.log("updateUsername() called with unknown UUID: ", userId);
console.log("updateAudioLevel() called with unknown UUID: ", userId);
}
}
}