46 lines · 1.4 KB · C++
RawDownload
////  ConnectionMonitor.cpp//  interface/src////  Created by Ryan Huffman on 8/4/15.//  Copyright 2015 High Fidelity, Inc.////  Distributed under the Apache License, Version 2.0.//  See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html// #include "ConnectionMonitor.h" #include "ui/DialogsManager.h" #include <NodeList.h>#include <DependencyManager.h>#include <DomainHandler.h>#include <AddressManager.h> static const int DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 5000; void ConnectionMonitor::init() {    // Connect to domain disconnected message    auto nodeList = DependencyManager::get<NodeList>();    const DomainHandler& domainHandler = nodeList->getDomainHandler();    connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &ConnectionMonitor::disconnectedFromDomain);    connect(&domainHandler, &DomainHandler::connectedToDomain, this, &ConnectionMonitor::connectedToDomain);     _timer.setSingleShot(true);    _timer.setInterval(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS);    if (!domainHandler.isConnected()) {        _timer.start();    }     auto dialogsManager = DependencyManager::get<DialogsManager>();    connect(&_timer, &QTimer::timeout, dialogsManager.data(), &DialogsManager::indicateDomainConnectionFailure);} void ConnectionMonitor::disconnectedFromDomain() {    _timer.start();} void ConnectionMonitor::connectedToDomain(const QString& name) {    _timer.stop();}

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