mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 18:31:32 +02:00
make domain settings maps keyed case insensitively
This commit is contained in:
parent
87cac67c75
commit
b0aa1b2af2
2 changed files with 29 additions and 17 deletions
|
@ -364,7 +364,7 @@ function validateInputs() {
|
||||||
if (keyVal.length === 0) {
|
if (keyVal.length === 0) {
|
||||||
empty = true
|
empty = true
|
||||||
|
|
||||||
markParentRowInvalid(input);
|
markParentRowInvalid(input)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,11 +373,13 @@ function validateInputs() {
|
||||||
_.each(otherKeys, function(otherKeyCell) {
|
_.each(otherKeys, function(otherKeyCell) {
|
||||||
var keyInput = $(otherKeyCell).children('input');
|
var keyInput = $(otherKeyCell).children('input');
|
||||||
|
|
||||||
|
var lowerNewValue = keyVal.toLowerCase();
|
||||||
|
|
||||||
if (keyInput.length) {
|
if (keyInput.length) {
|
||||||
if ($(keyInput).val() == keyVal) {
|
if ($(keyInput).val().toLowerCase() == lowerNewValue) {
|
||||||
duplicateKey = true;
|
duplicateKey = true;
|
||||||
}
|
}
|
||||||
} else if ($(otherKeyCell).html() == keyVal) {
|
} else if ($(otherKeyCell).html().toLowerCase() == lowerNewValue) {
|
||||||
duplicateKey = true;
|
duplicateKey = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3172,24 +3172,34 @@ void DomainServer::processPathQueryPacket(QSharedPointer<ReceivedMessage> messag
|
||||||
const QString PATH_VIEWPOINT_KEY = "viewpoint";
|
const QString PATH_VIEWPOINT_KEY = "viewpoint";
|
||||||
const QString INDEX_PATH = "/";
|
const QString INDEX_PATH = "/";
|
||||||
|
|
||||||
// check out paths in the _configMap to see if we have a match
|
QString responseViewpoint;
|
||||||
auto keypath = QString(PATHS_SETTINGS_KEYPATH_FORMAT).arg(SETTINGS_PATHS_KEY).arg(pathQuery);
|
|
||||||
QVariant pathMatch = _settingsManager.valueForKeyPath(keypath);
|
|
||||||
|
|
||||||
if (pathMatch.isValid() || pathQuery == INDEX_PATH) {
|
// check out paths in the _configMap to see if we have a match
|
||||||
|
auto pathsVariant = _settingsManager.valueForKeyPath(SETTINGS_PATHS_KEY);
|
||||||
|
|
||||||
|
auto lowerPathQuery = pathQuery.toLower();
|
||||||
|
|
||||||
|
if (pathsVariant.canConvert<QVariantMap>()) {
|
||||||
|
auto pathsMap = pathsVariant.toMap();
|
||||||
|
|
||||||
|
// enumerate the paths and look case-insensitively for a matching one
|
||||||
|
for (auto it = pathsMap.constKeyValueBegin(); it != pathsMap.constKeyValueEnd(); ++it) {
|
||||||
|
if ((*it).first.toLower() == lowerPathQuery) {
|
||||||
|
responseViewpoint = (*it).second.toMap()[PATH_VIEWPOINT_KEY].toString().toLower();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (responseViewpoint.isEmpty() && pathQuery == INDEX_PATH) {
|
||||||
|
const QString DEFAULT_INDEX_PATH = "/0,0,0/0,0,0,1";
|
||||||
|
responseViewpoint = DEFAULT_INDEX_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!responseViewpoint.isEmpty()) {
|
||||||
// we got a match, respond with the resulting viewpoint
|
// we got a match, respond with the resulting viewpoint
|
||||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
|
|
||||||
QString responseViewpoint;
|
|
||||||
|
|
||||||
// if we didn't match the path BUT this is for the index path then send back our default
|
|
||||||
if (pathMatch.isValid()) {
|
|
||||||
responseViewpoint = pathMatch.toMap()[PATH_VIEWPOINT_KEY].toString();
|
|
||||||
} else {
|
|
||||||
const QString DEFAULT_INDEX_PATH = "/0,0,0/0,0,0,1";
|
|
||||||
responseViewpoint = DEFAULT_INDEX_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!responseViewpoint.isEmpty()) {
|
if (!responseViewpoint.isEmpty()) {
|
||||||
QByteArray viewpointUTF8 = responseViewpoint.toUtf8();
|
QByteArray viewpointUTF8 = responseViewpoint.toUtf8();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue