History

Merge branch 'master' of https://github.com/highfidelity/hifi

barnold1953 committed 12 years ago

Commit 5b366fe2 parents 97c0a2f 075861152 files · +1375 −142Browse files

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

Unified · Split

interface/src/Application.cpp+54−51
@@ -173,7 +173,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 172 unmodified lines
173173 _previousScriptLocation(),
174174 _runningScriptsWidget(new RunningScriptsWidget(_window)),
175175 _runningScriptsWidgetWasVisible(false)
176−{
176+{
177177 // read the ApplicationInfo.ini file for Name/Version/Domain information
178178 QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
179179
@@ -235,10 +235,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 55 unmodified lines
235235
236236 connect(&nodeList->getDomainHandler(), SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
237237 connect(&nodeList->getDomainHandler(), SIGNAL(connectedToDomain(const QString&)), SLOT(connectedToDomain(const QString&)));
238−
238+
239239 // update our location every 5 seconds in the data-server, assuming that we are authenticated with one
240240 const float DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5.0f * 1000.0f;
241−
241+
242242 QTimer* locationUpdateTimer = new QTimer(this);
243243 connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer);
244244 locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
@@ -334,7 +334,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 89 unmodified lines
334334
335335 // when -url in command line, teleport to location
336336 urlGoTo(argc, constArgv);
337−
337+
338338 // For now we're going to set the PPS for outbound packets to be super high, this is
339339 // probably not the right long term solution. But for now, we're going to do this to
340340 // 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
361361 // clear the scripts, and set out script to our default scripts
362362 clearScriptsBeforeRunning();
363363 loadScript("http://public.highfidelity.io/scripts/defaultScripts.js");
364−
364+
365365 QMutexLocker locker(&_settingsMutex);
366366 _settings->setValue("firstRun",QVariant(false));
367367 } else {
368368 // do this as late as possible so that all required subsystems are inialized
369369 loadScripts();
370−
370+
371371 QMutexLocker locker(&_settingsMutex);
372372 _previousScriptLocation = _settings->value("LastScriptLocation", QVariant("")).toString();
373373 }
374−
374+
375375 connect(_window, &MainWindow::windowGeometryChanged,
376376 _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+
381381 // call the OAuthWebviewHandler static getter so that its instance lives in our thread
382382 OAuthWebViewHandler::getInstance();
383383 // make sure the High Fidelity root CA is in our list of trusted certs
@@ -390,11 +390,11 @@ Application::~Application() { · 6 unmodified lines
390390
391391 // make sure we don't call the idle timer any more
392392 delete idleTimer;
393−
393+
394394 _sharedVoxelSystem.changeTree(new VoxelTree);
395−
395+
396396 saveSettings();
397−
397+
398398 delete _voxelImporter;
399399
400400 // let the avatar mixer know we're out
@@ -433,7 +433,7 @@ Application::~Application() { · 32 unmodified lines
433433 void Application::saveSettings() {
434434 Menu::getInstance()->saveSettings();
435435 _rearMirrorTools->saveSettings(_settings);
436−
436+
437437 if (_voxelImporter) {
438438 _voxelImporter->saveSettings(_settings);
439439 }
@@ -515,7 +515,7 @@ void Application::initializeGL() { · 75 unmodified lines
515515 _voxelHideShowThread.initialize(_enableProcessVoxelsThread);
516516 _particleEditSender.initialize(_enableProcessVoxelsThread);
517517 _modelEditSender.initialize(_enableProcessVoxelsThread);
518−
518+
519519 if (_enableProcessVoxelsThread) {
520520 qDebug("Voxel parsing thread created.");
521521 }
@@ -1251,7 +1251,7 @@ void Application::dropEvent(QDropEvent *event) { · 729 unmodified lines
12511251
12521252 void Application::sendPingPackets() {
12531253 QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
1254− controlledBroadcastToNodes(pingPacket, NodeSet()
1254+ controlledBroadcastToNodes(pingPacket, NodeSet()
12551255 << NodeType::VoxelServer << NodeType::ParticleServer << NodeType::ModelServer
12561256 << NodeType::AudioMixer << NodeType::AvatarMixer
12571257 << NodeType::MetavoxelServer);
@@ -1262,7 +1262,7 @@ void Application::timer() { · 4 unmodified lines
12621262 if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
12631263 sendPingPackets();
12641264 }
1265−
1265+
12661266 float diffTime = (float)_timerStart.nsecsElapsed() / 1000000000.0f;
12671267
12681268 _fps = (float)_frameCount / diffTime;
@@ -1666,7 +1666,7 @@ void Application::init() { · 397 unmodified lines
16661666 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
16671667 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
16681668 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1669−
1669+
16701670 // set up our audio reflector
16711671 _audioReflector.setMyAvatar(getAvatar());
16721672 _audioReflector.setVoxels(_voxels.getTree());
@@ -1675,7 +1675,7 @@ void Application::init() { · 2 unmodified lines
16751675
16761676 connect(getAudio(), &Audio::processInboundAudio, &_audioReflector, &AudioReflector::processInboundAudio,Qt::DirectConnection);
16771677 connect(getAudio(), &Audio::processLocalAudio, &_audioReflector, &AudioReflector::processLocalAudio,Qt::DirectConnection);
1678− connect(getAudio(), &Audio::preProcessOriginalInboundAudio, &_audioReflector,
1678+ connect(getAudio(), &Audio::preProcessOriginalInboundAudio, &_audioReflector,
16791679 &AudioReflector::preProcessOriginalInboundAudio,Qt::DirectConnection);
16801680
16811681 // save settings when avatar changes
@@ -1790,7 +1790,7 @@ void Application::updateMyAvatarLookAtPosition() { · 108 unmodified lines
17901790 PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()");
17911791
17921792 FaceTracker* tracker = getActiveFaceTracker();
1793−
1793+
17941794 bool isLookingAtSomeone = false;
17951795 glm::vec3 lookAtSpot;
17961796 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
@@ -1825,7 +1825,7 @@ void Application::updateMyAvatarLookAtPosition() { · 28 unmodified lines
18251825 glm::distance(_mouseRayOrigin, _myAvatar->getHead()->calculateAverageEyePosition()));
18261826 lookAtSpot = _mouseRayOrigin + _mouseRayDirection * qMax(minEyeDistance, distance);
18271827 */
1828−
1828+
18291829 }
18301830 //
18311831 // 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
18451845 eyePitch * pitchSign * deflection, eyeYaw * deflection, 0.0f))) *
18461846 glm::inverse(_myCamera.getRotation()) * (lookAtSpot - origin);
18471847 }
1848−
1848+
18491849 _myAvatar->getHead()->setLookAtPosition(lookAtSpot);
18501850 }
18511851
@@ -1897,7 +1897,7 @@ void Application::updateCamera(float deltaTime) { · 45 unmodified lines
18971897 PerformanceWarning warn(showWarnings, "Application::updateCamera()");
18981898
18991899 if (!OculusManager::isConnected() && !TV3DManager::isConnected() &&
1900− Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
1900+ Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
19011901 FaceTracker* tracker = getActiveFaceTracker();
19021902 if (tracker) {
19031903 const float EYE_OFFSET_SCALE = 0.025f;
@@ -2453,7 +2453,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 549 unmodified lines
24532453
24542454 // disable specular lighting for ground and voxels
24552455 glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR);
2456−
2456+
24572457 // draw the audio reflector overlay
24582458 _audioReflector.render();
24592459
@@ -2621,7 +2621,7 @@ void Application::displayOverlay() { · 161 unmodified lines
26212621 const float LOG2_LOUDNESS_FLOOR = 11.f;
26222622 float audioLevel = 0.f;
26232623 float loudness = _audio.getLastInputLoudness() + 1.f;
2624−
2624+
26252625 _trailingAudioLoudness = AUDIO_METER_AVERAGING * _trailingAudioLoudness + (1.f - AUDIO_METER_AVERAGING) * loudness;
26262626 float log2loudness = log(_trailingAudioLoudness) / LOG2;
26272627
@@ -2634,7 +2634,7 @@ void Application::displayOverlay() { · 6 unmodified lines
26342634 audioLevel = AUDIO_METER_SCALE_WIDTH;
26352635 }
26362636 bool isClipping = ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME));
2637−
2637+
26382638 if ((_audio.getTimeSinceLastClip() > 0.f) && (_audio.getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
26392639 const float MAX_MAGNITUDE = 0.7f;
26402640 float magnitude = MAX_MAGNITUDE * (1 - _audio.getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME);
@@ -2740,7 +2740,7 @@ void Application::displayOverlay() { · 99 unmodified lines
27402740
27412741 // give external parties a change to hook in
27422742 emit renderingOverlay();
2743−
2743+
27442744 _overlays.render2D();
27452745
27462746 glPopMatrix();
@@ -2816,7 +2816,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 69 unmodified lines
28162816 // save absolute translations
28172817 glm::vec3 absoluteSkeletonTranslation = _myAvatar->getSkeletonModel().getTranslation();
28182818 glm::vec3 absoluteFaceTranslation = _myAvatar->getHead()->getFaceModel().getTranslation();
2819−
2819+
28202820 // get the eye positions relative to the neck and use them to set the face translation
28212821 glm::vec3 leftEyePosition, rightEyePosition;
28222822 _myAvatar->getHead()->getFaceModel().setTranslation(glm::vec3());
@@ -3082,7 +3082,7 @@ void Application::uploadModel(ModelType modelType) { · 259 unmodified lines
30823082 thread->connect(uploader, SIGNAL(destroyed()), SLOT(quit()));
30833083 thread->connect(thread, SIGNAL(finished()), SLOT(deleteLater()));
30843084 uploader->connect(thread, SIGNAL(started()), SLOT(send()));
3085−
3085+
30863086 thread->start();
30873087 }
30883088
@@ -3099,28 +3099,28 @@ void Application::updateWindowTitle(){ · 10 unmodified lines
30993099 }
31003100
31013101 void Application::updateLocationInServer() {
3102−
3102+
31033103 AccountManager& accountManager = AccountManager::getInstance();
3104−
3104+
31053105 if (accountManager.isLoggedIn()) {
3106−
3106+
31073107 static QJsonObject lastLocationObject;
3108−
3108+
31093109 // construct a QJsonObject given the user's current address information
31103110 QJsonObject updatedLocationObject;
3111−
3111+
31123112 QJsonObject addressObject;
31133113 addressObject.insert("position", QString(createByteArray(_myAvatar->getPosition())));
31143114 addressObject.insert("orientation", QString(createByteArray(glm::degrees(safeEulerAngles(_myAvatar->getOrientation())))));
31153115 addressObject.insert("domain", NodeList::getInstance()->getDomainHandler().getHostname());
3116−
3116+
31173117 updatedLocationObject.insert("address", addressObject);
3118−
3118+
31193119 if (updatedLocationObject != lastLocationObject) {
3120−
3120+
31213121 accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation,
31223122 JSONCallbackParameters(), QJsonDocument(updatedLocationObject).toJson());
3123−
3123+
31243124 lastLocationObject = updatedLocationObject;
31253125 }
31263126 }
@@ -3145,7 +3145,7 @@ void Application::domainChanged(const QString& domainHostname) { · 18 unmodified lines
31453145
31463146 // reset the voxels renderer
31473147 _voxels.killLocalVoxels();
3148−
3148+
31493149 // reset the auth URL for OAuth web view handler
31503150 OAuthWebViewHandler::getInstance().clearLastAuthorizationURL();
31513151 }
@@ -3366,7 +3366,7 @@ void Application::loadScripts() { · 214 unmodified lines
33663366 loadScript(string);
33673367 }
33683368 }
3369−
3369+
33703370 QMutexLocker locker(&_settingsMutex);
33713371 _settings->endArray();
33723372 }
@@ -3592,9 +3592,12 @@ void Application::loadScriptURLDialog() { · 219 unmodified lines
35923592 void Application::toggleLogDialog() {
35933593 if (! _logDialog) {
35943594 _logDialog = new LogDialog(_glWidget, getLogger());
3595− _logDialog->show();
3595+ }
3596+
3597+ if (_logDialog->isVisible()) {
3598+ _logDialog->hide();
35963599 } else {
3597− _logDialog->close();
3600+ _logDialog->show();
35983601 }
35993602 }
36003603
@@ -3628,7 +3631,7 @@ void Application::parseVersionXml() { · 27 unmodified lines
36283631 QObject* sender = QObject::sender();
36293632
36303633 QXmlStreamReader xml(qobject_cast<QNetworkReply*>(sender));
3631−
3634+
36323635 while (!xml.atEnd() && !xml.hasError()) {
36333636 if (xml.tokenType() == QXmlStreamReader::StartElement && xml.name() == operatingSystem) {
36343637 while (!(xml.tokenType() == QXmlStreamReader::EndElement && xml.name() == operatingSystem)) {
@@ -3645,7 +3648,7 @@ void Application::parseVersionXml() { · 10 unmodified lines
36453648 }
36463649 xml.readNext();
36473650 }
3648−
3651+
36493652 if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
36503653 new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
36513654 }
@@ -3697,24 +3700,24 @@ void Application::urlGoTo(int argc, const char * constArgv[]) { · 45 unmodified lines
36973700 } else if (urlParts.count() > 1) {
36983701 // if url has 2 or more parts, the first one is domain name
36993702 QString domain = urlParts[0];
3700−
3703+
37013704 // second part is either a destination coordinate or
37023705 // a place name
37033706 QString destination = urlParts[1];
3704−
3707+
37053708 // any third part is an avatar orientation.
37063709 QString orientation = urlParts.count() > 2 ? urlParts[2] : QString();
3707−
3710+
37083711 Menu::goToDomain(domain);
3709−
3712+
37103713 // goto either @user, #place, or x-xx,y-yy,z-zz
37113714 // style co-ordinate.
37123715 Menu::goTo(destination);
3713−
3716+
37143717 if (!orientation.isEmpty()) {
37153718 // location orientation
37163719 Menu::goToOrientation(orientation);
37173720 }
3718− }
3721+ }
37193722 }
37203723 }

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