Showing the changes to interface/src/Application.cpp (1 of 52 files). Show all
Unified · Split
| @@ -173,7 +173,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 172 unmodified lines | ||
| 173 | 173 | _previousScriptLocation(), |
| 174 | 174 | _runningScriptsWidget(new RunningScriptsWidget(_window)), |
| 175 | 175 | _runningScriptsWidgetWasVisible(false) |
| 176 | −{ | |
| 176 | +{ | |
| 177 | 177 | // read the ApplicationInfo.ini file for Name/Version/Domain information |
| 178 | 178 | QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat); |
| 179 | 179 | |
| @@ -235,10 +235,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 55 unmodified lines | ||
| 235 | 235 | |
| 236 | 236 | connect(&nodeList->getDomainHandler(), SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&))); |
| 237 | 237 | connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&))); |
| 238 | − | |
| 238 | + | |
| 239 | 239 | // update our location every 5 seconds in the data-server, assuming that we are authenticated with one |
| 240 | 240 | const float DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5.0f * 1000.0f; |
| 241 | − | |
| 241 | + | |
| 242 | 242 | QTimer* locationUpdateTimer = new QTimer(this); |
| 243 | 243 | connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer); |
| 244 | 244 | locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS); |
| @@ -334,7 +334,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 89 unmodified lines | ||
| 334 | 334 | |
| 335 | 335 | // when -url in command line, teleport to location |
| 336 | 336 | urlGoTo(argc, constArgv); |
| 337 | − | |
| 337 | + | |
| 338 | 338 | // For now we're going to set the PPS for outbound packets to be super high, this is |
| 339 | 339 | // probably not the right long term solution. But for now, we're going to do this to |
| 340 | 340 | // allow you to move a particle around in your hand |
| @@ -361,23 +361,23 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 20 unmodified lines | ||
| 361 | 361 | // clear the scripts, and set out script to our default scripts |
| 362 | 362 | clearScriptsBeforeRunning(); |
| 363 | 363 | loadScript("http://public.highfidelity.io/scripts/defaultScripts.js"); |
| 364 | − | |
| 364 | + | |
| 365 | 365 | QMutexLocker locker(&_settingsMutex); |
| 366 | 366 | _settings->setValue("firstRun",QVariant(false)); |
| 367 | 367 | } else { |
| 368 | 368 | // do this as late as possible so that all required subsystems are inialized |
| 369 | 369 | loadScripts(); |
| 370 | − | |
| 370 | + | |
| 371 | 371 | QMutexLocker locker(&_settingsMutex); |
| 372 | 372 | _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString(); |
| 373 | 373 | } |
| 374 | − | |
| 374 | + | |
| 375 | 375 | connect(_window, &MainWindow::windowGeometryChanged, |
| 376 | 376 | _runningScriptsWidget, &RunningScriptsWidget::setBoundary); |
| 377 | − | |
| 378 | − //When -url in command line, teleport to location | |
| 379 | − urlGoTo(argc, constArgv); | |
| 380 | − | |
| 377 | + | |
| 378 | + //When -url in command line, teleport to location | |
| 379 | + urlGoTo(argc, constArgv); | |
| 380 | + | |
| 381 | 381 | // call the OAuthWebviewHandler static getter so that its instance lives in our thread |
| 382 | 382 | OAuthWebViewHandler::getInstance(); |
| 383 | 383 | // make sure the High Fidelity root CA is in our list of trusted certs |
| @@ -390,11 +390,11 @@ Application::~Application() { · 6 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | // make sure we don't call the idle timer any more |
| 392 | 392 | delete idleTimer; |
| 393 | − | |
| 393 | + | |
| 394 | 394 | _sharedVoxelSystem.changeTree(new VoxelTree); |
| 395 | − | |
| 395 | + | |
| 396 | 396 | saveSettings(); |
| 397 | − | |
| 397 | + | |
| 398 | 398 | delete _voxelImporter; |
| 399 | 399 | |
| 400 | 400 | // let the avatar mixer know we're out |
| @@ -433,7 +433,7 @@ Application::~Application() { · 32 unmodified lines | ||
| 433 | 433 | void Application::saveSettings() { |
| 434 | 434 | Menu::getInstance()->saveSettings(); |
| 435 | 435 | _rearMirrorTools->saveSettings(_settings); |
| 436 | − | |
| 436 | + | |
| 437 | 437 | if (_voxelImporter) { |
| 438 | 438 | _voxelImporter->saveSettings(_settings); |
| 439 | 439 | } |
| @@ -515,7 +515,7 @@ void Application::initializeGL() { · 75 unmodified lines | ||
| 515 | 515 | _voxelHideShowThread.initialize(_enableProcessVoxelsThread); |
| 516 | 516 | _particleEditSender.initialize(_enableProcessVoxelsThread); |
| 517 | 517 | _modelEditSender.initialize(_enableProcessVoxelsThread); |
| 518 | − | |
| 518 | + | |
| 519 | 519 | if (_enableProcessVoxelsThread) { |
| 520 | 520 | qDebug("Voxel parsing thread created."); |
| 521 | 521 | } |
| @@ -1251,7 +1251,7 @@ void Application::dropEvent(QDropEvent *event) { · 729 unmodified lines | ||
| 1251 | 1251 | |
| 1252 | 1252 | void Application::sendPingPackets() { |
| 1253 | 1253 | QByteArray pingPacket = NodeList::getInstance()->constructPingPacket(); |
| 1254 | − controlledBroadcastToNodes(pingPacket, NodeSet() | |
| 1254 | + controlledBroadcastToNodes(pingPacket, NodeSet() | |
| 1255 | 1255 | << NodeType::VoxelServer << NodeType::ParticleServer << NodeType::ModelServer |
| 1256 | 1256 | << NodeType::AudioMixer << NodeType::AvatarMixer |
| 1257 | 1257 | << NodeType::MetavoxelServer); |
| @@ -1262,7 +1262,7 @@ void Application::timer() { · 4 unmodified lines | ||
| 1262 | 1262 | if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) { |
| 1263 | 1263 | sendPingPackets(); |
| 1264 | 1264 | } |
| 1265 | − | |
| 1265 | + | |
| 1266 | 1266 | float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f; |
| 1267 | 1267 | |
| 1268 | 1268 | _fps = (float)_frameCount / diffTime; |
| @@ -1666,7 +1666,7 @@ void Application::init() { · 397 unmodified lines | ||
| 1666 | 1666 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| 1667 | 1667 | connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); |
| 1668 | 1668 | connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); |
| 1669 | − | |
| 1669 | + | |
| 1670 | 1670 | // set up our audio reflector |
| 1671 | 1671 | _audioReflector.setMyAvatar(getAvatar()); |
| 1672 | 1672 | _audioReflector.setVoxels(_voxels.getTree()); |
| @@ -1675,7 +1675,7 @@ void Application::init() { · 2 unmodified lines | ||
| 1675 | 1675 | |
| 1676 | 1676 | connect(getAudio(), &Audio::processInboundAudio, &_audioReflector, &AudioReflector::processInboundAudio,Qt::DirectConnection); |
| 1677 | 1677 | connect(getAudio(), &Audio::processLocalAudio, &_audioReflector, &AudioReflector::processLocalAudio,Qt::DirectConnection); |
| 1678 | − connect(getAudio(), &Audio::preProcessOriginalInboundAudio, &_audioReflector, | |
| 1678 | + connect(getAudio(), &Audio::preProcessOriginalInboundAudio, &_audioReflector, | |
| 1679 | 1679 | &AudioReflector::preProcessOriginalInboundAudio,Qt::DirectConnection); |
| 1680 | 1680 | |
| 1681 | 1681 | // save settings when avatar changes |
| @@ -1790,7 +1790,7 @@ void Application::updateMyAvatarLookAtPosition() { · 108 unmodified lines | ||
| 1790 | 1790 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); |
| 1791 | 1791 | |
| 1792 | 1792 | FaceTracker* tracker = getActiveFaceTracker(); |
| 1793 | − | |
| 1793 | + | |
| 1794 | 1794 | bool isLookingAtSomeone = false; |
| 1795 | 1795 | glm::vec3 lookAtSpot; |
| 1796 | 1796 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| @@ -1825,7 +1825,7 @@ void Application::updateMyAvatarLookAtPosition() { · 28 unmodified lines | ||
| 1825 | 1825 | glm::distance(_mouseRayOrigin, _myAvatar->getHead()->calculateAverageEyePosition())); |
| 1826 | 1826 | lookAtSpot = _mouseRayOrigin + _mouseRayDirection * qMax(minEyeDistance, distance); |
| 1827 | 1827 | */ |
| 1828 | − | |
| 1828 | + | |
| 1829 | 1829 | } |
| 1830 | 1830 | // |
| 1831 | 1831 | // Deflect the eyes a bit to match the detected Gaze from 3D camera if active |
| @@ -1845,7 +1845,7 @@ void Application::updateMyAvatarLookAtPosition() { · 13 unmodified lines | ||
| 1845 | 1845 | eyePitch * pitchSign * deflection, eyeYaw * deflection, 0.0f))) * |
| 1846 | 1846 | glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin); |
| 1847 | 1847 | } |
| 1848 | − | |
| 1848 | + | |
| 1849 | 1849 | _myAvatar->getHead()->setLookAtPosition(lookAtSpot); |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| @@ -1897,7 +1897,7 @@ void Application::updateCamera(float deltaTime) { · 45 unmodified lines | ||
| 1897 | 1897 | PerformanceWarning warn(showWarnings, "Application::updateCamera()"); |
| 1898 | 1898 | |
| 1899 | 1899 | if (!OculusManager::isConnected() && !TV3DManager::isConnected() && |
| 1900 | − Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) { | |
| 1900 | + Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) { | |
| 1901 | 1901 | FaceTracker* tracker = getActiveFaceTracker(); |
| 1902 | 1902 | if (tracker) { |
| 1903 | 1903 | const float EYE_OFFSET_SCALE = 0.025f; |
| @@ -2453,7 +2453,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 549 unmodified lines | ||
| 2453 | 2453 | |
| 2454 | 2454 | // disable specular lighting for ground and voxels |
| 2455 | 2455 | glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR); |
| 2456 | − | |
| 2456 | + | |
| 2457 | 2457 | // draw the audio reflector overlay |
| 2458 | 2458 | _audioReflector.render(); |
| 2459 | 2459 | |
| @@ -2621,7 +2621,7 @@ void Application::displayOverlay() { · 161 unmodified lines | ||
| 2621 | 2621 | const float LOG2_LOUDNESS_FLOOR = 11.f; |
| 2622 | 2622 | float audioLevel = 0.f; |
| 2623 | 2623 | float loudness = _audio.getLastInputLoudness() + 1.f; |
| 2624 | − | |
| 2624 | + | |
| 2625 | 2625 | _trailingAudioLoudness = AUDIO_METER_AVERAGING * _trailingAudioLoudness + (1.f - AUDIO_METER_AVERAGING) * loudness; |
| 2626 | 2626 | float log2loudness = log(_trailingAudioLoudness) / LOG2; |
| 2627 | 2627 | |
| @@ -2634,7 +2634,7 @@ void Application::displayOverlay() { · 6 unmodified lines | ||
| 2634 | 2634 | audioLevel = AUDIO_METER_SCALE_WIDTH; |
| 2635 | 2635 | } |
| 2636 | 2636 | bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)); |
| 2637 | − | |
| 2637 | + | |
| 2638 | 2638 | if ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) { |
| 2639 | 2639 | const float MAX_MAGNITUDE = 0.7f; |
| 2640 | 2640 | float magnitude = MAX_MAGNITUDE * (1 - _audio.getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME); |
| @@ -2740,7 +2740,7 @@ void Application::displayOverlay() { · 99 unmodified lines | ||
| 2740 | 2740 | |
| 2741 | 2741 | // give external parties a change to hook in |
| 2742 | 2742 | emit renderingOverlay(); |
| 2743 | − | |
| 2743 | + | |
| 2744 | 2744 | _overlays.render2D(); |
| 2745 | 2745 | |
| 2746 | 2746 | glPopMatrix(); |
| @@ -2816,7 +2816,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 69 unmodified lines | ||
| 2816 | 2816 | // save absolute translations |
| 2817 | 2817 | glm::vec3 absoluteSkeletonTranslation = _myAvatar->getSkeletonModel().getTranslation(); |
| 2818 | 2818 | glm::vec3 absoluteFaceTranslation = _myAvatar->getHead()->getFaceModel().getTranslation(); |
| 2819 | − | |
| 2819 | + | |
| 2820 | 2820 | // get the eye positions relative to the neck and use them to set the face translation |
| 2821 | 2821 | glm::vec3 leftEyePosition, rightEyePosition; |
| 2822 | 2822 | _myAvatar->getHead()->getFaceModel().setTranslation(glm::vec3()); |
| @@ -3082,7 +3082,7 @@ void Application::uploadModel(ModelType modelType) { · 259 unmodified lines | ||
| 3082 | 3082 | thread->connect(uploader, SIGNAL(destroyed()), SLOT(quit())); |
| 3083 | 3083 | thread->connect(thread, SIGNAL(finished()), SLOT(deleteLater())); |
| 3084 | 3084 | uploader->connect(thread, SIGNAL(started()), SLOT(send())); |
| 3085 | − | |
| 3085 | + | |
| 3086 | 3086 | thread->start(); |
| 3087 | 3087 | } |
| 3088 | 3088 | |
| @@ -3099,28 +3099,28 @@ void Application::updateWindowTitle(){ · 10 unmodified lines | ||
| 3099 | 3099 | } |
| 3100 | 3100 | |
| 3101 | 3101 | void Application::updateLocationInServer() { |
| 3102 | − | |
| 3102 | + | |
| 3103 | 3103 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3104 | − | |
| 3104 | + | |
| 3105 | 3105 | if (accountManager.isLoggedIn()) { |
| 3106 | − | |
| 3106 | + | |
| 3107 | 3107 | static QJsonObject lastLocationObject; |
| 3108 | − | |
| 3108 | + | |
| 3109 | 3109 | // construct a QJsonObject given the user's current address information |
| 3110 | 3110 | QJsonObject updatedLocationObject; |
| 3111 | − | |
| 3111 | + | |
| 3112 | 3112 | QJsonObject addressObject; |
| 3113 | 3113 | addressObject.insert("position", QString(createByteArray(_myAvatar->getPosition()))); |
| 3114 | 3114 | addressObject.insert("orientation", QString(createByteArray(glm::degrees(safeEulerAngles(_myAvatar->getOrientation()))))); |
| 3115 | 3115 | addressObject.insert("domain", NodeList::getInstance()->getDomainHandler().getHostname()); |
| 3116 | − | |
| 3116 | + | |
| 3117 | 3117 | updatedLocationObject.insert("address", addressObject); |
| 3118 | − | |
| 3118 | + | |
| 3119 | 3119 | if (updatedLocationObject != lastLocationObject) { |
| 3120 | − | |
| 3120 | + | |
| 3121 | 3121 | accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation, |
| 3122 | 3122 | JSONCallbackParameters(), QJsonDocument(updatedLocationObject).toJson()); |
| 3123 | − | |
| 3123 | + | |
| 3124 | 3124 | lastLocationObject = updatedLocationObject; |
| 3125 | 3125 | } |
| 3126 | 3126 | } |
| @@ -3145,7 +3145,7 @@ void Application::domainChanged(const QString& domainHostname) { · 18 unmodified lines | ||
| 3145 | 3145 | |
| 3146 | 3146 | // reset the voxels renderer |
| 3147 | 3147 | _voxels.killLocalVoxels(); |
| 3148 | − | |
| 3148 | + | |
| 3149 | 3149 | // reset the auth URL for OAuth web view handler |
| 3150 | 3150 | OAuthWebViewHandler::getInstance().clearLastAuthorizationURL(); |
| 3151 | 3151 | } |
| @@ -3366,7 +3366,7 @@ void Application::loadScripts() { · 214 unmodified lines | ||
| 3366 | 3366 | loadScript(string); |
| 3367 | 3367 | } |
| 3368 | 3368 | } |
| 3369 | − | |
| 3369 | + | |
| 3370 | 3370 | QMutexLocker locker(&_settingsMutex); |
| 3371 | 3371 | _settings->endArray(); |
| 3372 | 3372 | } |
| @@ -3592,9 +3592,12 @@ void Application::loadScriptURLDialog() { · 219 unmodified lines | ||
| 3592 | 3592 | void Application::toggleLogDialog() { |
| 3593 | 3593 | if (! _logDialog) { |
| 3594 | 3594 | _logDialog = new LogDialog(_glWidget, getLogger()); |
| 3595 | − _logDialog->show(); | |
| 3595 | + } | |
| 3596 | + | |
| 3597 | + if (_logDialog->isVisible()) { | |
| 3598 | + _logDialog->hide(); | |
| 3596 | 3599 | } else { |
| 3597 | − _logDialog->close(); | |
| 3600 | + _logDialog->show(); | |
| 3598 | 3601 | } |
| 3599 | 3602 | } |
| 3600 | 3603 | |
| @@ -3628,7 +3631,7 @@ void Application::parseVersionXml() { · 27 unmodified lines | ||
| 3628 | 3631 | QObject* sender = QObject::sender(); |
| 3629 | 3632 | |
| 3630 | 3633 | QXmlStreamReader xml(qobject_cast<QNetworkReply*>(sender)); |
| 3631 | − | |
| 3634 | + | |
| 3632 | 3635 | while (!xml.atEnd() && !xml.hasError()) { |
| 3633 | 3636 | if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name() == operatingSystem) { |
| 3634 | 3637 | while (!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == operatingSystem)) { |
| @@ -3645,7 +3648,7 @@ void Application::parseVersionXml() { · 10 unmodified lines | ||
| 3645 | 3648 | } |
| 3646 | 3649 | xml.readNext(); |
| 3647 | 3650 | } |
| 3648 | − | |
| 3651 | + | |
| 3649 | 3652 | if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { |
| 3650 | 3653 | new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl); |
| 3651 | 3654 | } |
| @@ -3697,24 +3700,24 @@ void Application::urlGoTo(int argc, const char * constArgv[]) { · 45 unmodified lines | ||
| 3697 | 3700 | } else if (urlParts.count() > 1) { |
| 3698 | 3701 | // if url has 2 or more parts, the first one is domain name |
| 3699 | 3702 | QString domain = urlParts[0]; |
| 3700 | − | |
| 3703 | + | |
| 3701 | 3704 | // second part is either a destination coordinate or |
| 3702 | 3705 | // a place name |
| 3703 | 3706 | QString destination = urlParts[1]; |
| 3704 | − | |
| 3707 | + | |
| 3705 | 3708 | // any third part is an avatar orientation. |
| 3706 | 3709 | QString orientation = urlParts.count() > 2 ? urlParts[2] : QString(); |
| 3707 | − | |
| 3710 | + | |
| 3708 | 3711 | Menu::goToDomain(domain); |
| 3709 | − | |
| 3712 | + | |
| 3710 | 3713 | // goto either @user, #place, or x-xx,y-yy,z-zz |
| 3711 | 3714 | // style co-ordinate. |
| 3712 | 3715 | Menu::goTo(destination); |
| 3713 | − | |
| 3716 | + | |
| 3714 | 3717 | if (!orientation.isEmpty()) { |
| 3715 | 3718 | // location orientation |
| 3716 | 3719 | Menu::goToOrientation(orientation); |
| 3717 | 3720 | } |
| 3718 | − } | |
| 3721 | + } | |
| 3719 | 3722 | } |
| 3720 | 3723 | } |