From d16acc5a7fe1fbe649cc468b7e9f340acf8c68f0 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 20 Mar 2017 15:19:28 -0700 Subject: [PATCH] Stale PAL Notification --- interface/resources/qml/hifi/Pal.qml | 10 +++++++++- scripts/system/pal.js | 24 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 8dfab8c62d..f941ff12b3 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -279,7 +279,9 @@ Rectangle { id: reloadNearby; width: reloadNearby.height; glyph: hifi.glyphs.reload; - onClicked: refreshNearbyWithFilter(); + onClicked: { + refreshNearbyWithFilter(); + } } } } @@ -1188,6 +1190,8 @@ Rectangle { } } sortModel(); + reloadNearby.glyph = hifi.glyphs.reload; + reloadNearby.color = 0; break; case 'connections': var data = message.params; @@ -1278,6 +1282,10 @@ Rectangle { var sessionID = message.params[0]; delete ignored[sessionID]; break; + case 'palIsStale': + reloadNearby.glyph = hifi.glyphs.alert; + reloadNearby.color = 2; + break; default: console.log('Unrecognized message:', JSON.stringify(message)); } diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 014d89dde7..f0067e6843 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -14,7 +14,11 @@ (function() { // BEGIN LOCAL_SCOPE -var populateNearbyUserList, color, textures, removeOverlays, controllerComputePickRay, onTabletButtonClicked, onTabletScreenChanged, receiveMessage, avatarDisconnected, clearLocalQMLDataAndClosePAL, createAudioInterval, tablet, CHANNEL, getConnectionData, findableByChanged; // forward references; +var populateNearbyUserList, color, textures, removeOverlays, + controllerComputePickRay, onTabletButtonClicked, onTabletScreenChanged, + receiveMessage, avatarDisconnected, clearLocalQMLDataAndClosePAL, + createAudioInterval, tablet, CHANNEL, getConnectionData, findableByChanged, + avatarAdded, avatarRemoved, avatarSessionChanged; // forward references; // hardcoding these as it appears we cannot traverse the originalTextures in overlays??? Maybe I've missed // something, will revisit as this is sorta horrible. @@ -691,6 +695,9 @@ function startup() { Messages.subscribe(CHANNEL); Messages.messageReceived.connect(receiveMessage); Users.avatarDisconnected.connect(avatarDisconnected); + AvatarList.avatarAddedEvent.connect(avatarAdded); + AvatarList.avatarRemovedEvent.connect(avatarRemoved); + AvatarList.avatarSessionChangedEvent.connect(avatarSessionChanged); } startup(); @@ -841,6 +848,18 @@ function clearLocalQMLDataAndClosePAL() { sendToQml({ method: 'clearLocalQMLData' }); } +function avatarAdded() { + sendToQml({ method: 'palIsStale' }); +} + +function avatarRemoved() { + sendToQml({ method: 'palIsStale' }); +} + +function avatarSessionChanged() { + sendToQml({ method: 'palIsStale' }); +} + function shutdown() { if (onPalScreen) { tablet.gotoHomeScreen(); @@ -854,6 +873,9 @@ function shutdown() { Messages.subscribe(CHANNEL); Messages.messageReceived.disconnect(receiveMessage); Users.avatarDisconnected.disconnect(avatarDisconnected); + AvatarList.avatarAddedEvent.disconnect(avatarAdded); + AvatarList.avatarRemovedEvent.disconnect(avatarRemoved); + AvatarList.avatarSessionChangedEvent.disconnect(avatarSessionChanged); off(); }