Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -169,8 +169,6 @@ · 168 unmodified lines | ||
| 169 | 169 | #include "Util.h" |
| 170 | 170 | #include "InterfaceParentFinder.h" |
| 171 | 171 | |
| 172 | − | |
| 173 | − | |
| 174 | 172 | // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU |
| 175 | 173 | // FIXME seems to be broken. |
| 176 | 174 | #if defined(Q_OS_WIN) |
| @@ -195,6 +193,7 @@ static const QString FBX_EXTENSION = ".fbx"; · 18 unmodified lines | ||
| 195 | 193 | static const QString OBJ_EXTENSION = ".obj"; |
| 196 | 194 | static const QString AVA_JSON_EXTENSION = ".ava.json"; |
| 197 | 195 | |
| 196 | +static const int MSECS_PER_SEC = 1000; | |
| 198 | 197 | static const int MIRROR_VIEW_TOP_PADDING = 5; |
| 199 | 198 | static const int MIRROR_VIEW_LEFT_PADDING = 10; |
| 200 | 199 | static const int MIRROR_VIEW_WIDTH = 265; |
| @@ -452,8 +451,11 @@ PluginContainer* _pluginContainer; · 251 unmodified lines | ||
| 452 | 451 | OffscreenGLCanvas* _chromiumShareContext { nullptr }; |
| 453 | 452 | Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); |
| 454 | 453 | |
| 454 | +Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 }; | |
| 455 | + | |
| 455 | 456 | Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : |
| 456 | 457 | QApplication(argc, argv), |
| 458 | + _sessionRunTimer(startupTimer), | |
| 457 | 459 | _window(new MainWindow(desktop())), |
| 458 | 460 | _previousSessionCrashed(setupEssentials(argc, argv)), |
| 459 | 461 | _undoStackScriptingInterface(&_undoStack), |
| @@ -605,7 +607,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 145 unmodified lines | ||
| 605 | 607 | connect(&domainHandler, SIGNAL(disconnectedFromDomain()), SLOT(clearDomainOctreeDetails())); |
| 606 | 608 | |
| 607 | 609 | // update our location every 5 seconds in the metaverse server, assuming that we are authenticated with one |
| 608 | − const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000; | |
| 610 | + const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * MSECS_PER_SEC; | |
| 609 | 611 | |
| 610 | 612 | auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>(); |
| 611 | 613 | connect(&locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation); |
| @@ -627,7 +629,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 15 unmodified lines | ||
| 627 | 629 | // connect to appropriate slots on AccountManager |
| 628 | 630 | AccountManager& accountManager = AccountManager::getInstance(); |
| 629 | 631 | |
| 630 | − const qint64 BALANCE_UPDATE_INTERVAL_MSECS = 5 * 1000; | |
| 632 | + const qint64 BALANCE_UPDATE_INTERVAL_MSECS = 5 * MSECS_PER_SEC; | |
| 631 | 633 | |
| 632 | 634 | connect(&balanceUpdateTimer, &QTimer::timeout, &accountManager, &AccountManager::updateBalance); |
| 633 | 635 | balanceUpdateTimer.start(BALANCE_UPDATE_INTERVAL_MSECS); |
| @@ -642,7 +644,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 8 unmodified lines | ||
| 642 | 644 | accountManager.setIsAgent(true); |
| 643 | 645 | accountManager.setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL); |
| 644 | 646 | |
| 645 | − UserActivityLogger::getInstance().launch(applicationVersion(), _previousSessionCrashed); | |
| 647 | + UserActivityLogger::getInstance().launch(applicationVersion(), _previousSessionCrashed, sessionRunTime.get()); // before loadSettings resets sessionRuntTime. | |
| 646 | 648 | |
| 647 | 649 | // once the event loop has started, check and signal for an access token |
| 648 | 650 | QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection); |
| @@ -2804,6 +2806,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa · 2155 unmodified lines | ||
| 2804 | 2806 | |
| 2805 | 2807 | void Application::loadSettings() { |
| 2806 | 2808 | |
| 2809 | + sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value. | |
| 2807 | 2810 | DependencyManager::get<AudioClient>()->loadSettings(); |
| 2808 | 2811 | DependencyManager::get<LODManager>()->loadSettings(); |
| 2809 | 2812 | |
| @@ -2817,6 +2820,7 @@ void Application::loadSettings() { · 7 unmodified lines | ||
| 2817 | 2820 | } |
| 2818 | 2821 | |
| 2819 | 2822 | void Application::saveSettings() { |
| 2823 | + sessionRunTime.set(_sessionRunTimer.elapsed() / MSECS_PER_SEC); | |
| 2820 | 2824 | DependencyManager::get<AudioClient>()->saveSettings(); |
| 2821 | 2825 | DependencyManager::get<LODManager>()->saveSettings(); |
| 2822 | 2826 | |