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
width: parent.width
height: 18
value: 1.0
value: pal.gain[uuid] ? pal.gain[uuid] : 1.0
minimumValue: 0.0
maximumValue: 1.5
stepSize: 0.1
@ -179,6 +179,7 @@ Row {
}
function updateGainFromQML(avatarUuid, gainValue) {
pal.gain[avatarUuid] = gainValue;
var data = {
sessionId: avatarUuid,
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 userModelData: [] // This simple list is essentially a mirror of the userModel listModel without all the extra complexities.
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
Rectangle {
@ -494,8 +495,9 @@ Rectangle {
}
}
break;
case 'clearIgnored':
case 'clearLocalQMLData':
ignored = {};
gain = {};
break;
default:
console.log('Unrecognized message:', JSON.stringify(message));

View file

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