diff --git a/src/blackcore/context/contextnetwork.h b/src/blackcore/context/contextnetwork.h index 049273d0d..4ed425270 100644 --- a/src/blackcore/context/contextnetwork.h +++ b/src/blackcore/context/contextnetwork.h @@ -144,6 +144,9 @@ namespace BlackCore //! Terminated connection void connectionTerminated(); + //! User has been kicked from network + void kicked(const QString &kickMessage); + //! Connection status changed void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to); diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index c465152f6..f1abdcd3f 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -67,6 +67,7 @@ namespace BlackCore // 1. Init by "network driver" m_network = new CNetworkVatlib(this->getRuntime()->getCContextOwnAircraft(), this); connect(m_network, &INetwork::connectionStatusChanged, this, &CContextNetwork::ps_fsdConnectionStatusChanged); + connect(m_network, &INetwork::kicked, this, &CContextNetwork::kicked); connect(m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::textMessagesReceived); connect(m_network, &INetwork::textMessagesReceived, this, &CContextNetwork::ps_checkForSupervisiorTextMessage); connect(m_network, &INetwork::textMessageSent, this, &CContextNetwork::textMessageSent); diff --git a/src/blackcore/context/contextnetworkproxy.cpp b/src/blackcore/context/contextnetworkproxy.cpp index 8162b41ce..6a136c14e 100644 --- a/src/blackcore/context/contextnetworkproxy.cpp +++ b/src/blackcore/context/contextnetworkproxy.cpp @@ -75,6 +75,9 @@ namespace BlackCore s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(), "connectionTerminated", this, SIGNAL(connectionTerminated())); Q_ASSERT(s); + s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(), + "kicked", this, SIGNAL(kicked(QString))); + Q_ASSERT(s); s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(), "textMessagesReceived", this, SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList))); Q_ASSERT(s); diff --git a/src/blackcore/vatsim/networkvatlib.h b/src/blackcore/vatsim/networkvatlib.h index 934723623..e76f3f23b 100644 --- a/src/blackcore/vatsim/networkvatlib.h +++ b/src/blackcore/vatsim/networkvatlib.h @@ -123,7 +123,7 @@ namespace BlackCore virtual void sendMetarQuery(const BlackMisc::Aviation::CAirportIcaoCode &airportIcao) override; //! @} - //! Cmd. line options this library can handle + //! Command line options this library can handle static const QList &getCmdLineOptions(); static int const c_positionTimeOffsetMsec = 6000; //!< offset time for received position updates @@ -206,18 +206,18 @@ namespace BlackCore }; QScopedPointer m_net; - LoginMode m_loginMode; - VatConnectionStatus m_status; - BlackMisc::Network::CServer m_server; - QTextCodec *m_fsdTextCodec = nullptr; - BlackMisc::Simulation::CSimulatorPluginInfo m_simulatorInfo; + LoginMode m_loginMode; + VatConnectionStatus m_status; + BlackMisc::Network::CServer m_server; + QTextCodec *m_fsdTextCodec = nullptr; + BlackMisc::Simulation::CSimulatorPluginInfo m_simulatorInfo; //!< used simulator BlackMisc::Aviation::CCallsign m_ownCallsign; //!< "buffered callsign", as this must not change when connected BlackMisc::Aviation::CAircraftIcaoCode m_ownAircraftIcaoCode; //!< "buffered icao", as this must not change when connected BlackMisc::Aviation::CAirlineIcaoCode m_ownAirlineIcaoCode; //!< "buffered icao", as this must not change when connected QString m_ownLiveryDescription; //!< "buffered livery", as this must not change when connected - BlackMisc::Aviation::CCallsignSet m_interimPositionReceivers; - BlackMisc::Aviation::CAircraftParts m_sentAircraftConfig; - CTokenBucket m_tokenBucket; + BlackMisc::Aviation::CCallsignSet m_interimPositionReceivers; //!< all aircraft receiving interim positions + BlackMisc::Aviation::CAircraftParts m_sentAircraftConfig; //!< aircraft parts sent + CTokenBucket m_tokenBucket; //!< used with aircraft parts messages QTimer m_scheduledConfigUpdate; QTimer m_processingTimer; diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index bacb3ecb2..baade8bca 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -242,6 +242,14 @@ void SwiftGuiStd::onConnectionTerminated() this->updateGuiStatusInformation(); } +void SwiftGuiStd::onKickedFromNetwork(const QString &kickMessage) +{ + this->updateGuiStatusInformation(); + this->displayInOverlayWindow(CStatusMessage( + this, CStatusMessage::SeverityError, + kickMessage.isEmpty() ? "You have been kicked from the network" : kickMessage)); +} + void SwiftGuiStd::onConnectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to) { Q_UNUSED(from); diff --git a/src/swiftguistandard/swiftguistd.h b/src/swiftguistandard/swiftguistd.h index 0d2c28716..325c8b6a5 100644 --- a/src/swiftguistandard/swiftguistd.h +++ b/src/swiftguistandard/swiftguistd.h @@ -210,6 +210,9 @@ private: //! Terminated connection void onConnectionTerminated(); + //! Kicked from network + void onKickedFromNetwork(const QString &kickMessage); + //! Update timer void handleTimerBasedUpdates(); diff --git a/src/swiftguistandard/swiftguistdinit.cpp b/src/swiftguistandard/swiftguistdinit.cpp index 414a51d38..e99e5fd8a 100644 --- a/src/swiftguistandard/swiftguistdinit.cpp +++ b/src/swiftguistandard/swiftguistdinit.cpp @@ -124,6 +124,7 @@ void SwiftGuiStd::init() connect(sGui->getWebDataServices(), &CWebDataServices::sharedInfoObjectsRead, this, &SwiftGuiStd::sharedInfoObjectsLoaded); connect(sGui->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &SwiftGuiStd::onConnectionTerminated); connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &SwiftGuiStd::onConnectionStatusChanged); + connect(sGui->getIContextNetwork(), &IContextNetwork::kicked, this, &SwiftGuiStd::onKickedFromNetwork); connect(sGui->getIContextNetwork(), &IContextNetwork::textMessagesReceived, ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::onTextMessageReceived); connect(sGui->getIContextNetwork(), &IContextNetwork::textMessageSent, ui->comp_MainInfoArea->getTextMessageComponent(), &CTextMessageComponent::onTextMessageSent); connect(m_timerContextWatchdog, &QTimer::timeout, this, &SwiftGuiStd::handleTimerBasedUpdates);