mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Ref T89, signal when server (flight network) connects
* server contains the ecosystem * connect server signal with web data services (so ecosystem is available)
This commit is contained in:
@@ -147,8 +147,14 @@ namespace BlackCore
|
||||
void kicked(const QString &kickMessage);
|
||||
|
||||
//! Connection status changed
|
||||
//! \sa IContextNetwork::connectedServerChanged
|
||||
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||
|
||||
//! The connected server has been changed
|
||||
//! \remark can also be used to determine if the ecosystem has been changed
|
||||
//! \sa BlackMisc::Network::CServer::getEcosysstem
|
||||
void connectedServerChanged(const BlackMisc::Network::CServer &server);
|
||||
|
||||
//! Text messages received (also private chat messages, radio channel messages)
|
||||
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BlackCore
|
||||
|
||||
// 1. Init by "network driver"
|
||||
m_network = new CNetworkVatlib(this->getRuntime()->getCContextOwnAircraft(), this);
|
||||
connect(m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::fsdConnectionStatusChanged);
|
||||
connect(m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::onFsdConnectionStatusChanged);
|
||||
connect(m_network, &INetwork::kicked, this, &CContextNetwork::kicked);
|
||||
connect(m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::textMessagesReceived);
|
||||
connect(m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::checkForSupervisiorTextMessage);
|
||||
@@ -396,10 +396,10 @@ namespace BlackCore
|
||||
return sApp->getWebDataServices()->getVatsimVoiceServers();
|
||||
}
|
||||
|
||||
void CContextNetwork::fsdConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
||||
void CContextNetwork::onFsdConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << from << to; }
|
||||
auto fromOld = m_currentStatus; // own status cached
|
||||
const INetwork::ConnectionStatus fromOld = m_currentStatus; // own status cached
|
||||
m_currentStatus = to;
|
||||
|
||||
if (fromOld == INetwork::Disconnecting)
|
||||
@@ -420,6 +420,12 @@ namespace BlackCore
|
||||
if (to == INetwork::Connected)
|
||||
{
|
||||
CLogMessage(this).info("Connected, own aircraft %1") << this->ownAircraft().getCallsignAsString();
|
||||
|
||||
if (m_network)
|
||||
{
|
||||
const CServer server = m_network->getPresetServer();
|
||||
emit this->connectedServerChanged(server);
|
||||
}
|
||||
}
|
||||
|
||||
// send as message
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace BlackCore
|
||||
void checkForSupervisiorTextMessage(const BlackMisc::Network::CTextMessageList &messages);
|
||||
|
||||
//! Connection status changed
|
||||
void fsdConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||
void onFsdConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||
|
||||
//! Render restrictions have been changed, used with analyzer
|
||||
//! \sa CAirspaceAnalyzer
|
||||
|
||||
@@ -93,7 +93,9 @@ namespace BlackCore
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"removedAircraft", this, SIGNAL(removedAircraft(BlackMisc::Aviation::CCallsign)));
|
||||
Q_ASSERT(s);
|
||||
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"connectedServerChanged", this, SIGNAL(connectedServerChanged(BlackMisc::Network::CServer)));
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
this->relayBaseClassSignals(serviceName, connection, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user