Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all
Unified · Split
| @@ -175,8 +175,6 @@ public: · 174 unmodified lines | |||
| 175 | using namespace std; | 175 | using namespace std; |
| 176 | 176 | ||
| 177 | // Starfield information | 177 | // Starfield information |
| 178 | static uint8_t THROTTLED_IDLE_TIMER_DELAY = 10; | ||
| 179 | |||
| 180 | const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB | 178 | const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB |
| 181 | 179 | ||
| 182 | static QTimer* locationUpdateTimer = NULL; | 180 | static QTimer* locationUpdateTimer = NULL; |
| @@ -737,6 +735,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 554 unmodified lines | |||
| 737 | _keyboardFocusHighlight->setVisible(false); | 735 | _keyboardFocusHighlight->setVisible(false); |
| 738 | } | 736 | } |
| 739 | }); | 737 | }); |
| 738 | |||
| 739 | connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); | ||
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | void Application::aboutToQuit() { | 742 | void Application::aboutToQuit() { |
| @@ -2108,8 +2108,11 @@ void Application::idle() { · 1365 unmodified lines | |||
| 2108 | // Once rendering is off on another thread we should be able to have Application::idle run at start(0) in | 2108 | // Once rendering is off on another thread we should be able to have Application::idle run at start(0) in |
| 2109 | // perpetuity and not expect events to get backed up. | 2109 | // perpetuity and not expect events to get backed up. |
| 2110 | 2110 | ||
| 2111 | bool isThrottled = getActiveDisplayPlugin()->isThrottled(); | ||
| 2112 | static const int THROTTLED_IDLE_TIMER_DELAY = MSECS_PER_SECOND / 15; | ||
| 2111 | static const int IDLE_TIMER_DELAY_MS = 2; | 2113 | static const int IDLE_TIMER_DELAY_MS = 2; |
| 2112 | int desiredInterval = getActiveDisplayPlugin()->isThrottled() ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS; | 2114 | int desiredInterval = isThrottled ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS; |
| 2115 | //qDebug() << "isThrottled:" << isThrottled << "desiredInterval:" << desiredInterval; | ||
| 2113 | 2116 | ||
| 2114 | if (idleTimer->interval() != desiredInterval) { | 2117 | if (idleTimer->interval() != desiredInterval) { |
| 2115 | idleTimer->start(desiredInterval); | 2118 | idleTimer->start(desiredInterval); |
| @@ -4612,6 +4615,24 @@ void Application::checkSkeleton() { · 2496 unmodified lines | |||
| 4612 | } | 4615 | } |
| 4613 | } | 4616 | } |
| 4614 | 4617 | ||
| 4618 | bool Application::isForeground() { | ||
| 4619 | return _isForeground && !getWindow()->isMinimized(); | ||
| 4620 | } | ||
| 4621 | |||
| 4622 | void Application::activeChanged(Qt::ApplicationState state) { | ||
| 4623 | switch (state) { | ||
| 4624 | case Qt::ApplicationActive: | ||
| 4625 | _isForeground = true; | ||
| 4626 | break; | ||
| 4627 | |||
| 4628 | case Qt::ApplicationSuspended: | ||
| 4629 | case Qt::ApplicationHidden: | ||
| 4630 | case Qt::ApplicationInactive: | ||
| 4631 | default: | ||
| 4632 | _isForeground = false; | ||
| 4633 | break; | ||
| 4634 | } | ||
| 4635 | } | ||
| 4615 | void Application::showFriendsWindow() { | 4636 | void Application::showFriendsWindow() { |
| 4616 | const QString FRIENDS_WINDOW_TITLE = "Add/Remove Friends"; | 4637 | const QString FRIENDS_WINDOW_TITLE = "Add/Remove Friends"; |
| 4617 | const QString FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends"; | 4638 | const QString FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends"; |