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
358 Particle::setVoxelEditPacketSender(&_voxelEditSender);358 Particle::setVoxelEditPacketSender(&_voxelEditSender);
359 Particle::setParticleEditPacketSender(&_particleEditSender);359 Particle::setParticleEditPacketSender(&_particleEditSender);
360 360
361 // when -url in command line, teleport to location
362 urlGoTo(argc, constArgv);
363
364 // For now we're going to set the PPS for outbound packets to be super high, this is361 // For now we're going to set the PPS for outbound packets to be super high, this is
365 // probably not the right long term solution. But for now, we're going to do this to362 // probably not the right long term solution. But for now, we're going to do this to
366 // allow you to move a particle around in your hand363 // 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
405 402
406 connect(_window, &MainWindow::windowGeometryChanged,403 connect(_window, &MainWindow::windowGeometryChanged,
407 _runningScriptsWidget, &RunningScriptsWidget::setBoundary);404 _runningScriptsWidget, &RunningScriptsWidget::setBoundary);
405
406 AddressManager& addressManager = AddressManager::getInstance();
408 407
409 // connect to the domainChangeRequired signal on AddressManager408 // connect to the domainChangeRequired signal on AddressManager
410 connect(&AddressManager::getInstance(), &AddressManager::possibleDomainChangeRequired,409 connect(&addressManager, &AddressManager::possibleDomainChangeRequired,
411 this, &Application::changeDomainHostname);410 this, &Application::changeDomainHostname);
412 411
413 //When -url in command line, teleport to location412 // when -url in command line, teleport to location
414 urlGoTo(argc, constArgv);413 addressManager.handleUrl(QUrl(getCmdOption(argc, constArgv, "-url")));
415 414
416 // call the OAuthWebviewHandler static getter so that its instance lives in our thread415 // call the OAuthWebviewHandler static getter so that its instance lives in our thread
417 OAuthWebViewHandler::getInstance();416 OAuthWebViewHandler::getInstance();
@@ -1066,10 +1065,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 648 unmodified lines
1066 case Qt::Key_Equal:1065 case Qt::Key_Equal:
1067 _myAvatar->resetSize();1066 _myAvatar->resetSize();
1068 break;1067 break;
1069
1070 case Qt::Key_At:
1071// Menu::getInstance()->goTo();
1072 break;
1073 default:1068 default:
1074 event->ignore();1069 event->ignore();
1075 break;1070 break;
@@ -1323,7 +1318,7 @@ void Application::dropEvent(QDropEvent *event) { · 247 unmodified lines
1323 SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath);1318 SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath);
1324 if (snapshotData) {1319 if (snapshotData) {
1325 if (!snapshotData->getDomain().isEmpty()) {1320 if (!snapshotData->getDomain().isEmpty()) {
1326// Menu::getInstance()->goToDomain(snapshotData->getDomain());1321 changeDomainHostname(snapshotData->getDomain());
1327 }1322 }
1328 1323
1329 _myAvatar->setPosition(snapshotData->getLocation());1324 _myAvatar->setPosition(snapshotData->getLocation());
@@ -3797,14 +3792,6 @@ ScriptEngine* Application::loadScript(const QString& scriptFilename, bool isUser · 2467 unmodified lines
3797 3792
3798 scriptEngine->registerGlobalObject("Overlays", &_overlays);3793 scriptEngine->registerGlobalObject("Overlays", &_overlays);
3799 3794
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
3808 scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());3795 scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
3809 scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());3796 scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
3810 scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());3797 scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
@@ -3932,6 +3919,13 @@ void Application::uploadAttachment() { · 121 unmodified lines
3932 uploadModel(ATTACHMENT_MODEL);3919 uploadModel(ATTACHMENT_MODEL);
3933}3920}
3934 3921
3922void 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
3935void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {3929void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {
3936 3930
3937 // from the domain-handler, figure out the satoshi cost per voxel and per meter cubed3931 // 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
4120 }4114 }
4121 _snapshotShareDialog->show();4115 _snapshotShareDialog->show();
4122}4116}
4123
4124void 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