Showing the changes to interface/src/ConnectionMonitor.cpp (1 of 1 file). Show all
Unified · Split
| @@ -18,6 +18,9 @@ · 17 unmodified lines | |||
| 18 | #include <DomainHandler.h> | 18 | #include <DomainHandler.h> |
| 19 | #include <AddressManager.h> | 19 | #include <AddressManager.h> |
| 20 | 20 | ||
| 21 | // Because the connection monitor is created at startup, the time we wait on initial load | ||
| 22 | // should be longer to allow the application to initialize. | ||
| 23 | static const int ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 10000; | ||
| 21 | static const int DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 5000; | 24 | static const int DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 5000; |
| 22 | 25 | ||
| 23 | void ConnectionMonitor::init() { | 26 | void ConnectionMonitor::init() { |
| @@ -28,7 +31,7 @@ void ConnectionMonitor::init() { · 4 unmodified lines | |||
| 28 | connect(&domainHandler, &DomainHandler::connectedToDomain, this, &ConnectionMonitor::connectedToDomain); | 31 | connect(&domainHandler, &DomainHandler::connectedToDomain, this, &ConnectionMonitor::connectedToDomain); |
| 29 | 32 | ||
| 30 | _timer.setSingleShot(true); | 33 | _timer.setSingleShot(true); |
| 31 | _timer.setInterval(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); | 34 | _timer.setInterval(ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); |
| 32 | if (!domainHandler.isConnected()) { | 35 | if (!domainHandler.isConnected()) { |
| 33 | _timer.start(); | 36 | _timer.start(); |
| 34 | } | 37 | } |
| @@ -37,10 +40,13 @@ void ConnectionMonitor::init() { · 2 unmodified lines | |||
| 37 | connect(&_timer, &QTimer::timeout, dialogsManager.data(), &DialogsManager::indicateDomainConnectionFailure); | 40 | connect(&_timer, &QTimer::timeout, dialogsManager.data(), &DialogsManager::indicateDomainConnectionFailure); |
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | void ConnectionMonitor::disconnectedFromDomain() { | 43 | void ConnectionMonitor::startTimer() { |
| 44 | qDebug() << "ConnectionMonitor: Starting timer"; | ||
| 45 | _timer.setInterval(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); | ||
| 41 | _timer.start(); | 46 | _timer.start(); |
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | void ConnectionMonitor::connectedToDomain(const QString& name) { | 49 | void ConnectionMonitor::stopTimer() { |
| 50 | qDebug() << "ConnectionMonitor: Stopping timer"; | ||
| 45 | _timer.stop(); | 51 | _timer.stop(); |
| 46 | } | 52 | } |