Bugs fixed!

This commit is contained in:
Zach Fox 2016-12-30 15:12:17 -08:00
parent ea40582afb
commit 951db2e2da

View file

@ -194,8 +194,8 @@ Item {
id: nameCard id: nameCard
// Properties // Properties
displayName: styleData.value displayName: styleData.value
userName: model && model.userName userName: model ? model.userName : ""
audioLevel: model && model.audioLevel audioLevel: model ? model.audioLevel : 0.0
visible: !isCheckBox visible: !isCheckBox
// Size // Size
width: nameCardWidth width: nameCardWidth
@ -205,11 +205,19 @@ Item {
} }
// This CheckBox belongs in the columns that contain the action buttons ("Mute", "Ban", etc) // This CheckBox belongs in the columns that contain the action buttons ("Mute", "Ban", etc)
// KNOWN BUG with the Checkboxes: When clicking in the center of the sorting header, the checkbox
// will appear in the "hovered" state. Hovering over the checkbox will fix it.
// Clicking on the sides of the sorting header doesn't cause this problem.
// I'm guessing this is a QT bug and not anything I can fix. I spent too long trying to work around it...
// I'm just going to leave the minor visual bug in.
HifiControls.CheckBox { HifiControls.CheckBox {
id: actionCheckBox
visible: isCheckBox visible: isCheckBox
anchors.centerIn: parent anchors.centerIn: parent
checked: model[styleData.role] checked: model ? model[styleData.role] : false
enabled: styleData.role === "personalMute" ? (model["ignore"] === true ? false : true) : true // If this is a "personal mute" checkbox, and the model is valid, Check the checkbox if the Ignore
// checkbox is checked.
enabled: styleData.role === "personalMute" ? ((model ? model["ignore"] : false) === true ? false : true) : true
boxSize: 24 boxSize: 24
onClicked: { onClicked: {
var newValue = !model[styleData.role] var newValue = !model[styleData.role]
@ -225,13 +233,13 @@ Item {
} else { } else {
Users[styleData.role](model.sessionId) Users[styleData.role](model.sessionId)
// Just for now, while we cannot undo things: // Just for now, while we cannot undo things:
userModel.remove(model.userIndex, 1) userModel.remove(model.userIndex)
sortModel() sortModel()
} }
// http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html#creating-property-bindings-from-javascript // http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html#creating-property-bindings-from-javascript
// I'm using an explicit binding here because clicking a checkbox breaks the implicit binding as set by // I'm using an explicit binding here because clicking a checkbox breaks the implicit binding as set by
// "checked: model[stayleData.role]" above. // "checked: model[styleData.role]" above.
checked = Qt.binding(function() { return model[styleData.role] }) checked = Qt.binding(function() { return (model && model[styleData.role]) ? model[styleData.role] : false})
} }
} }
} }
@ -327,18 +335,22 @@ Item {
radius: hifi.dimensions.borderRadius radius: hifi.dimensions.borderRadius
} }
Rectangle { Rectangle {
width: Math.min(parent.width * 0.75, 400) width: Math.max(parent.width * 0.75, 400)
height: popupText.contentHeight*2 height: popupText.contentHeight*1.5
anchors.centerIn: parent anchors.centerIn: parent
radius: hifi.dimensions.borderRadius radius: hifi.dimensions.borderRadius
color: "white" color: "white"
FiraSansSemiBold { FiraSansSemiBold {
id: popupText id: popupText
text: "This is temporary text. It will eventually be used to explain what 'Names' means." text: "Bold names in the list are Avatar Display Names.\n" +
"If a Display Name isn't set, a unique Session Display Name is assigned to them." +
"\n\nAdministrators of this domain can also see the Username or Machine ID associated with each present avatar."
size: hifi.fontSizes.textFieldInput size: hifi.fontSizes.textFieldInput
color: hifi.colors.darkGray color: hifi.colors.darkGray
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 15
anchors.rightMargin: 15
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
} }
@ -395,11 +407,13 @@ Item {
var sessionId = message.params[0]; var sessionId = message.params[0];
var selected = message.params[1]; var selected = message.params[1];
var userIndex = findSessionIndexInUserModel(sessionId); var userIndex = findSessionIndexInUserModel(sessionId);
if (selected) { if (userIndex != -1) {
table.selection.clear(); // for now, no multi-select if (selected) {
table.selection.select(userIndex); table.selection.clear(); // for now, no multi-select
} else { table.selection.select(userIndex);
table.selection.deselect(userIndex); } else {
table.selection.deselect(userIndex);
}
} }
break; break;
// Received an "updateUsername()" request from the JS // Received an "updateUsername()" request from the JS
@ -415,8 +429,10 @@ Item {
} else { } else {
// Get the index in userModel associated with the passed UUID // Get the index in userModel associated with the passed UUID
var userIndex = findSessionIndexInUserModel(userId); var userIndex = findSessionIndexInUserModel(userId);
// Set the userName appropriately if (userIndex != -1) {
userModel.setProperty(userIndex, "userName", userName); // Set the userName appropriately
userModel.setProperty(userIndex, "userName", userName);
}
} }
break; break;
case 'updateAudioLevel': case 'updateAudioLevel':
@ -428,7 +444,9 @@ Item {
myCard.audioLevel = audioLevel; // Defensive programming myCard.audioLevel = audioLevel; // Defensive programming
} else { } else {
var userIndex = findSessionIndexInUserModel(userId); var userIndex = findSessionIndexInUserModel(userId);
userModel.setProperty(userIndex, "audioLevel", audioLevel); if (userIndex != -1) {
userModel.setProperty(userIndex, "audioLevel", audioLevel);
}
} }
} }
break; break;