mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 21:05:31 +08:00
Propagate FacilityType and LoginMode to value objects
This commit is contained in:
@@ -1451,7 +1451,7 @@ namespace BlackCore
|
|||||||
if (!sApp || sApp->isShuttingDown() || !sApp->getIContextNetwork()) { return false; }
|
if (!sApp || sApp->isShuttingDown() || !sApp->getIContextNetwork()) { return false; }
|
||||||
|
|
||||||
// It is only relevant if we are logged in as observer
|
// It is only relevant if we are logged in as observer
|
||||||
if (sApp->getIContextNetwork()->getLoginMode() != INetwork::LoginAsObserver) { return false; }
|
if (sApp->getIContextNetwork()->getLoginMode() != BlackMisc::Network::CLoginMode::Observer) { return false; }
|
||||||
|
|
||||||
const CCallsign ownCallsign = this->getOwnAircraft().getCallsign();
|
const CCallsign ownCallsign = this->getOwnAircraft().getCallsign();
|
||||||
return ownCallsign.isMaybeCopilotCallsign(callsign);
|
return ownCallsign.isMaybeCopilotCallsign(callsign);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "blackmisc/aviation/flightplan.h"
|
#include "blackmisc/aviation/flightplan.h"
|
||||||
#include "blackmisc/network/connectionstatus.h"
|
#include "blackmisc/network/connectionstatus.h"
|
||||||
#include "blackmisc/network/clientlist.h"
|
#include "blackmisc/network/clientlist.h"
|
||||||
|
#include "blackmisc/network/loginmode.h"
|
||||||
#include "blackmisc/network/server.h"
|
#include "blackmisc/network/server.h"
|
||||||
#include "blackmisc/network/serverlist.h"
|
#include "blackmisc/network/serverlist.h"
|
||||||
#include "blackmisc/network/textmessagelist.h"
|
#include "blackmisc/network/textmessagelist.h"
|
||||||
@@ -248,16 +249,16 @@ namespace BlackCore
|
|||||||
const QString &extraLiveryString, bool sendLivery,
|
const QString &extraLiveryString, bool sendLivery,
|
||||||
const QString &extraModelString, bool sendModelString,
|
const QString &extraModelString, bool sendModelString,
|
||||||
const BlackMisc::Aviation::CCallsign &partnerCallsign,
|
const BlackMisc::Aviation::CCallsign &partnerCallsign,
|
||||||
BlackCore::INetwork::LoginMode loginMode) = 0;
|
BlackMisc::Network::CLoginMode loginMode) = 0;
|
||||||
|
|
||||||
//! Server which is connected, if not connected empty default object.
|
//! Server which is connected, if not connected empty default object.
|
||||||
virtual BlackMisc::Network::CServer getConnectedServer() const = 0;
|
virtual BlackMisc::Network::CServer getConnectedServer() const = 0;
|
||||||
|
|
||||||
//! Login mode
|
//! Login mode
|
||||||
virtual INetwork::LoginMode getLoginMode() const = 0;
|
virtual BlackMisc::Network::CLoginMode getLoginMode() const = 0;
|
||||||
|
|
||||||
//! Mode as string
|
//! Mode as string
|
||||||
const QString &getLoginModeAsString() const { return INetwork::modeAsString(this->getLoginMode()); }
|
QString getLoginModeAsString() const { return this->getLoginMode().toQString(); }
|
||||||
|
|
||||||
//! Disconnect from network
|
//! Disconnect from network
|
||||||
//! \return messages generated during disconnecting
|
//! \return messages generated during disconnecting
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::connectToNetwork
|
//! \copydoc IContextNetwork::connectToNetwork
|
||||||
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackCore::INetwork::LoginMode mode) override
|
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackMisc::Network::CLoginMode mode) override
|
||||||
{
|
{
|
||||||
Q_UNUSED(mode);
|
Q_UNUSED(mode);
|
||||||
Q_UNUSED(server);
|
Q_UNUSED(server);
|
||||||
@@ -166,10 +166,10 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::getLoginMode
|
//! \copydoc IContextNetwork::getLoginMode
|
||||||
virtual INetwork::LoginMode getLoginMode() const override
|
virtual BlackMisc::Network::CLoginMode getLoginMode() const override
|
||||||
{
|
{
|
||||||
logEmptyContextWarning(Q_FUNC_INFO);
|
logEmptyContextWarning(Q_FUNC_INFO);
|
||||||
return BlackCore::INetwork::LoginNormal;
|
return BlackMisc::Network::CLoginMode::Pilot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::sendTextMessages()
|
//! \copydoc IContextNetwork::sendTextMessages()
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ namespace BlackCore
|
|||||||
if (m_airspace) { m_airspace->gracefulShutdown(); }
|
if (m_airspace) { m_airspace->gracefulShutdown(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage CContextNetwork::connectToNetwork(const CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const CCallsign &partnerCallsign, INetwork::LoginMode mode)
|
CStatusMessage CContextNetwork::connectToNetwork(const CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const CCallsign &partnerCallsign, CLoginMode mode)
|
||||||
{
|
{
|
||||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
QString msg;
|
QString msg;
|
||||||
|
|||||||
@@ -252,9 +252,9 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
virtual BlackMisc::Aviation::CAtcStationList getOnlineStationsForFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ChannelSpacing channelSpacing) const override;
|
virtual BlackMisc::Aviation::CAtcStationList getOnlineStationsForFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ChannelSpacing channelSpacing) const override;
|
||||||
virtual bool isOnlineStation(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual bool isOnlineStation(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackCore::INetwork::LoginMode mode) override;
|
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackMisc::Network::CLoginMode mode) override;
|
||||||
virtual BlackMisc::Network::CServer getConnectedServer() const override;
|
virtual BlackMisc::Network::CServer getConnectedServer() const override;
|
||||||
virtual INetwork::LoginMode getLoginMode() const override;
|
virtual BlackMisc::Network::CLoginMode getLoginMode() const override;
|
||||||
virtual BlackMisc::CStatusMessage disconnectFromNetwork() override;
|
virtual BlackMisc::CStatusMessage disconnectFromNetwork() override;
|
||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
virtual void sendTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
virtual void sendTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
||||||
@@ -295,7 +295,7 @@ namespace BlackCore
|
|||||||
CAirspaceMonitor *m_airspace = nullptr;
|
CAirspaceMonitor *m_airspace = nullptr;
|
||||||
INetwork *m_network = nullptr;
|
INetwork *m_network = nullptr;
|
||||||
INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections
|
INetwork::ConnectionStatus m_currentStatus = INetwork::Disconnected; //!< used to detect pending connections
|
||||||
INetwork::LoginMode m_currentMode = INetwork::LoginNormal; //!< current modeM
|
BlackMisc::Network::CLoginMode m_currentMode = BlackMisc::Network::CLoginMode::Pilot; //!< current modeM
|
||||||
QTimer *m_requestAircraftDataTimer = nullptr; //!< general updates such as frequencies, see requestAircraftDataUpdates()
|
QTimer *m_requestAircraftDataTimer = nullptr; //!< general updates such as frequencies, see requestAircraftDataUpdates()
|
||||||
QTimer *m_requestAtisTimer = nullptr; //!< general updates such as ATIS
|
QTimer *m_requestAtisTimer = nullptr; //!< general updates such as ATIS
|
||||||
|
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ namespace BlackCore
|
|||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("testAddAltitudeOffset"), callsign, offset);
|
return m_dBusInterface->callDBusRet<bool>(QLatin1String("testAddAltitudeOffset"), callsign, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage CContextNetworkProxy::connectToNetwork(const CServer &server, const QString &extraLiveryString, bool sendLiveryString, const QString &extraModelString, bool sendModelString, const CCallsign &partnerCallsign, INetwork::LoginMode loginMode)
|
CStatusMessage CContextNetworkProxy::connectToNetwork(const CServer &server, const QString &extraLiveryString, bool sendLiveryString, const QString &extraModelString, bool sendModelString, const CCallsign &partnerCallsign, CLoginMode loginMode)
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<BlackMisc::CStatusMessage>(QLatin1String("connectToNetwork"), server, extraLiveryString, sendLiveryString, extraModelString, sendModelString, partnerCallsign, loginMode);
|
return m_dBusInterface->callDBusRet<BlackMisc::CStatusMessage>(QLatin1String("connectToNetwork"), server, extraLiveryString, sendLiveryString, extraModelString, sendModelString, partnerCallsign, loginMode);
|
||||||
}
|
}
|
||||||
@@ -373,9 +373,9 @@ namespace BlackCore
|
|||||||
return m_dBusInterface->callDBusRet<BlackMisc::Network::CServer>(QLatin1String("getConnectedServer"));
|
return m_dBusInterface->callDBusRet<BlackMisc::Network::CServer>(QLatin1String("getConnectedServer"));
|
||||||
}
|
}
|
||||||
|
|
||||||
INetwork::LoginMode CContextNetworkProxy::getLoginMode() const
|
CLoginMode CContextNetworkProxy::getLoginMode() const
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<BlackCore::INetwork::LoginMode>(QLatin1String("getLoginMode"));
|
return m_dBusInterface->callDBusRet<CLoginMode>(QLatin1String("getLoginMode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CContextNetworkProxy::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
|
bool CContextNetworkProxy::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
|
||||||
|
|||||||
@@ -88,11 +88,11 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Aviation::CAtcStationList getOnlineStationsForFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ChannelSpacing channelSpacing) const override;
|
virtual BlackMisc::Aviation::CAtcStationList getOnlineStationsForFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ChannelSpacing channelSpacing) const override;
|
||||||
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual BlackMisc::Aviation::CAtcStation getOnlineStationForCallsign(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
virtual bool isOnlineStation(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
virtual bool isOnlineStation(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||||
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackCore::INetwork::LoginMode mode) override;
|
virtual BlackMisc::CStatusMessage connectToNetwork(const BlackMisc::Network::CServer &server, const QString &extraLiveryString, bool sendLivery, const QString &extraModelString, bool sendModelString, const BlackMisc::Aviation::CCallsign &partnerCallsign, BlackMisc::Network::CLoginMode mode) override;
|
||||||
virtual BlackMisc::CStatusMessage disconnectFromNetwork() override;
|
virtual BlackMisc::CStatusMessage disconnectFromNetwork() override;
|
||||||
virtual bool isConnected() const override;
|
virtual bool isConnected() const override;
|
||||||
virtual BlackMisc::Network::CServer getConnectedServer() const override;
|
virtual BlackMisc::Network::CServer getConnectedServer() const override;
|
||||||
virtual INetwork::LoginMode getLoginMode() const override;
|
virtual BlackMisc::Network::CLoginMode getLoginMode() const override;
|
||||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||||
virtual void sendTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
virtual void sendTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
||||||
virtual void sendFlightPlan(const BlackMisc::Aviation::CFlightPlan &flightPlan) override;
|
virtual void sendFlightPlan(const BlackMisc::Aviation::CFlightPlan &flightPlan) override;
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// not really clear when a type here has to be registered with qRegisterMetaType
|
// not really clear when a type here has to be registered with qRegisterMetaType
|
||||||
// however, does not harm if it is redundant
|
// however, does not harm if it is redundant
|
||||||
qRegisterMetaType<INetwork::ConnectionStatus>();
|
|
||||||
qRegisterMetaType<INetwork::LoginMode>();
|
|
||||||
qRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
qRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
||||||
qRegisterMetaType<CWebReaderFlags::WebReader>();
|
qRegisterMetaType<CWebReaderFlags::WebReader>();
|
||||||
qRegisterMetaType<CWebReaderFlags::WebReaderFlag>();
|
qRegisterMetaType<CWebReaderFlags::WebReaderFlag>();
|
||||||
@@ -40,14 +38,14 @@ namespace BlackCore
|
|||||||
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
||||||
qDBusRegisterMetaType<Context::CSettingsDictionary>();
|
qDBusRegisterMetaType<Context::CSettingsDictionary>();
|
||||||
qDBusRegisterMetaType<INetwork::ConnectionStatus>();
|
qDBusRegisterMetaType<INetwork::ConnectionStatus>();
|
||||||
qDBusRegisterMetaType<INetwork::LoginMode>();
|
qDBusRegisterMetaType<BlackMisc::Network::CLoginMode>();
|
||||||
qDBusRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
qDBusRegisterMetaType<IVoiceChannel::ConnectionStatus>();
|
||||||
|
|
||||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionHash>();
|
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionHash>();
|
||||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionPair>();
|
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionPair>();
|
||||||
qRegisterMetaTypeStreamOperators<Context::CSettingsDictionary>();
|
qRegisterMetaTypeStreamOperators<Context::CSettingsDictionary>();
|
||||||
|
qRegisterMetaTypeStreamOperators<BlackMisc::Network::CLoginMode>();
|
||||||
qRegisterMetaTypeStreamOperators<INetwork::ConnectionStatus>();
|
qRegisterMetaTypeStreamOperators<INetwork::ConnectionStatus>();
|
||||||
qRegisterMetaTypeStreamOperators<INetwork::LoginMode>();
|
|
||||||
qRegisterMetaTypeStreamOperators<IVoiceChannel::ConnectionStatus>();
|
qRegisterMetaTypeStreamOperators<IVoiceChannel::ConnectionStatus>();
|
||||||
|
|
||||||
Db::CDatabaseReaderConfig::registerMetadata();
|
Db::CDatabaseReaderConfig::registerMetadata();
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include "blackcore/context/contextnetwork.h"
|
#include "blackcore/context/contextnetwork.h"
|
||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackcore/webdataservices.h"
|
#include "blackcore/webdataservices.h"
|
||||||
#include "blackcore/network.h"
|
|
||||||
#include "blackcore/simulator.h"
|
#include "blackcore/simulator.h"
|
||||||
#include "blackmisc/simulation/simulatorinternals.h"
|
#include "blackmisc/simulation/simulatorinternals.h"
|
||||||
#include "blackmisc/simulation/aircraftmodel.h"
|
#include "blackmisc/simulation/aircraftmodel.h"
|
||||||
@@ -167,11 +166,10 @@ namespace BlackGui
|
|||||||
ui->comp_OwnAircraft->updateOwnAircaftIcaoValuesFromGuiValues();
|
ui->comp_OwnAircraft->updateOwnAircaftIcaoValuesFromGuiValues();
|
||||||
|
|
||||||
// Login mode
|
// Login mode
|
||||||
const INetwork::LoginMode mode = ui->comp_NetworkDetails->getLoginMode();
|
const CLoginMode mode = ui->comp_NetworkDetails->getLoginMode();
|
||||||
switch (mode)
|
switch (mode.getLoginMode())
|
||||||
{
|
{
|
||||||
case INetwork::LoginStealth: CLogMessage(this).info(u"login in stealth mode"); break;
|
case CLoginMode::Observer: CLogMessage(this).info(u"login in observer mode"); break;
|
||||||
case INetwork::LoginAsObserver: CLogMessage(this).info(u"login in observer mode"); break;
|
|
||||||
default: break; // INetwork::LoginNormal
|
default: break; // INetwork::LoginNormal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -289,13 +289,8 @@ namespace BlackGui
|
|||||||
this->updateOwnAircaftIcaoValuesFromGuiValues();
|
this->updateOwnAircaftIcaoValuesFromGuiValues();
|
||||||
|
|
||||||
// Login mode
|
// Login mode
|
||||||
const INetwork::LoginMode mode = ui->frp_LoginMode->getLoginMode();
|
const CLoginMode mode = ui->frp_LoginMode->getLoginMode();
|
||||||
switch (mode)
|
if(mode.isObserver()) { CLogMessage(this).info(u"login in observer mode"); }
|
||||||
{
|
|
||||||
case INetwork::LoginStealth: CLogMessage(this).info(u"login in stealth mode"); break;
|
|
||||||
case INetwork::LoginAsObserver: CLogMessage(this).info(u"login in observer mode"); break;
|
|
||||||
default: break; // INetwork::LoginNormal
|
|
||||||
}
|
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
currentServer = this->getCurrentServer();
|
currentServer = this->getCurrentServer();
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "blackcore/vatsim/vatsimsettings.h"
|
#include "blackcore/vatsim/vatsimsettings.h"
|
||||||
#include "blackcore/data/networksetup.h"
|
#include "blackcore/data/networksetup.h"
|
||||||
#include "blackcore/network.h"
|
|
||||||
#include "blackgui/settings/guisettings.h"
|
#include "blackgui/settings/guisettings.h"
|
||||||
#include "blackgui/overlaymessagesframe.h"
|
#include "blackgui/overlaymessagesframe.h"
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ namespace BlackGui
|
|||||||
CNetworkDetailsComponent::~CNetworkDetailsComponent()
|
CNetworkDetailsComponent::~CNetworkDetailsComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
INetwork::LoginMode CNetworkDetailsComponent::getLoginMode() const
|
CLoginMode CNetworkDetailsComponent::getLoginMode() const
|
||||||
{
|
{
|
||||||
return ui->frp_LoginMode->getLoginMode();
|
return ui->frp_LoginMode->getLoginMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNetworkDetailsComponent::setLoginMode(INetwork::LoginMode mode)
|
void CNetworkDetailsComponent::setLoginMode(CLoginMode mode)
|
||||||
{
|
{
|
||||||
ui->frp_LoginMode->setLoginMode(mode);
|
ui->frp_LoginMode->setLoginMode(mode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
#include "blackcore/data/networksetup.h"
|
#include "blackcore/data/networksetup.h"
|
||||||
#include "blackcore/network.h"
|
|
||||||
#include "blackmisc/network/data/lastserver.h"
|
#include "blackmisc/network/data/lastserver.h"
|
||||||
#include "blackmisc/network/entityflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
#include "blackmisc/network/fsdsetup.h"
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include "blackmisc/settingscache.h"
|
#include "blackmisc/settingscache.h"
|
||||||
#include "blackmisc/datacache.h"
|
#include "blackmisc/datacache.h"
|
||||||
#include "blackmisc/network/connectionstatus.h"
|
#include "blackmisc/network/connectionstatus.h"
|
||||||
|
#include "blackmisc/network/loginmode.h"
|
||||||
|
|
||||||
namespace Ui { class CNetworkDetailsComponent; }
|
namespace Ui { class CNetworkDetailsComponent; }
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -79,10 +79,10 @@ namespace BlackGui
|
|||||||
bool isVoiceSetupOverrideEnabled() const;
|
bool isVoiceSetupOverrideEnabled() const;
|
||||||
|
|
||||||
//! Login mode
|
//! Login mode
|
||||||
BlackCore::INetwork::LoginMode getLoginMode() const;
|
BlackMisc::Network::CLoginMode getLoginMode() const;
|
||||||
|
|
||||||
//! Login mode
|
//! Login mode
|
||||||
void setLoginMode(BlackCore::INetwork::LoginMode mode);
|
void setLoginMode(BlackMisc::Network::CLoginMode mode);
|
||||||
|
|
||||||
//! Reset state
|
//! Reset state
|
||||||
void resetState();
|
void resetState();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
using namespace BlackCore::Context;
|
using namespace BlackCore::Context;
|
||||||
|
using namespace BlackMisc::Network;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -35,32 +36,25 @@ namespace BlackGui
|
|||||||
CLoginModeButtons::~CLoginModeButtons()
|
CLoginModeButtons::~CLoginModeButtons()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
INetwork::LoginMode BlackGui::CLoginModeButtons::getLoginMode() const
|
CLoginMode BlackGui::CLoginModeButtons::getLoginMode() const
|
||||||
{
|
{
|
||||||
INetwork::LoginMode mode = INetwork::LoginNormal;
|
CLoginMode mode = CLoginMode::Pilot;
|
||||||
if (ui->rb_LoginStealth->isChecked())
|
if (ui->rb_LoginObserver->isChecked())
|
||||||
{
|
{
|
||||||
mode = INetwork::LoginStealth;
|
mode.setLoginMode(CLoginMode::Observer);
|
||||||
}
|
|
||||||
else if (ui->rb_LoginObserver->isChecked())
|
|
||||||
{
|
|
||||||
mode = INetwork::LoginAsObserver;
|
|
||||||
}
|
}
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginModeButtons::setLoginMode(INetwork::LoginMode mode)
|
void CLoginModeButtons::setLoginMode(CLoginMode mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode.getLoginMode())
|
||||||
{
|
{
|
||||||
case INetwork::LoginAsObserver:
|
case CLoginMode::Observer:
|
||||||
ui->rb_LoginObserver->setChecked(true);
|
ui->rb_LoginObserver->setChecked(true);
|
||||||
break;
|
break;
|
||||||
case INetwork::LoginStealth:
|
|
||||||
ui->rb_LoginStealth->setChecked(true);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
case INetwork::LoginNormal:
|
case CLoginMode::Pilot:
|
||||||
ui->rb_LoginNormal->setChecked(true);
|
ui->rb_LoginNormal->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,10 @@
|
|||||||
#ifndef BLACKGUI_LOGINMODEBUTTONS_H
|
#ifndef BLACKGUI_LOGINMODEBUTTONS_H
|
||||||
#define BLACKGUI_LOGINMODEBUTTONS_H
|
#define BLACKGUI_LOGINMODEBUTTONS_H
|
||||||
|
|
||||||
#include "blackcore/network.h"
|
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackmisc/network/connectionstatus.h"
|
#include "blackmisc/network/connectionstatus.h"
|
||||||
|
#include "blackmisc/network/loginmode.h"
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
@@ -34,10 +35,10 @@ namespace BlackGui
|
|||||||
virtual ~CLoginModeButtons() override;
|
virtual ~CLoginModeButtons() override;
|
||||||
|
|
||||||
//! Get login mode, \sa BlackCore::INetwork::LoginMode
|
//! Get login mode, \sa BlackCore::INetwork::LoginMode
|
||||||
BlackCore::INetwork::LoginMode getLoginMode() const;
|
BlackMisc::Network::CLoginMode getLoginMode() const;
|
||||||
|
|
||||||
//! Set login mode
|
//! Set login mode
|
||||||
void setLoginMode(BlackCore::INetwork::LoginMode mode);
|
void setLoginMode(BlackMisc::Network::CLoginMode mode);
|
||||||
|
|
||||||
//! Set to read only
|
//! Set to read only
|
||||||
void setReadOnly(bool readonly);
|
void setReadOnly(bool readonly);
|
||||||
|
|||||||
36
src/blackmisc/network/facilitytype.cpp
Normal file
36
src/blackmisc/network/facilitytype.cpp
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/* 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/facilitytype.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Network
|
||||||
|
{
|
||||||
|
QString CFacilityType::convertToQString(bool i18n) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(i18n);
|
||||||
|
|
||||||
|
switch (m_facilityType)
|
||||||
|
{
|
||||||
|
case OBS: return QStringLiteral("OBS");
|
||||||
|
case FSS: return QStringLiteral("FSS");
|
||||||
|
case DEL: return QStringLiteral("DEL");
|
||||||
|
case GND: return QStringLiteral("GND");
|
||||||
|
case TWR: return QStringLiteral("TWR");
|
||||||
|
case APP: return QStringLiteral("APP");
|
||||||
|
case CTR: return QStringLiteral("CTR");
|
||||||
|
case Unknown: return QStringLiteral("Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
66
src/blackmisc/network/facilitytype.h
Normal file
66
src/blackmisc/network/facilitytype.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/* 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_FACILITYTYPE_H
|
||||||
|
#define BLACKMISC_NETWORK_FACILITYTYPE_H
|
||||||
|
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/valueobject.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Network
|
||||||
|
{
|
||||||
|
//! Value object encapsulating the ATC facility type, e.g. TWR, DEP, APP
|
||||||
|
class BLACKMISC_EXPORT CFacilityType : public CValueObject<CFacilityType>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Login modes
|
||||||
|
enum FacilityType
|
||||||
|
{
|
||||||
|
OBS, /*!< OBS */
|
||||||
|
FSS, /*!< FSS */
|
||||||
|
DEL, /*!< Delivery */
|
||||||
|
GND, /*!< Ground */
|
||||||
|
TWR, /*!< Tower */
|
||||||
|
APP, /*!< Approach */
|
||||||
|
CTR, /*!< Center */
|
||||||
|
Unknown /*!< Unknown */
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
CFacilityType() = default;
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CFacilityType(FacilityType mode) : m_facilityType(mode) {}
|
||||||
|
|
||||||
|
//! Get type
|
||||||
|
FacilityType getFacilityType() const { return m_facilityType; }
|
||||||
|
|
||||||
|
//! Set type
|
||||||
|
void setFacilityType(FacilityType type) { m_facilityType = type; }
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
FacilityType m_facilityType = Unknown;
|
||||||
|
|
||||||
|
BLACK_METACLASS(
|
||||||
|
CFacilityType,
|
||||||
|
BLACK_METAMEMBER(facilityType)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Network::CFacilityType)
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
30
src/blackmisc/network/loginmode.cpp
Normal file
30
src/blackmisc/network/loginmode.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* 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/loginmode.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Network
|
||||||
|
{
|
||||||
|
QString CLoginMode::convertToQString(bool i18n) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(i18n);
|
||||||
|
|
||||||
|
switch (m_loginMode)
|
||||||
|
{
|
||||||
|
case Pilot: return QStringLiteral("Pilot");
|
||||||
|
case Observer: return QStringLiteral("Observer");
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
64
src/blackmisc/network/loginmode.h
Normal file
64
src/blackmisc/network/loginmode.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/* 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_LOGINMODE_H
|
||||||
|
#define BLACKMISC_NETWORK_LOGINMODE_H
|
||||||
|
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/valueobject.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Network
|
||||||
|
{
|
||||||
|
//! Value object encapsulating information about login mode
|
||||||
|
class BLACKMISC_EXPORT CLoginMode : public CValueObject<CLoginMode>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Login modes
|
||||||
|
enum LoginMode
|
||||||
|
{
|
||||||
|
Pilot, //!< Normal login
|
||||||
|
Observer, //!< Login as observer
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
CLoginMode() = default;
|
||||||
|
|
||||||
|
//! Constructor
|
||||||
|
CLoginMode(LoginMode mode) : m_loginMode(mode) {}
|
||||||
|
|
||||||
|
bool isPilot() const { return m_loginMode == Pilot; }
|
||||||
|
|
||||||
|
bool isObserver() const { return m_loginMode == Observer; }
|
||||||
|
|
||||||
|
//! Get status
|
||||||
|
LoginMode getLoginMode() const { return m_loginMode; }
|
||||||
|
|
||||||
|
//! Set status
|
||||||
|
void setLoginMode(LoginMode mode) { m_loginMode = mode; }
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LoginMode m_loginMode = Pilot;
|
||||||
|
|
||||||
|
BLACK_METACLASS(
|
||||||
|
CLoginMode,
|
||||||
|
BLACK_METAMEMBER(loginMode)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(BlackMisc::Network::CLoginMode)
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
@@ -23,7 +23,9 @@
|
|||||||
#include "blackmisc/network/ecosystem.h"
|
#include "blackmisc/network/ecosystem.h"
|
||||||
#include "blackmisc/network/ecosystemlist.h"
|
#include "blackmisc/network/ecosystemlist.h"
|
||||||
#include "blackmisc/network/entityflags.h"
|
#include "blackmisc/network/entityflags.h"
|
||||||
|
#include "blackmisc/network/facilitytype.h"
|
||||||
#include "blackmisc/network/fsdsetup.h"
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
|
#include "blackmisc/network/loginmode.h"
|
||||||
#include "blackmisc/network/rawfsdmessage.h"
|
#include "blackmisc/network/rawfsdmessage.h"
|
||||||
#include "blackmisc/network/rawfsdmessagelist.h"
|
#include "blackmisc/network/rawfsdmessagelist.h"
|
||||||
#include "blackmisc/network/role.h"
|
#include "blackmisc/network/role.h"
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ namespace BlackMisc
|
|||||||
CEcosystem::registerMetadata();
|
CEcosystem::registerMetadata();
|
||||||
CEcosystemList::registerMetadata();
|
CEcosystemList::registerMetadata();
|
||||||
CEntityFlags::registerMetadata();
|
CEntityFlags::registerMetadata();
|
||||||
|
CFacilityType::registerMetadata();
|
||||||
CFsdSetup::registerMetadata();
|
CFsdSetup::registerMetadata();
|
||||||
|
CLoginMode::registerMetadata();
|
||||||
CRawFsdMessage::registerMetadata();
|
CRawFsdMessage::registerMetadata();
|
||||||
CRawFsdMessageList::registerMetadata();
|
CRawFsdMessageList::registerMetadata();
|
||||||
CRemoteFile::registerMetadata();
|
CRemoteFile::registerMetadata();
|
||||||
@@ -44,6 +46,7 @@ namespace BlackMisc
|
|||||||
CUserList::registerMetadata();
|
CUserList::registerMetadata();
|
||||||
CVoiceCapabilities::registerMetadata();
|
CVoiceCapabilities::registerMetadata();
|
||||||
Settings::CNetworkSettings::registerMetadata();
|
Settings::CNetworkSettings::registerMetadata();
|
||||||
|
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user