mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
work around .qml settings issues
This commit is contained in:
parent
a20590a2f9
commit
023a32563c
2 changed files with 17 additions and 7 deletions
|
@ -13,6 +13,7 @@
|
|||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import Qt.labs.settings 1.0
|
||||
import "../styles-uit"
|
||||
import "../controls-uit" as HifiControls
|
||||
|
||||
|
@ -54,8 +55,15 @@ Rectangle {
|
|||
letterboxMessage.visible = true
|
||||
letterboxMessage.popupRadius = 0
|
||||
}
|
||||
Settings {
|
||||
id: settings
|
||||
category: "pal"
|
||||
property bool filtered: false
|
||||
property int nearDistance: 30
|
||||
}
|
||||
function refreshWithFilter() {
|
||||
pal.sendToScript({method: 'refresh', params: {filter: filter.checked && {distance: 30}}})
|
||||
// We should just be able to set settings.filtered to filter.checked, but see #3249, so send to .js for saving.
|
||||
pal.sendToScript({method: 'refresh', params: {filter: filter.checked && {distance: settings.nearDistance}}});
|
||||
}
|
||||
|
||||
// This is the container for the PAL
|
||||
|
@ -101,6 +109,7 @@ Rectangle {
|
|||
Row {
|
||||
HifiControls.CheckBox {
|
||||
id: filter
|
||||
checked: settings.filtered
|
||||
text: "in view"
|
||||
boxSize: reload.height
|
||||
onCheckedChanged: refreshWithFilter()
|
||||
|
|
|
@ -238,7 +238,11 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
break;
|
||||
case 'refresh':
|
||||
removeOverlays();
|
||||
populateUserList(message.params.selected, message.params.filter);
|
||||
// If filter is specified from .qml instead of through settings, update the settings.
|
||||
if (message.params.filter !== undefined) {
|
||||
Settings.setValue('pal/filtered', !!message.params.filter);
|
||||
}
|
||||
populateUserList(message.params.selected);
|
||||
UserActivityLogger.palAction("refresh", "");
|
||||
break;
|
||||
case 'updateGain':
|
||||
|
@ -280,13 +284,10 @@ function addAvatarNode(id) {
|
|||
color: color(selected, false, 0.0),
|
||||
ignoreRayIntersection: false}, selected, !conserveResources);
|
||||
}
|
||||
var filter = false;
|
||||
// Each open/refresh will capture a stable set of avatarsOfInterest, within the specified filter.
|
||||
var avatarsOfInterest = {};
|
||||
function populateUserList(selectData, filterRequest) {
|
||||
if (filterRequest !== undefined) {
|
||||
filter = filterRequest;
|
||||
}
|
||||
function populateUserList(selectData) {
|
||||
var filter = Settings.getValue('pal/filtered') && {distance: Settings.getValue('pal/nearDistance')};
|
||||
var data = [], avatars = AvatarList.getAvatarIdentifiers();
|
||||
avatarsOfInterest = {};
|
||||
var myPosition = filter && Camera.position,
|
||||
|
|
Loading…
Reference in a new issue