mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Replace INetwork::CConnectionStatus with proper value object
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user