mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
Added urlGoTo
This commit is contained in:
parent
bd37a75245
commit
8120700787
1 changed files with 39 additions and 0 deletions
|
@ -356,6 +356,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
QMutexLocker locker(&_settingsMutex);
|
QMutexLocker locker(&_settingsMutex);
|
||||||
_previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
|
_previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
|
||||||
}
|
}
|
||||||
|
//When -url in command line, teleport to location
|
||||||
|
urlGoTo(argc, constArgv);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
@ -3548,3 +3550,40 @@ void Application::takeSnapshot() {
|
||||||
|
|
||||||
Snapshot::saveSnapshot(_glWidget, _myAvatar);
|
Snapshot::saveSnapshot(_glWidget, _myAvatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::urlGoTo(int argc, const char * constArgv[]) {
|
||||||
|
//Gets the url (hifi://domain/destination/orientation)
|
||||||
|
QString customUrl = getCmdOption(argc, constArgv, "-url");
|
||||||
|
|
||||||
|
if (customUrl.startsWith("hifi://")) {
|
||||||
|
QStringList urlParts = customUrl.remove(0, CUSTOM_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
if (urlParts.count() > 1) {
|
||||||
|
// if url has 2 or more parts, the first one is domain name
|
||||||
|
QString domain = urlParts[0];
|
||||||
|
|
||||||
|
// second part is either a destination coordinate or
|
||||||
|
// a place name
|
||||||
|
QString destination = urlParts[1];
|
||||||
|
|
||||||
|
// any third part is an avatar orientation.
|
||||||
|
QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
|
||||||
|
|
||||||
|
Menu::goToDomain(domain);
|
||||||
|
|
||||||
|
// goto either @user, #place, or x-xx,y-yy,z-zz
|
||||||
|
// style co-ordinate.
|
||||||
|
Menu::goTo(destination);
|
||||||
|
|
||||||
|
if (!orientation.isEmpty()) {
|
||||||
|
// location orientation
|
||||||
|
Menu::goToOrientation(orientation);
|
||||||
|
}
|
||||||
|
} else if (urlParts.count() == 1) {
|
||||||
|
// location coordinates or place name
|
||||||
|
QString destination = urlParts[0];
|
||||||
|
Menu::goTo(destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue