Checkpoint before implementing Ken's suggestions

This commit is contained in:
Zach Fox 2017-01-11 11:56:35 -08:00
parent 8c3766dfe8
commit b9cddc31a9
3 changed files with 11 additions and 8 deletions

View file

@ -155,7 +155,7 @@ Row {
visible: !isMyCard visible: !isMyCard
width: parent.width width: parent.width
height: 18 height: 18
value: 1.0 value: pal.gain[uuid] ? pal.gain[uuid] : 1.0
minimumValue: 0.0 minimumValue: 0.0
maximumValue: 1.5 maximumValue: 1.5
stepSize: 0.1 stepSize: 0.1
@ -179,6 +179,7 @@ Row {
} }
function updateGainFromQML(avatarUuid, gainValue) { function updateGainFromQML(avatarUuid, gainValue) {
pal.gain[avatarUuid] = gainValue;
var data = { var data = {
sessionId: avatarUuid, sessionId: avatarUuid,
gain: (Math.pow(20, gainValue) - 1) / (20 - 1) gain: (Math.pow(20, gainValue) - 1) / (20 - 1)

View file

@ -32,6 +32,7 @@ Rectangle {
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
property var gain: ({}); // Keep a local list of per-avatar gain. Far faster than keeping this data on the server.
// This is the container for the PAL // This is the container for the PAL
Rectangle { Rectangle {
@ -494,8 +495,9 @@ Rectangle {
} }
} }
break; break;
case 'clearIgnored': case 'clearLocalQMLData':
ignored = {}; ignored = {};
gain = {};
break; break;
default: default:
console.log('Unrecognized message:', JSON.stringify(message)); console.log('Unrecognized message:', JSON.stringify(message));

View file

@ -586,14 +586,14 @@ button.clicked.connect(onClicked);
pal.visibleChanged.connect(onVisibleChanged); pal.visibleChanged.connect(onVisibleChanged);
pal.closed.connect(off); pal.closed.connect(off);
Users.usernameFromIDReply.connect(usernameFromIDReply); Users.usernameFromIDReply.connect(usernameFromIDReply);
function clearIgnoredInQMLAndClosePAL() { function clearLocalQMLDataAndClosePAL() {
pal.sendToQml({ method: 'clearIgnored' }); pal.sendToQml({ method: 'clearLocalQMLData' });
if (pal.visible) { if (pal.visible) {
onClicked(); // Close the PAL onClicked(); // Close the PAL
} }
} }
Window.domainChanged.connect(clearIgnoredInQMLAndClosePAL); Window.domainChanged.connect(clearLocalQMLDataAndClosePAL);
Window.domainConnectionRefused.connect(clearIgnoredInQMLAndClosePAL); Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL);
// //
// Cleanup. // Cleanup.
@ -604,8 +604,8 @@ Script.scriptEnding.connect(function () {
pal.visibleChanged.disconnect(onVisibleChanged); pal.visibleChanged.disconnect(onVisibleChanged);
pal.closed.disconnect(off); pal.closed.disconnect(off);
Users.usernameFromIDReply.disconnect(usernameFromIDReply); Users.usernameFromIDReply.disconnect(usernameFromIDReply);
Window.domainChanged.disconnect(clearIgnoredInQMLAndClosePAL); Window.domainChanged.disconnect(clearLocalQMLDataAndClosePAL);
Window.domainConnectionRefused.disconnect(clearIgnoredInQMLAndClosePAL); Window.domainConnectionRefused.disconnect(clearLocalQMLDataAndClosePAL);
Messages.unsubscribe(CHANNEL); Messages.unsubscribe(CHANNEL);
Messages.messageReceived.disconnect(receiveMessage); Messages.messageReceived.disconnect(receiveMessage);
off(); off();