PAL open, user leaves, gray out row

This commit is contained in:
Zach Fox 2017-03-20 17:20:03 -07:00
parent d16acc5a7f
commit 29e97381eb
3 changed files with 32 additions and 17 deletions

View file

@ -41,6 +41,7 @@ Item {
property bool isMyCard: false property bool isMyCard: false
property bool selected: false property bool selected: false
property bool isAdmin: false property bool isAdmin: false
property bool isPresent: true
property string imageMaskColor: pal.color; property string imageMaskColor: pal.color;
property string profilePicBorderColor: (connectionStatus == "connection" ? hifi.colors.indigoAccent : (connectionStatus == "friend" ? hifi.colors.greenHighlight : imageMaskColor)) property string profilePicBorderColor: (connectionStatus == "connection" ? hifi.colors.indigoAccent : (connectionStatus == "friend" ? hifi.colors.greenHighlight : imageMaskColor))
@ -236,7 +237,7 @@ Item {
color: hifi.colors.darkGray; color: hifi.colors.darkGray;
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== ""; enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== "" && isPresent;
hoverEnabled: enabled hoverEnabled: enabled
onClicked: { onClicked: {
goToUserInDomain(thisNameCard.uuid); goToUserInDomain(thisNameCard.uuid);
@ -296,7 +297,8 @@ Item {
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true enabled: isPresent
hoverEnabled: enabled
onClicked: letterbox(hifi.glyphs.question, onClicked: letterbox(hifi.glyphs.question,
"Domain Admin", "Domain Admin",
"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!") "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!")
@ -329,7 +331,7 @@ Item {
color: hifi.colors.greenShadow; color: hifi.colors.greenShadow;
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== ""; enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== "" && isPresent;
hoverEnabled: enabled hoverEnabled: enabled
onClicked: { onClicked: {
goToUserInDomain(thisNameCard.uuid); goToUserInDomain(thisNameCard.uuid);
@ -358,7 +360,7 @@ Item {
// Style // Style
radius: 4 radius: 4
color: "#c5c5c5" color: "#c5c5c5"
visible: isMyCard || (selected && pal.activeTab == "nearbyTab") visible: (isMyCard || (selected && pal.activeTab == "nearbyTab")) && isPresent
// Rectangle for the zero-gain point on the VU meter // Rectangle for the zero-gain point on the VU meter
Rectangle { Rectangle {
id: vuMeterZeroGain id: vuMeterZeroGain
@ -433,7 +435,7 @@ Item {
anchors.verticalCenter: nameCardVUMeter.verticalCenter; anchors.verticalCenter: nameCardVUMeter.verticalCenter;
anchors.left: nameCardVUMeter.left; anchors.left: nameCardVUMeter.left;
// Properties // Properties
visible: !isMyCard && selected && pal.activeTab == "nearbyTab"; visible: !isMyCard && selected && pal.activeTab == "nearbyTab" && isPresent;
value: Users.getAvatarGain(uuid) value: Users.getAvatarGain(uuid)
minimumValue: -60.0 minimumValue: -60.0
maximumValue: 20.0 maximumValue: 20.0

View file

@ -36,7 +36,7 @@ Rectangle {
property int locationColumnWidth: 170; property int locationColumnWidth: 170;
property int nearbyNameCardWidth: nearbyTable.width - (iAmAdmin ? (actionButtonWidth * 4) : (actionButtonWidth * 2)) - 4 - hifi.dimensions.scrollbarBackgroundWidth; property int nearbyNameCardWidth: nearbyTable.width - (iAmAdmin ? (actionButtonWidth * 4) : (actionButtonWidth * 2)) - 4 - hifi.dimensions.scrollbarBackgroundWidth;
property int connectionsNameCardWidth: connectionsTable.width - locationColumnWidth - actionButtonWidth - 4 - hifi.dimensions.scrollbarBackgroundWidth; property int connectionsNameCardWidth: connectionsTable.width - locationColumnWidth - actionButtonWidth - 4 - hifi.dimensions.scrollbarBackgroundWidth;
property var myData: ({profileUrl: "", displayName: "", userName: "", audioLevel: 0.0, avgAudioLevel: 0.0, admin: true, placeName: "", connection: ""}); // valid dummy until set property var myData: ({profileUrl: "", displayName: "", userName: "", audioLevel: 0.0, avgAudioLevel: 0.0, admin: true, placeName: "", connection: "", isPresent: 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 nearbyUserModelData: []; // This simple list is essentially a mirror of the nearbyUserModel listModel without all the extra complexities. property var nearbyUserModelData: []; // This simple list is essentially a mirror of the nearbyUserModel listModel without all the extra complexities.
property var connectionsUserModelData: []; // This simple list is essentially a mirror of the connectionsUserModel listModel without all the extra complexities. property var connectionsUserModelData: []; // This simple list is essentially a mirror of the connectionsUserModel listModel without all the extra complexities.
@ -132,6 +132,7 @@ Rectangle {
audioLevel: myData.audioLevel; audioLevel: myData.audioLevel;
avgAudioLevel: myData.avgAudioLevel; avgAudioLevel: myData.avgAudioLevel;
isMyCard: true; isMyCard: true;
isPresent: true;
// Size // Size
width: myCardWidth; width: myCardWidth;
height: parent.height; height: parent.height;
@ -576,8 +577,9 @@ Rectangle {
// This Rectangle refers to each Row in the nearbyTable. // This Rectangle refers to each Row in the nearbyTable.
rowDelegate: Rectangle { // The only way I know to specify a row height. rowDelegate: Rectangle { // The only way I know to specify a row height.
// Size // Size
height: styleData.selected ? rowHeight + 15 : rowHeight; height: rowHeight + (styleData.selected && model.isPresent ? 15 : 0);
color: rowColor(styleData.selected, styleData.alternate); color: rowColor(styleData.selected, styleData.alternate, model ? model.isPresent : true);
opacity: model.isPresent ? 1.0 : 0.6;
} }
// This Item refers to the contents of each Cell // This Item refers to the contents of each Cell
@ -586,6 +588,7 @@ Rectangle {
property bool isCheckBox: styleData.role === "personalMute" || styleData.role === "ignore"; property bool isCheckBox: styleData.role === "personalMute" || styleData.role === "ignore";
property bool isButton: styleData.role === "mute" || styleData.role === "kick"; property bool isButton: styleData.role === "mute" || styleData.role === "kick";
property bool isAvgAudio: styleData.role === "avgAudioLevel"; property bool isAvgAudio: styleData.role === "avgAudioLevel";
opacity: model.isPresent ? 1.0 : 0.6;
// This NameCard refers to the cell that contains an avatar's // This NameCard refers to the cell that contains an avatar's
// DisplayName and UserName // DisplayName and UserName
@ -593,7 +596,7 @@ Rectangle {
id: nameCard; id: nameCard;
// Properties // Properties
profileUrl: (model && model.profileUrl) || ""; profileUrl: (model && model.profileUrl) || "";
imageMaskColor: rowColor(styleData.selected, styleData.row % 2); imageMaskColor: rowColor(styleData.selected, styleData.row % 2, model.isPresent);
displayName: styleData.value; displayName: styleData.value;
userName: model ? model.userName : ""; userName: model ? model.userName : "";
connectionStatus: model ? model.connection : ""; connectionStatus: model ? model.connection : "";
@ -603,6 +606,7 @@ Rectangle {
uuid: model ? model.sessionId : ""; uuid: model ? model.sessionId : "";
selected: styleData.selected; selected: styleData.selected;
isAdmin: model && model.admin; isAdmin: model && model.admin;
isPresent: model && model.isPresent;
// Size // Size
width: nearbyNameCardWidth; width: nearbyNameCardWidth;
height: parent.height; height: parent.height;
@ -899,7 +903,7 @@ Rectangle {
rowDelegate: Rectangle { rowDelegate: Rectangle {
// Size // Size
height: rowHeight; height: rowHeight;
color: rowColor(styleData.selected, styleData.alternate); color: rowColor(styleData.selected, styleData.alternate, model ? model.isPresent : true);
} }
// This Item refers to the contents of each Cell // This Item refers to the contents of each Cell
@ -912,7 +916,7 @@ Rectangle {
// Properties // Properties
visible: styleData.role === "userName"; visible: styleData.role === "userName";
profileUrl: (model && model.profileUrl) || ""; profileUrl: (model && model.profileUrl) || "";
imageMaskColor: rowColor(styleData.selected, styleData.row % 2); imageMaskColor: rowColor(styleData.selected, styleData.row % 2, model.isPresent);
displayName: ""; displayName: "";
userName: model ? model.userName : ""; userName: model ? model.userName : "";
connectionStatus : model ? model.connection : ""; connectionStatus : model ? model.connection : "";
@ -1155,8 +1159,8 @@ Rectangle {
} }
} }
function rowColor(selected, alternate) { function rowColor(selected, alternate, isPresent) {
return selected ? hifi.colors.orangeHighlight : alternate ? hifi.colors.tableRowLightEven : hifi.colors.tableRowLightOdd; return isPresent ? (selected ? hifi.colors.orangeHighlight : alternate ? hifi.colors.tableRowLightEven : hifi.colors.tableRowLightOdd) : hifi.colors.gray;
} }
function findNearbySessionIndex(sessionId, optionalData) { // no findIndex in .qml function findNearbySessionIndex(sessionId, optionalData) { // no findIndex in .qml
var data = optionalData || nearbyUserModelData, length = data.length; var data = optionalData || nearbyUserModelData, length = data.length;
@ -1211,7 +1215,7 @@ Rectangle {
} else if (userIndex < 0) { } else if (userIndex < 0) {
// If we've already refreshed the PAL and the avatar still isn't present in the model... // If we've already refreshed the PAL and the avatar still isn't present in the model...
if (alreadyRefreshed === true) { if (alreadyRefreshed === true) {
letterbox('', '', 'The last editor of this object is either you or not among this list of users.'); letterbox('', '', 'The user you attempted to select is no longer available.');
} else { } else {
pal.sendToScript({method: 'refresh', params: {selected: message.params}}); pal.sendToScript({method: 'refresh', params: {selected: message.params}});
} }
@ -1283,6 +1287,14 @@ Rectangle {
delete ignored[sessionID]; delete ignored[sessionID];
break; break;
case 'palIsStale': case 'palIsStale':
if (message.params) {
var sessionID = message.params[0];
var userIndex = findNearbySessionIndex(sessionID);
if (userIndex != -1) {
nearbyUserModel.setProperty(userIndex, "isPresent", false);
nearbyUserModelData[userIndex].isPresent = false;
}
}
reloadNearby.glyph = hifi.glyphs.alert; reloadNearby.glyph = hifi.glyphs.alert;
reloadNearby.color = 2; reloadNearby.color = 2;
break; break;

View file

@ -479,7 +479,8 @@ function populateNearbyUserList(selectData, oldAudioData) {
avgAudioLevel: (oldAudio && oldAudio.avgAudioLevel) || 0.0, avgAudioLevel: (oldAudio && oldAudio.avgAudioLevel) || 0.0,
admin: false, admin: false,
personalMute: !!id && Users.getPersonalMuteStatus(id), // expects proper boolean, not null personalMute: !!id && Users.getPersonalMuteStatus(id), // expects proper boolean, not null
ignore: !!id && Users.getIgnoreStatus(id) // ditto ignore: !!id && Users.getIgnoreStatus(id), // ditto
isPresent: true
}; };
if (id) { if (id) {
addAvatarNode(id); // No overlay for ourselves addAvatarNode(id); // No overlay for ourselves
@ -852,8 +853,8 @@ function avatarAdded() {
sendToQml({ method: 'palIsStale' }); sendToQml({ method: 'palIsStale' });
} }
function avatarRemoved() { function avatarRemoved(avatarID) {
sendToQml({ method: 'palIsStale' }); sendToQml({ method: 'palIsStale', params: [avatarID] });
} }
function avatarSessionChanged() { function avatarSessionChanged() {