Ref T168, relay kicked message thru context to UI

* new signal in context, connected with VATLIB
* display in UI
This commit is contained in:
Klaus Basan
2017-09-30 00:48:31 +02:00
committed by Mathew Sutcliffe
parent 2aa5ed431f
commit 27ebf3e43d
7 changed files with 28 additions and 9 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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<QCommandLineOption> &getCmdLineOptions();
static int const c_positionTimeOffsetMsec = 6000; //!< offset time for received position updates
@@ -206,18 +206,18 @@ namespace BlackCore
};
QScopedPointer<PCSBClient, VatlibQScopedPointerDeleter> 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;

View File

@@ -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);

View File

@@ -210,6 +210,9 @@ private:
//! Terminated connection
void onConnectionTerminated();
//! Kicked from network
void onKickedFromNetwork(const QString &kickMessage);
//! Update timer
void handleTimerBasedUpdates();

View File

@@ -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);