History

some url handling repairs, move existing error reply handlers to new format

Stephen Birarda committed 12 years ago

Commit 1f2020d1 parent 78961199 files · +37 −65Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+13−53
@@ -358,9 +358,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 357 unmodified lines
358358 Particle::setVoxelEditPacketSender(&_voxelEditSender);
359359 Particle::setParticleEditPacketSender(&_particleEditSender);
360360
361− // when -url in command line, teleport to location
362− urlGoTo(argc, constArgv);
363−
364361 // For now we're going to set the PPS for outbound packets to be super high, this is
365362 // probably not the right long term solution. But for now, we're going to do this to
366363 // allow you to move a particle around in your hand
@@ -405,13 +402,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 38 unmodified lines
405402
406403 connect(_window, &MainWindow::windowGeometryChanged,
407404 _runningScriptsWidget, &RunningScriptsWidget::setBoundary);
405+
406+ AddressManager& addressManager = AddressManager::getInstance();
408407
409408 // connect to the domainChangeRequired signal on AddressManager
410− connect(&AddressManager::getInstance(), &AddressManager::possibleDomainChangeRequired,
409+ connect(&addressManager, &AddressManager::possibleDomainChangeRequired,
411410 this, &Application::changeDomainHostname);
412411
413− //When -url in command line, teleport to location
414− urlGoTo(argc, constArgv);
412+ // when -url in command line, teleport to location
413+ addressManager.handleUrl(QUrl(getCmdOption(argc, constArgv, "-url")));
415414
416415 // call the OAuthWebviewHandler static getter so that its instance lives in our thread
417416 OAuthWebViewHandler::getInstance();
@@ -1066,10 +1065,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 648 unmodified lines
10661065 case Qt::Key_Equal:
10671066 _myAvatar->resetSize();
10681067 break;
1069−
1070− case Qt::Key_At:
1071−// Menu::getInstance()->goTo();
1072− break;
10731068 default:
10741069 event->ignore();
10751070 break;
@@ -1323,7 +1318,7 @@ void Application::dropEvent(QDropEvent *event) { · 247 unmodified lines
13231318 SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath);
13241319 if (snapshotData) {
13251320 if (!snapshotData->getDomain().isEmpty()) {
1326−// Menu::getInstance()->goToDomain(snapshotData->getDomain());
1321+ changeDomainHostname(snapshotData->getDomain());
13271322 }
13281323
13291324 _myAvatar->setPosition(snapshotData->getLocation());
@@ -3797,14 +3792,6 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser · 2467 unmodified lines
37973792
37983793 scriptEngine->registerGlobalObject("Overlays", &_overlays);
37993794
3800− QScriptValue windowValue = scriptEngine->registerGlobalObject("Window", WindowScriptingInterface::getInstance());
3801−// scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
3802−// LocationScriptingInterface::locationSetter, windowValue);
3803−//
3804−// // register `location` on the global object.
3805−// scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
3806−// LocationScriptingInterface::locationSetter);
3807−
38083795 scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
38093796 scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
38103797 scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
@@ -3932,6 +3919,13 @@ void Application::uploadAttachment() { · 121 unmodified lines
39323919 uploadModel(ATTACHMENT_MODEL);
39333920 }
39343921
3922+void Application::openUrl(const QUrl& url) {
3923+ if (!AddressManager::getInstance().handleUrl(url)) {
3924+ // address manager did not handle - ask QDesktopServices to handle
3925+ QDesktopServices::openUrl(url);
3926+ }
3927+}
3928+
39353929 void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {
39363930
39373931 // from the domain-handler, figure out the satoshi cost per voxel and per meter cubed
@@ -4120,37 +4114,3 @@ void Application::takeSnapshot() { · 182 unmodified lines
41204114 }
41214115 _snapshotShareDialog->show();
41224116 }
4123−
4124−void Application::urlGoTo(int argc, const char * constArgv[]) {
4125− //Gets the url (hifi://domain/destination/orientation)
4126− QString customUrl = getCmdOption(argc, constArgv, "-url");
4127− if(customUrl.startsWith(HIFI_URL_SCHEME + "//")) {
4128− QStringList urlParts = customUrl.remove(0, HIFI_URL_SCHEME.length() + 2).split('/', QString::SkipEmptyParts);
4129− if (urlParts.count() == 1) {
4130− // location coordinates or place name
4131− QString domain = urlParts[0];
4132−// Menu::goToDomain(domain);
4133− } else if (urlParts.count() > 1) {
4134− // if url has 2 or more parts, the first one is domain name
4135− QString domain = urlParts[0];
4136−
4137− // second part is either a destination coordinate or
4138− // a place name
4139− QString destination = urlParts[1];
4140−
4141− // any third part is an avatar orientation.
4142− QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
4143−
4144−// Menu::goToDomain(domain);
4145−
4146− // goto either @user, #place, or x-xx,y-yy,z-zz
4147− // style co-ordinate.
4148−// Menu::goTo(destination);
4149−
4150− if (!orientation.isEmpty()) {
4151− // location orientation
4152−// Menu::goToOrientation(orientation);
4153− }
4154− }
4155− }
4156−}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t