mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:17:25 +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 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
import "../controls-uit" as HifiControls
|
import "../controls-uit" as HifiControls
|
||||||
|
|
||||||
|
@ -54,8 +55,15 @@ Rectangle {
|
||||||
letterboxMessage.visible = true
|
letterboxMessage.visible = true
|
||||||
letterboxMessage.popupRadius = 0
|
letterboxMessage.popupRadius = 0
|
||||||
}
|
}
|
||||||
|
Settings {
|
||||||
|
id: settings
|
||||||
|
category: "pal"
|
||||||
|
property bool filtered: false
|
||||||
|
property int nearDistance: 30
|
||||||
|
}
|
||||||
function refreshWithFilter() {
|
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
|
// This is the container for the PAL
|
||||||
|
@ -101,6 +109,7 @@ Rectangle {
|
||||||
Row {
|
Row {
|
||||||
HifiControls.CheckBox {
|
HifiControls.CheckBox {
|
||||||
id: filter
|
id: filter
|
||||||
|
checked: settings.filtered
|
||||||
text: "in view"
|
text: "in view"
|
||||||
boxSize: reload.height
|
boxSize: reload.height
|
||||||
onCheckedChanged: refreshWithFilter()
|
onCheckedChanged: refreshWithFilter()
|
||||||
|
|
|
@ -238,7 +238,11 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
||||||
break;
|
break;
|
||||||
case 'refresh':
|
case 'refresh':
|
||||||
removeOverlays();
|
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", "");
|
UserActivityLogger.palAction("refresh", "");
|
||||||
break;
|
break;
|
||||||
case 'updateGain':
|
case 'updateGain':
|
||||||
|
@ -280,13 +284,10 @@ function addAvatarNode(id) {
|
||||||
color: color(selected, false, 0.0),
|
color: color(selected, false, 0.0),
|
||||||
ignoreRayIntersection: false}, selected, !conserveResources);
|
ignoreRayIntersection: false}, selected, !conserveResources);
|
||||||
}
|
}
|
||||||
var filter = false;
|
|
||||||
// Each open/refresh will capture a stable set of avatarsOfInterest, within the specified filter.
|
// Each open/refresh will capture a stable set of avatarsOfInterest, within the specified filter.
|
||||||
var avatarsOfInterest = {};
|
var avatarsOfInterest = {};
|
||||||
function populateUserList(selectData, filterRequest) {
|
function populateUserList(selectData) {
|
||||||
if (filterRequest !== undefined) {
|
var filter = Settings.getValue('pal/filtered') && {distance: Settings.getValue('pal/nearDistance')};
|
||||||
filter = filterRequest;
|
|
||||||
}
|
|
||||||
var data = [], avatars = AvatarList.getAvatarIdentifiers();
|
var data = [], avatars = AvatarList.getAvatarIdentifiers();
|
||||||
avatarsOfInterest = {};
|
avatarsOfInterest = {};
|
||||||
var myPosition = filter && Camera.position,
|
var myPosition = filter && Camera.position,
|
||||||
|
|
Loading…
Reference in a new issue