Merge pull request #6899 from birarda/fix-go-home

repairs to index path behaviour
This commit is contained in:
Brad Hefta-Gaub 2016-01-21 21:29:24 -08:00
commit 58b7708315
5 changed files with 25 additions and 9 deletions

View file

@ -65,7 +65,7 @@
{
"name": "viewpoint",
"label": "Viewpoint",
"placeholder": "/512,512,512"
"placeholder": "/0,0,0"
}
]
}

View file

@ -1868,16 +1868,25 @@ void DomainServer::processPathQueryPacket(QSharedPointer<ReceivedMessage> messag
const QString PATHS_SETTINGS_KEYPATH_FORMAT = "%1.%2";
const QString PATH_VIEWPOINT_KEY = "viewpoint";
const QString INDEX_PATH = "/";
// check out paths in the _configMap to see if we have a match
const QVariant* pathMatch = valueForKeyPath(_settingsManager.getSettingsMap(),
QString(PATHS_SETTINGS_KEYPATH_FORMAT).arg(SETTINGS_PATHS_KEY)
.arg(pathQuery));
if (pathMatch) {
auto keypath = QString(PATHS_SETTINGS_KEYPATH_FORMAT).arg(SETTINGS_PATHS_KEY).arg(pathQuery);
const QVariant* pathMatch = valueForKeyPath(_settingsManager.getSettingsMap(), keypath);
if (pathMatch || pathQuery == INDEX_PATH) {
// we got a match, respond with the resulting viewpoint
auto nodeList = DependencyManager::get<LimitedNodeList>();
QString responseViewpoint = pathMatch->toMap()[PATH_VIEWPOINT_KEY].toString();
QString responseViewpoint;
// if we didn't match the path BUT this is for the index path then send back our default
if (pathMatch) {
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()) {
QByteArray viewpointUTF8 = responseViewpoint.toUtf8();

View file

@ -149,8 +149,15 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
// check if it is a network address first
if (handleNetworkAddress(lookupUrl.host()
+ (lookupUrl.port() == -1 ? "" : ":" + QString::number(lookupUrl.port())), trigger)) {
// if we were not passed a path, use the index path
auto path = lookupUrl.path();
if (path.isEmpty()) {
path = INDEX_PATH;
}
// we may have a path that defines a relative viewpoint - if so we should jump to that now
handlePath(lookupUrl.path(), trigger);
handlePath(path, trigger);
} else if (handleDomainID(lookupUrl.host())){
// no place name - this is probably a domain ID
// try to look up the domain ID on the metaverse API

View file

@ -60,7 +60,7 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
// in case we don't know how to talk to DS when a path change is requested
// fire off any pending DS path query when we get socket information
connect(&_domainHandler, &DomainHandler::completedSocketDiscovery, this, &NodeList::sendPendingDSPathQuery);
connect(&_domainHandler, &DomainHandler::connectedToDomain, this, &NodeList::sendPendingDSPathQuery);
// send a domain server check in immediately once the DS socket is known
connect(&_domainHandler, &DomainHandler::completedSocketDiscovery, this, &NodeList::sendDomainServerCheckIn);

View file

@ -336,7 +336,7 @@ LogWindow.prototype = {
function goHomeClicked() {
if (interfacePath) {
startInterface('hifi://localhost/7.91966,23.2104,20.7416/0,-0.476144,0,0.879367');
startInterface('hifi://localhost');
} else {
// show an error to say that we can't go home without an interface instance
dialog.showErrorBox("Client Not Found", binaryMissingMessage("High Fidelity client", "Interface", false));