diff --git a/src/blackcore/airspaceanalyzer.cpp b/src/blackcore/airspaceanalyzer.cpp index f54670282..8d9694fc1 100644 --- a/src/blackcore/airspaceanalyzer.cpp +++ b/src/blackcore/airspaceanalyzer.cpp @@ -24,6 +24,7 @@ #include using namespace BlackMisc; +using namespace BlackMisc::Network; using namespace BlackMisc::Simulation; using namespace BlackMisc::Aviation; using namespace BlackMisc::PhysicalQuantities; @@ -105,15 +106,15 @@ namespace BlackCore m_atcCallsignTimestamps[callsign] = QDateTime::currentMSecsSinceEpoch(); } - void CAirspaceAnalyzer::onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus) + void CAirspaceAnalyzer::onConnectionStatusChanged(CConnectionStatus oldStatus, CConnectionStatus newStatus) { Q_UNUSED(oldStatus); - if (newStatus == INetwork::Disconnected) + if (newStatus.isDisconnected()) { this->clear(); m_updateTimer.stop(); } - else if (newStatus == INetwork::Connected) + else if (newStatus.isConnected()) { m_updateTimer.start(); } diff --git a/src/blackcore/airspaceanalyzer.h b/src/blackcore/airspaceanalyzer.h index 567cca613..782d7675e 100644 --- a/src/blackcore/airspaceanalyzer.h +++ b/src/blackcore/airspaceanalyzer.h @@ -13,6 +13,7 @@ #include "blackcore/blackcoreexport.h" #include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/simulation/airspaceaircraftsnapshot.h" #include "blackmisc/simulation/ownaircraftprovider.h" #include "blackmisc/simulation/remoteaircraftprovider.h" @@ -109,7 +110,7 @@ namespace BlackCore const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range); //! Connection status of network changed - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus); + void onConnectionStatusChanged(BlackMisc::Network::CConnectionStatus oldStatus, BlackMisc::Network::CConnectionStatus newStatus); //! Network position update void onNetworkPositionUpdate(const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CTransponder &transponder); diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index f2b177d0a..0038e9325 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -1220,22 +1220,10 @@ namespace BlackCore ); } - void CAirspaceMonitor::onConnectionStatusChanged(INetwork::ConnectionStatus oldStatus, INetwork::ConnectionStatus newStatus) + void CAirspaceMonitor::onConnectionStatusChanged(CConnectionStatus oldStatus, CConnectionStatus newStatus) { Q_UNUSED(oldStatus); - switch (newStatus) - { - case INetwork::Connected: - break; - case INetwork::Disconnected: - case INetwork::DisconnectedError: - case INetwork::DisconnectedLost: - case INetwork::DisconnectedFailed: - this->clear(); - break; - default: - break; - } + if (newStatus.isDisconnected()) { clear(); } } void CAirspaceMonitor::onPilotDisconnected(const CCallsign &callsign) diff --git a/src/blackcore/airspacemonitor.h b/src/blackcore/airspacemonitor.h index f095876ed..a1b8a357a 100644 --- a/src/blackcore/airspacemonitor.h +++ b/src/blackcore/airspacemonitor.h @@ -386,7 +386,7 @@ namespace BlackCore void onReceivedVatsimDataFile(); void onAircraftConfigReceived(const BlackMisc::Aviation::CCallsign &callsign, const QJsonObject &jsonObject, qint64 currentOffsetMs); void onAircraftInterimUpdateReceived(const BlackMisc::Aviation::CAircraftSituation &situation); - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus oldStatus, BlackCore::INetwork::ConnectionStatus newStatus); + void onConnectionStatusChanged(BlackMisc::Network::CConnectionStatus oldStatus, BlackMisc::Network::CConnectionStatus newStatus); }; } // namespace diff --git a/src/blackcore/context/contextnetwork.h b/src/blackcore/context/contextnetwork.h index d5280a705..a3cc745b3 100644 --- a/src/blackcore/context/contextnetwork.h +++ b/src/blackcore/context/contextnetwork.h @@ -25,6 +25,7 @@ #include "blackmisc/aviation/callsignset.h" #include "blackmisc/aviation/comsystem.h" #include "blackmisc/aviation/flightplan.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/network/clientlist.h" #include "blackmisc/network/server.h" #include "blackmisc/network/serverlist.h" @@ -152,7 +153,7 @@ namespace BlackCore //! Connection status changed //! \sa IContextNetwork::connectedServerChanged - void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void connectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! The connected server has been changed //! \remark can also be used to determine if the ecosystem has been changed diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index 383b9a560..adc0ed360 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -583,20 +583,11 @@ namespace BlackCore return sApp->getWebDataServices()->getVatsimVoiceServers(); } - void CContextNetwork::onFsdConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to) + void CContextNetwork::onFsdConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { - if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to; } - const INetwork::ConnectionStatus fromOld = m_currentStatus; // own status cached - m_currentStatus = to; + // if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to; } - if (fromOld == INetwork::Disconnecting) - { - // remark: vatlib does not know disconnecting. In vatlib's terminating connection method - // state Disconnecting is sent manually. We fix the vatlib state here regarding disconnecting - from = INetwork::Disconnecting; - } - - if (to == INetwork::Disconnected) + if (to.isDisconnected()) { // make sure airspace is really cleaned up Q_ASSERT(m_airspace); @@ -604,7 +595,7 @@ namespace BlackCore } // send 1st position - if (to == INetwork::Connected) + if (to.isConnected()) { CLogMessage(this).info(u"Connected, own aircraft %1") << this->ownAircraft().getCallsignAsString(); @@ -617,14 +608,7 @@ namespace BlackCore // send as message static const QString chgMsg("Connection status changed from '%1' to '%2'"); - if (to == INetwork::DisconnectedError) - { - CLogMessage(this).error(chgMsg) << INetwork::connectionStatusToString(from) << INetwork::connectionStatusToString(to); - } - else - { - CLogMessage(this).info(chgMsg) << INetwork::connectionStatusToString(from) << INetwork::connectionStatusToString(to); - } + CLogMessage(this).info(chgMsg) << from.toQString() << to.toQString(); // send as own signal emit this->connectionStatusChanged(from, to); diff --git a/src/blackcore/context/contextnetworkimpl.h b/src/blackcore/context/contextnetworkimpl.h index 72679eadb..6e8d322b6 100644 --- a/src/blackcore/context/contextnetworkimpl.h +++ b/src/blackcore/context/contextnetworkimpl.h @@ -317,7 +317,7 @@ namespace BlackCore void onChangedAtisReceived(const BlackMisc::Aviation::CCallsign &callsign); //! Connection status changed - void onFsdConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onFsdConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Relay to partner callsign void createRelayMessageToPartnerCallsign(const BlackMisc::Network::CTextMessage &textMessage, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackMisc::Network::CTextMessageList &relayedMessages); diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 8d930a371..d4e582c56 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -796,11 +796,11 @@ namespace BlackCore m_simulatorPlugin.second->changeRemoteAircraftEnabled(aircraft); } - void CContextSimulator::xCtxNetworkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CContextSimulator::xCtxNetworkConnectionStatusChanged(CConnectionStatus from, CConnectionStatus to) { Q_UNUSED(from); BLACK_VERIFY_X(this->getIContextNetwork(), Q_FUNC_INFO, "Missing network context"); - if (to == INetwork::Connected && this->getIContextNetwork()) + if (to.isConnected() && this->getIContextNetwork()) { m_networkSessionId = this->getIContextNetwork()->getConnectedServer().getServerSessionId(false); if (m_simulatorPlugin.second) // check in case the plugin has been unloaded @@ -808,7 +808,7 @@ namespace BlackCore m_simulatorPlugin.second->setFlightNetworkConnected(true); } } - else if (INetwork::isDisconnectedStatus(to)) + else if (to.isDisconnected()) { m_networkSessionId.clear(); m_aircraftMatcher.clearMatchingStatistics(); diff --git a/src/blackcore/context/contextsimulatorimpl.h b/src/blackcore/context/contextsimulatorimpl.h index 0eb1fb401..555d3d325 100644 --- a/src/blackcore/context/contextsimulatorimpl.h +++ b/src/blackcore/context/contextsimulatorimpl.h @@ -18,7 +18,7 @@ #include "blackcore/aircraftmatcher.h" #include "blackcore/blackcoreexport.h" #include "blackcore/weathermanager.h" -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/simulation/data/modelcaches.h" #include "blackmisc/simulation/settings/modelmatchersettings.h" #include "blackmisc/simulation/settings/simulatorsettings.h" @@ -205,7 +205,7 @@ namespace BlackCore void xCtxChangedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); //! Network connection status - void xCtxNetworkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to); + void xCtxNetworkConnectionStatusChanged(BlackMisc::Network::CConnectionStatus from, BlackMisc::Network::CConnectionStatus to); //! Update simulator cockpit from context, because someone else has changed cockpit (e.g. GUI, 3rd party) void xCtxUpdateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator); diff --git a/src/blackgui/components/aircraftcomponent.cpp b/src/blackgui/components/aircraftcomponent.cpp index b8eee342a..5c9fb35fd 100644 --- a/src/blackgui/components/aircraftcomponent.cpp +++ b/src/blackgui/components/aircraftcomponent.cpp @@ -17,7 +17,6 @@ #include "blackcore/context/contextnetwork.h" #include "blackcore/context/contextsimulator.h" #include "blackcore/context/contextownaircraft.h" -#include "blackcore/network.h" #include "blackmisc/network/server.h" #include "blackmisc/network/fsdsetup.h" #include "ui_aircraftcomponent.h" @@ -163,14 +162,14 @@ namespace BlackGui this->tabBar()->setTabText(ap, aps); } - void CAircraftComponent::onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to) + void CAircraftComponent::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (INetwork::isDisconnectedStatus(to)) + if (to.isDisconnected()) { ui->tvp_AircraftInRange->clear(); } - else if (INetwork::isConnectedStatus(to)) + else if (to.isConnected()) { if (sGui && sGui->getIContextNetwork()) { diff --git a/src/blackgui/components/aircraftcomponent.h b/src/blackgui/components/aircraftcomponent.h index d5368d988..69bca4201 100644 --- a/src/blackgui/components/aircraftcomponent.h +++ b/src/blackgui/components/aircraftcomponent.h @@ -14,7 +14,7 @@ #include "blackgui/settings/viewupdatesettings.h" #include "blackgui/enablefordockwidgetinfoarea.h" #include "blackgui/blackguiexport.h" -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -86,7 +86,7 @@ namespace BlackGui void onRowCountChanged(int count, bool withFilter); //! Connection status has been changed - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Settings have been changed void onSettingsChanged(); diff --git a/src/blackgui/components/aircraftpartshistory.cpp b/src/blackgui/components/aircraftpartshistory.cpp index 8a2371985..f58cb8708 100644 --- a/src/blackgui/components/aircraftpartshistory.cpp +++ b/src/blackgui/components/aircraftpartshistory.cpp @@ -23,6 +23,7 @@ using namespace BlackMisc; using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; using namespace BlackCore; using namespace BlackCore::Context; @@ -163,10 +164,10 @@ namespace BlackGui } } - void CAircraftPartsHistory::connectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CAircraftPartsHistory::connectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (to == INetwork::Connected || to == INetwork::Disconnected) + if (to.isConnected() || to.isDisconnected()) { this->initGui(); } diff --git a/src/blackgui/components/aircraftpartshistory.h b/src/blackgui/components/aircraftpartshistory.h index 72b167efa..98a036784 100644 --- a/src/blackgui/components/aircraftpartshistory.h +++ b/src/blackgui/components/aircraftpartshistory.h @@ -11,11 +11,11 @@ #ifndef BLACKGUI_COMPONENT_AIRCRAFTPARTSHISTORY_H #define BLACKGUI_COMPONENT_AIRCRAFTPARTSHISTORY_H -#include "blackcore/network.h" #include #include #include #include +#include "blackmisc/network/connectionstatus.h" namespace Ui { class CAircraftPartsHistory; } namespace BlackGui @@ -65,7 +65,7 @@ namespace BlackGui void toggleHistoryEnabled(bool enabled); //! Connection status changed - void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void connectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); }; } // ns } // ns diff --git a/src/blackgui/components/atcbuttoncomponent.cpp b/src/blackgui/components/atcbuttoncomponent.cpp index 2d266a23f..910ec6f94 100644 --- a/src/blackgui/components/atcbuttoncomponent.cpp +++ b/src/blackgui/components/atcbuttoncomponent.cpp @@ -19,6 +19,7 @@ using namespace BlackMisc; using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; using namespace BlackCore; using namespace BlackCore::Context; @@ -115,10 +116,10 @@ namespace BlackGui this->updateStations(); } - void CAtcButtonComponent::onConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CAtcButtonComponent::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (INetwork::isDisconnectedStatus(to)) + if (to.isDisconnected()) { this->setVisible(false); } diff --git a/src/blackgui/components/atcbuttoncomponent.h b/src/blackgui/components/atcbuttoncomponent.h index 74f1330bf..3f2b005a1 100644 --- a/src/blackgui/components/atcbuttoncomponent.h +++ b/src/blackgui/components/atcbuttoncomponent.h @@ -12,6 +12,7 @@ #define BLACKGUI_COMPONENTS_ATCBUTTONCOMPONENT_H #include "blackcore/context/contextnetwork.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -62,7 +63,7 @@ namespace BlackGui void onChangedAtcStations(); //! Connection status did change - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Button has been clicked void onButtonClicked(); diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index 716a71f5e..7f0229eaa 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -47,6 +47,7 @@ using namespace BlackGui::Views; using namespace BlackGui::Settings; using namespace BlackMisc; using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; using namespace BlackMisc::PhysicalQuantities; using namespace BlackMisc::Weather; using namespace BlackCore; @@ -338,16 +339,16 @@ namespace BlackGui this->update(); } - void CAtcStationComponent::connectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CAtcStationComponent::connectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (INetwork::isConnectedStatus(to)) + if (to.isConnected()) { ui->tvp_AtcStationsOnline->clear(); this->updateTreeView(); m_updateTimer.start(); } - else if (INetwork::isDisconnectedStatus(to)) + else if (to.isDisconnected()) { m_updateTimer.stop(); this->clearOnlineViews(); diff --git a/src/blackgui/components/atcstationcomponent.h b/src/blackgui/components/atcstationcomponent.h index d002d8523..733411716 100644 --- a/src/blackgui/components/atcstationcomponent.h +++ b/src/blackgui/components/atcstationcomponent.h @@ -15,11 +15,11 @@ #include "blackgui/settings/atcstationssettings.h" #include "blackgui/overlaymessagesframe.h" #include "blackgui/blackguiexport.h" -#include "blackcore/network.h" #include "blackmisc/aviation/atcstation.h" #include "blackmisc/aviation/comsystem.h" #include "blackmisc/pq/frequency.h" #include "blackmisc/identifiable.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -121,7 +121,7 @@ namespace BlackGui void changedAtcStationsOnline(); //! Connection status has been changed - void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void connectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Request dummy ATC online stations void testCreateDummyOnlineAtcStations(int number); diff --git a/src/blackgui/components/callsigncompleter.cpp b/src/blackgui/components/callsigncompleter.cpp index 390f4508b..263f3c40c 100644 --- a/src/blackgui/components/callsigncompleter.cpp +++ b/src/blackgui/components/callsigncompleter.cpp @@ -16,6 +16,7 @@ using namespace BlackMisc; using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; using namespace BlackCore; using namespace BlackCore::Context; @@ -106,10 +107,10 @@ namespace BlackGui this->updateCallsignsFromContext(); } - void CCallsignCompleter::onChangedConnectionStatus(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CCallsignCompleter::onChangedConnectionStatus(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - const bool connected = (INetwork::Connected == to); + const bool connected = to.isConnected(); ui->led_Status->setOn(connected); ui->le_Callsign->clear(); ui->le_Callsign->setEnabled(connected); diff --git a/src/blackgui/components/callsigncompleter.h b/src/blackgui/components/callsigncompleter.h index 68050164d..8f9261444 100644 --- a/src/blackgui/components/callsigncompleter.h +++ b/src/blackgui/components/callsigncompleter.h @@ -15,7 +15,7 @@ #include "blackgui/sharedstringlistcompleter.h" #include "blackmisc/digestsignal.h" #include "blackmisc/aviation/callsignset.h" -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include #include #include @@ -69,7 +69,7 @@ namespace BlackGui void updateCallsignsFromContext(); void onEditingFinished(); void onChangedAircraftInRange(); - void onChangedConnectionStatus(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onChangedConnectionStatus(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); bool isValidKnownCallsign(const QString &callsignString) const; //! Shared completer data diff --git a/src/blackgui/components/infobarstatuscomponent.cpp b/src/blackgui/components/infobarstatuscomponent.cpp index 978c939d2..46561b81e 100644 --- a/src/blackgui/components/infobarstatuscomponent.cpp +++ b/src/blackgui/components/infobarstatuscomponent.cpp @@ -38,6 +38,7 @@ using namespace BlackCore; using namespace BlackCore::Context; using namespace BlackGui; using namespace BlackMisc; +using namespace BlackMisc::Network; namespace BlackGui { @@ -186,22 +187,19 @@ namespace BlackGui this->onMapperReady(); } - void CInfoBarStatusComponent::onNetworkConnectionChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CInfoBarStatusComponent::onNetworkConnectionChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - switch (to) + switch (to.getConnectionStatus()) { - case INetwork::Disconnected: - case INetwork::DisconnectedError: - case INetwork::DisconnectedFailed: - case INetwork::DisconnectedLost: + case CConnectionStatus::Disconnected: ui->led_Network->setOn(false); break; - case INetwork::Connected: + case CConnectionStatus::Connected: ui->led_Network->setOn(true); ui->led_Network->setOnToolTip(u"Connected: " % sGui->getIContextNetwork()->getConnectedServer().getName()); break; - case INetwork::Connecting: + case CConnectionStatus::Connecting: ui->led_Network->setTriStateColor(CLedWidget::Yellow); break; default: diff --git a/src/blackgui/components/infobarstatuscomponent.h b/src/blackgui/components/infobarstatuscomponent.h index b0a720b64..b6f56f155 100644 --- a/src/blackgui/components/infobarstatuscomponent.h +++ b/src/blackgui/components/infobarstatuscomponent.h @@ -12,9 +12,9 @@ #define BLACKGUI_INFOBARSTATUSCOMPONENT_H #include "blackcore/actionbind.h" -#include "blackcore/network.h" #include "blackgui/blackguiexport.h" #include "blackmisc/input/actionhotkeydefs.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -72,7 +72,7 @@ namespace BlackGui void onSimulatorStatusChanged(int status); //! Network connection has been changed - void onNetworkConnectionChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onNetworkConnectionChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Context menu requested void onCustomAudioContextMenuRequested(const QPoint &position); diff --git a/src/blackgui/components/logincomponent.cpp b/src/blackgui/components/logincomponent.cpp index 20b2028c1..f021042c2 100644 --- a/src/blackgui/components/logincomponent.cpp +++ b/src/blackgui/components/logincomponent.cpp @@ -22,13 +22,13 @@ #include "blackcore/context/contextsimulator.h" #include "blackcore/webdataservices.h" #include "blackcore/data/globalsetup.h" -#include "blackcore/network.h" #include "blackcore/simulator.h" #include "blackmisc/aviation/aircrafticaocode.h" #include "blackmisc/aviation/airlineicaocode.h" #include "blackmisc/aviation/airporticaocode.h" #include "blackmisc/icons.h" #include "blackmisc/logmessage.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/network/entityflags.h" #include "blackmisc/network/serverlist.h" #include "blackmisc/simulation/simulatorinternals.h" @@ -445,10 +445,10 @@ namespace BlackGui } } - void CLoginComponent::onNetworkStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CLoginComponent::onNetworkStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (to != INetwork::Connected) { return; } + if (to != CConnectionStatus::Connected) { return; } this->setUiLoginState(true); this->updateGui(); diff --git a/src/blackgui/components/logincomponent.h b/src/blackgui/components/logincomponent.h index 5d15cad3c..0d83710af 100644 --- a/src/blackgui/components/logincomponent.h +++ b/src/blackgui/components/logincomponent.h @@ -20,6 +20,7 @@ #include "blackmisc/simulation/data/lastmodel.h" #include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/aviation/callsign.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/network/data/lastserver.h" #include "blackmisc/network/entityflags.h" #include "blackmisc/network/server.h" @@ -225,7 +226,7 @@ namespace BlackGui void onSimulatorStatusChanged(int status); //! Network status has changed - void onNetworkStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onNetworkStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Tab widget (server) changed void onServerTabWidgetChanged(int index); diff --git a/src/blackgui/components/logindialog.cpp b/src/blackgui/components/logindialog.cpp index 0b5269242..55d22f92b 100644 --- a/src/blackgui/components/logindialog.cpp +++ b/src/blackgui/components/logindialog.cpp @@ -12,6 +12,7 @@ #include "blackgui/guiapplication.h" #include "blackcore/context/contextnetwork.h" +using namespace BlackMisc::Network; using namespace BlackCore; using namespace BlackCore::Context; @@ -90,10 +91,10 @@ namespace BlackGui this->close(); } - void CLoginDialog::onNetworkStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to) + void CLoginDialog::onNetworkStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (to == INetwork::Disconnected || to == INetwork::Connected) + if (to.isDisconnected() || to.isConnected()) { this->init(); } diff --git a/src/blackgui/components/logindialog.h b/src/blackgui/components/logindialog.h index 2accb6021..7e934ca40 100644 --- a/src/blackgui/components/logindialog.h +++ b/src/blackgui/components/logindialog.h @@ -12,8 +12,8 @@ #define BLACKGUI_COMPONENTS_LOGINDIALOG_H #include "blackgui/blackguiexport.h" -#include "blackcore/network.h" #include "blackmisc/aviation/airport.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -49,7 +49,7 @@ namespace BlackGui void onLoginOrLogoffCancelled(); void onLoginOrLogoffSuccessful(); void onRequestNetworkSettings(); - void onNetworkStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onNetworkStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); QScopedPointer ui; }; diff --git a/src/blackgui/components/loginoverviewcomponent.cpp b/src/blackgui/components/loginoverviewcomponent.cpp index 77343026c..403180d7c 100644 --- a/src/blackgui/components/loginoverviewcomponent.cpp +++ b/src/blackgui/components/loginoverviewcomponent.cpp @@ -22,7 +22,6 @@ #include "blackcore/context/contextnetwork.h" #include "blackcore/data/globalsetup.h" #include "blackcore/webdataservices.h" -#include "blackcore/network.h" #include "blackcore/simulator.h" #include "blackmisc/simulation/simulatorinternals.h" #include "blackmisc/simulation/aircraftmodel.h" diff --git a/src/blackgui/components/mainkeypadareacomponent.cpp b/src/blackgui/components/mainkeypadareacomponent.cpp index 1cdea0745..078dadf3d 100644 --- a/src/blackgui/components/mainkeypadareacomponent.cpp +++ b/src/blackgui/components/mainkeypadareacomponent.cpp @@ -24,6 +24,7 @@ using namespace BlackMisc; using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; using namespace BlackMisc::Simulation; using namespace BlackCore; using namespace BlackCore::Context; @@ -154,12 +155,12 @@ namespace BlackGui } } - void CMainKeypadAreaComponent::connectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CMainKeypadAreaComponent::connectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); // Connected button - if (to == INetwork::Connected) + if (to.isConnected()) { ui->pb_Connect->setText("Discon."); // full terms some too wide ui->pb_Connect->setChecked(true); @@ -274,7 +275,7 @@ namespace BlackGui if (sGui->getIContextNetwork() && sGui->getIContextNetwork()->isConnected()) { - this->connectionStatusChanged(INetwork::Connected, INetwork::Connected); + this->connectionStatusChanged(CConnectionStatus::Connected, CConnectionStatus::Connected); } } } // namespace diff --git a/src/blackgui/components/mainkeypadareacomponent.h b/src/blackgui/components/mainkeypadareacomponent.h index 59f68df82..6b41f53b7 100644 --- a/src/blackgui/components/mainkeypadareacomponent.h +++ b/src/blackgui/components/mainkeypadareacomponent.h @@ -11,10 +11,10 @@ #ifndef BLACKGUI_MAINKEYPADAREACOMPONENT_H #define BLACKGUI_MAINKEYPADAREACOMPONENT_H -#include "blackcore/network.h" #include "blackgui/blackguiexport.h" #include "blackgui/components/maininfoareacomponent.h" #include "blackmisc/identifier.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -74,7 +74,7 @@ namespace BlackGui void buttonSelected(); //! \copydoc BlackCore::Context::IContextNetwork::connectionStatusChanged - void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void connectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! \copydoc BlackCore::Context::IContextOwnAircraft::changedAircraftCockpit void ownAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator); diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index 4b4a8a564..1241816b5 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -17,7 +17,7 @@ #include "blackgui/views/viewbase.h" #include "blackcore/context/contextnetwork.h" #include "blackcore/context/contextsimulator.h" -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/simulation/simulatedaircraftlist.h" #include "blackmisc/simulation/aircraftmodel.h" @@ -449,15 +449,15 @@ namespace BlackGui this->tokenBucketUpdateAircraft(aircraft); } - void CMappingComponent::onConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CMappingComponent::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (INetwork::isDisconnectedStatus(to)) + if (to.isDisconnected()) { this->tokenBucketUpdate(); ui->tvp_RenderedAircraft->clear(); } - else if (INetwork::isConnectedStatus(to)) + else if (to.isConnected()) { if (sGui && sGui->getIContextNetwork()) { @@ -564,15 +564,15 @@ namespace BlackGui m_updateTimer.setInterval(ms); } - void CMappingComponent::onNetworkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CMappingComponent::onNetworkConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (INetwork::isDisconnectedStatus(to)) + if (to.isDisconnected()) { ui->tvp_RenderedAircraft->clear(); m_updateTimer.stop(); } - else if (INetwork::isConnectedStatus(to)) + else if (to.isConnected()) { ui->comp_SimulatorSelector->setReadOnly(true); m_updateTimer.start(); diff --git a/src/blackgui/components/mappingcomponent.h b/src/blackgui/components/mappingcomponent.h index ef2638f5f..44bbefc51 100644 --- a/src/blackgui/components/mappingcomponent.h +++ b/src/blackgui/components/mappingcomponent.h @@ -15,11 +15,11 @@ #include "blackgui/overlaymessagesframe.h" #include "blackgui/enablefordockwidgetinfoarea.h" #include "blackgui/blackguiexport.h" -#include "blackcore/network.h" #include "blackmisc/tokenbucket.h" #include "blackmisc/identifiable.h" #include "blackmisc/identifier.h" #include "blackmisc/propertyindex.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/simulation/aircraftmodellist.h" #include "blackmisc/variant.h" @@ -128,7 +128,7 @@ namespace BlackGui void onRemoteAircraftModelChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator); //! Connection status has been changed - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Widget changed void onTabWidgetChanged(int index); @@ -158,7 +158,7 @@ namespace BlackGui void settingsChanged(); //! Connection status has been changed - void onNetworkConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onNetworkConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Update simulated aircraft view void updateRenderedAircraftView(bool forceUpdate = false); diff --git a/src/blackgui/components/modelmatcherlogenable.cpp b/src/blackgui/components/modelmatcherlogenable.cpp index 8a7f506d5..594fa414d 100644 --- a/src/blackgui/components/modelmatcherlogenable.cpp +++ b/src/blackgui/components/modelmatcherlogenable.cpp @@ -17,6 +17,7 @@ using namespace BlackCore; using namespace BlackCore::Context; +using namespace BlackMisc::Network; using namespace BlackMisc::Simulation; namespace BlackGui @@ -119,10 +120,10 @@ namespace BlackGui this->initGui(); } - void CModelMatcherLogEnable::connectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CModelMatcherLogEnable::connectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (to == INetwork::Connected || to == INetwork::Disconnected) + if (to.isConnected() || to.isDisconnected()) { this->initGui(); } diff --git a/src/blackgui/components/modelmatcherlogenable.h b/src/blackgui/components/modelmatcherlogenable.h index 961c0b596..7b7ce6b77 100644 --- a/src/blackgui/components/modelmatcherlogenable.h +++ b/src/blackgui/components/modelmatcherlogenable.h @@ -11,7 +11,7 @@ #ifndef BLACKGUI_COMPONENTS_MODELMATCHERLOGENABLE_H #define BLACKGUI_COMPONENTS_MODELMATCHERLOGENABLE_H -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -54,7 +54,7 @@ namespace BlackGui void valuesChanged(); //! Connection status has been changed - void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void connectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); }; } // ns } // ns diff --git a/src/blackgui/components/networkdetailscomponent.h b/src/blackgui/components/networkdetailscomponent.h index 762a9beb4..37c3b1cab 100644 --- a/src/blackgui/components/networkdetailscomponent.h +++ b/src/blackgui/components/networkdetailscomponent.h @@ -22,6 +22,7 @@ #include "blackmisc/audio/voicesetup.h" #include "blackmisc/settingscache.h" #include "blackmisc/datacache.h" +#include "blackmisc/network/connectionstatus.h" namespace Ui { class CNetworkDetailsComponent; } namespace BlackGui diff --git a/src/blackgui/components/usercomponent.cpp b/src/blackgui/components/usercomponent.cpp index 42acf3d8e..9110e5474 100644 --- a/src/blackgui/components/usercomponent.cpp +++ b/src/blackgui/components/usercomponent.cpp @@ -12,7 +12,7 @@ #include "blackgui/views/clientview.h" #include "blackgui/views/userview.h" #include "blackcore/context/contextnetwork.h" -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/network/userlist.h" #include "ui_usercomponent.h" @@ -98,16 +98,16 @@ namespace BlackGui this->tabBar()->setTabText(ic, c); } - void CUserComponent::onConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CUserComponent::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); - if (INetwork::isDisconnectedStatus(to)) + if (to.isDisconnected()) { ui->tvp_AllUsers->clear(); ui->tvp_Clients->clear(); m_updateTimer.stop(); } - else if (INetwork::isConnectedStatus(to)) + else if (to.isConnected()) { m_updateTimer.start(); } diff --git a/src/blackgui/components/usercomponent.h b/src/blackgui/components/usercomponent.h index ea2e0f03d..aad882362 100644 --- a/src/blackgui/components/usercomponent.h +++ b/src/blackgui/components/usercomponent.h @@ -14,7 +14,8 @@ #include "blackgui/enablefordockwidgetinfoarea.h" #include "blackgui/blackguiexport.h" #include "blackgui/settings/viewupdatesettings.h" -#include "blackcore/network.h" +#include "blackmisc/aviation/callsign.h" +#include "blackmisc/network/connectionstatus.h" #include #include @@ -59,7 +60,7 @@ namespace BlackGui void onCountChanged(int count, bool withFilter); //! Connection status - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); //! Settings have been changed void onSettingsChanged(); diff --git a/src/blackgui/loginmodebuttons.h b/src/blackgui/loginmodebuttons.h index 5b7aba55b..0f827cd97 100644 --- a/src/blackgui/loginmodebuttons.h +++ b/src/blackgui/loginmodebuttons.h @@ -13,6 +13,7 @@ #include "blackcore/network.h" #include "blackgui/blackguiexport.h" +#include "blackmisc/network/connectionstatus.h" #include #include #include diff --git a/src/blackmisc/network/connectionstatus.cpp b/src/blackmisc/network/connectionstatus.cpp new file mode 100644 index 000000000..3033a9f73 --- /dev/null +++ b/src/blackmisc/network/connectionstatus.cpp @@ -0,0 +1,32 @@ +/* Copyright (C) 2019 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, + * or distributed except according to the terms contained in the LICENSE file. + */ + +#include "blackmisc/network/connectionstatus.h" + +namespace BlackMisc +{ + namespace Network + { + QString CConnectionStatus::convertToQString(bool i18n) const + { + Q_UNUSED(i18n); + + switch (m_connectionStatus) + { + case Connected: return QStringLiteral("Connected"); + case Connecting: return QStringLiteral("Connecting"); + case Disconnecting: return QStringLiteral("Disconnecting"); + case Disconnected: return QStringLiteral("Disconnected"); + } + + Q_UNREACHABLE(); + return {}; + } + + } // namespace +} // namespace diff --git a/src/blackmisc/network/connectionstatus.h b/src/blackmisc/network/connectionstatus.h new file mode 100644 index 000000000..6fce25042 --- /dev/null +++ b/src/blackmisc/network/connectionstatus.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2019 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated, + * or distributed except according to the terms contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKMISC_NETWORK_CONNECTIONSTATUS_H +#define BLACKMISC_NETWORK_CONNECTIONSTATUS_H + +#include "blackmisc/blackmiscexport.h" +#include "blackmisc/valueobject.h" + +namespace BlackMisc +{ + namespace Network + { + //! Value object encapsulating information about a connection status + class BLACKMISC_EXPORT CConnectionStatus : public CValueObject + { + public: + //! Connection Status + enum ConnectionStatus + { + Connected, + Connecting, + Disconnecting, + Disconnected + }; + + //! Default constructor. + CConnectionStatus() = default; + + //! Constructor + CConnectionStatus(ConnectionStatus status) : m_connectionStatus(status) {} + + bool isConnected() const { return m_connectionStatus == Connected; } + + bool isConnecting() const { return m_connectionStatus == Connecting; } + + bool isDisconnecting() const { return m_connectionStatus == Disconnecting; } + + bool isDisconnected() const { return m_connectionStatus == Disconnected; } + + //! Get status + ConnectionStatus getConnectionStatus() const { return m_connectionStatus; } + + //! Set status + void setConnectionStatus(ConnectionStatus status) { m_connectionStatus = status; } + + //! \copydoc BlackMisc::Mixin::String::toQString + QString convertToQString(bool i18n = false) const; + + private: + ConnectionStatus m_connectionStatus = Disconnected; + + BLACK_METACLASS( + CConnectionStatus, + BLACK_METAMEMBER(connectionStatus) + ); + }; + } // namespace +} // namespace + +Q_DECLARE_METATYPE(BlackMisc::Network::CConnectionStatus) + +#endif // guard diff --git a/src/blackmisc/network/network.h b/src/blackmisc/network/network.h index e33e0a296..117ce4b1a 100644 --- a/src/blackmisc/network/network.h +++ b/src/blackmisc/network/network.h @@ -19,6 +19,7 @@ #include "blackmisc/network/authenticateduser.h" #include "blackmisc/network/client.h" #include "blackmisc/network/clientlist.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/network/ecosystem.h" #include "blackmisc/network/ecosystemlist.h" #include "blackmisc/network/entityflags.h" diff --git a/src/blackmisc/network/registermetadatanetwork.cpp b/src/blackmisc/network/registermetadatanetwork.cpp index f92930b51..b1865d6b5 100644 --- a/src/blackmisc/network/registermetadatanetwork.cpp +++ b/src/blackmisc/network/registermetadatanetwork.cpp @@ -16,6 +16,7 @@ namespace BlackMisc void registerMetadata() { CAuthenticatedUser::registerMetadata(); + CConnectionStatus::registerMetadata(); CClient::registerMetadata(); qDBusRegisterMetaType(); qRegisterMetaTypeStreamOperators(); diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index abae9f5b9..55b5d348d 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -22,7 +22,6 @@ #include "blackcore/context/contextaudio.h" #include "blackcore/context/contextnetwork.h" #include "blackcore/context/contextsimulator.h" -#include "blackcore/network.h" #include "blackcore/webdataservices.h" #include "blackcore/corefacadeconfig.h" #include "blackmisc/audio/notificationsounds.h" @@ -304,17 +303,16 @@ void SwiftGuiStd::onKickedFromNetwork(const QString &kickMessage) // this->displayInOverlayWindow(CStatusMessage(this, CStatusMessage::SeverityError, msgText)); } -void SwiftGuiStd::onConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) +void SwiftGuiStd::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to) { Q_UNUSED(from); this->updateGuiStatusInformation(); // sounds - switch (to) + switch (to.getConnectionStatus()) { - case INetwork::Connected: this->playNotifcationSound(CNotificationSounds::NotificationLogin); break; - case INetwork::Disconnected: this->playNotifcationSound(CNotificationSounds::NotificationLogoff); break; - case INetwork::DisconnectedError: this->playNotifcationSound(CNotificationSounds::NotificationError); break; + case CConnectionStatus::Connected: this->playNotifcationSound(CNotificationSounds::NotificationLogin); break; + case CConnectionStatus::Disconnected: this->playNotifcationSound(CNotificationSounds::NotificationLogoff); break; default: break; } } diff --git a/src/swiftguistandard/swiftguistd.h b/src/swiftguistandard/swiftguistd.h index aee870e93..06442da4c 100644 --- a/src/swiftguistandard/swiftguistd.h +++ b/src/swiftguistandard/swiftguistd.h @@ -25,7 +25,7 @@ #include "blackgui/managedstatusbar.h" #include "blackgui/guiactionbind.h" #include "blackcore/actionbind.h" -#include "blackcore/network.h" +#include "blackmisc/network/connectionstatus.h" #include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/simulation/autopublishdata.h" #include "blackmisc/audio/notificationsounds.h" @@ -209,7 +209,7 @@ private: //! Connection status changed //! \param from old status //! \param to new status - void onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); + void onConnectionStatusChanged(const BlackMisc::Network::CConnectionStatus &from, const BlackMisc::Network::CConnectionStatus &to); // // GUI related functions