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