From 695eb5c41c4a532a2613c7cf3732fe488892f8e8 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Wed, 11 Jun 2014 21:08:26 +0100 Subject: [PATCH] refs #246 reordered CContextNetwork constructor to keep related things close together --- src/blackcore/context_network_impl.cpp | 38 ++++++++++++-------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/blackcore/context_network_impl.cpp b/src/blackcore/context_network_impl.cpp index 7d1e2eb32..5ef0a3ac8 100644 --- a/src/blackcore/context_network_impl.cpp +++ b/src/blackcore/context_network_impl.cpp @@ -39,26 +39,6 @@ namespace BlackCore // 1. Init by "network driver" this->m_network = new CNetworkVatlib(this); - - // 2. Init VATSIM bookings - this->m_vatsimBookingReader = new CVatsimBookingReader(this->getRuntime()->getIContextSettings()->getNetworkSettings().getBookingServiceUrl(), this); - this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CContextNetwork::psReceivedBookings); - this->m_vatsimBookingReader->read(); // first read - this->m_vatsimBookingReader->setInterval(180 * 1000); - - // 3. VATSIM data file - const QStringList dataFileUrls = { "http://info.vroute.net/vatsim-data.txt" }; - this->m_vatsimDataFileReader = new CVatsimDataFileReader(dataFileUrls, this); - this->connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CContextNetwork::psDataFileRead); - this->m_vatsimDataFileReader->read(); // first read - this->m_vatsimDataFileReader->setInterval(90 * 1000); - - // 4. Update timer for data (network data such as frequency) - this->m_dataUpdateTimer = new QTimer(this); - this->connect(this->m_dataUpdateTimer, &QTimer::timeout, this, &CContextNetwork::requestDataUpdates); - this->m_dataUpdateTimer->start(30 * 1000); - - // 5. connect signals and slots this->connect(this->m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::psFsdConnectionStatusChanged); this->connect(this->m_network, &INetwork::atcPositionUpdate, this, &CContextNetwork::psFsdAtcPositionUpdate); this->connect(this->m_network, &INetwork::atisReplyReceived, this, &CContextNetwork::psFsdAtisReceived); @@ -77,6 +57,24 @@ namespace BlackCore this->connect(this->m_network, &INetwork::customPacketReceived, this, &CContextNetwork::psFsdCustomPacketReceived); this->connect(this->m_network, &INetwork::serverReplyReceived, this, &CContextNetwork::psFsdServerReplyReceived); + // 2. VATSIM bookings + this->m_vatsimBookingReader = new CVatsimBookingReader(this->getRuntime()->getIContextSettings()->getNetworkSettings().getBookingServiceUrl(), this); + this->connect(this->m_vatsimBookingReader, &CVatsimBookingReader::dataRead, this, &CContextNetwork::psReceivedBookings); + this->m_vatsimBookingReader->read(); // first read + this->m_vatsimBookingReader->setInterval(180 * 1000); + + // 3. VATSIM data file + const QStringList dataFileUrls = { "http://info.vroute.net/vatsim-data.txt" }; + this->m_vatsimDataFileReader = new CVatsimDataFileReader(dataFileUrls, this); + this->connect(this->m_vatsimDataFileReader, &CVatsimDataFileReader::dataRead, this, &CContextNetwork::psDataFileRead); + this->m_vatsimDataFileReader->read(); // first read + this->m_vatsimDataFileReader->setInterval(90 * 1000); + + // 4. Update timer for data (network data such as frequency) + this->m_dataUpdateTimer = new QTimer(this); + this->connect(this->m_dataUpdateTimer, &QTimer::timeout, this, &CContextNetwork::requestDataUpdates); + this->m_dataUpdateTimer->start(30 * 1000); + // FIXME (MS) conditional increases the number of scenarios which must be considered and continuously tested if (this->getIContextApplication()) {