mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Display VATLIB version in "about swift"
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackcore/db/networkwatchdog.h"
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackcore/context/contextapplication.h"
|
||||
#include "blackcore/cookiemanager.h"
|
||||
#include "blackcore/corefacade.h"
|
||||
@@ -550,40 +551,49 @@ namespace BlackCore
|
||||
|
||||
QString CApplication::getInfoString(const QString &separator) const
|
||||
{
|
||||
const QString str =
|
||||
QString str =
|
||||
CBuildConfig::getVersionString() %
|
||||
QLatin1Char(' ') % (CBuildConfig::isReleaseBuild() ? QLatin1String("Release build") : QLatin1String("Debug build")) %
|
||||
QStringLiteral(" ") % (CBuildConfig::isReleaseBuild() ? QStringLiteral("Release build") : QStringLiteral("Debug build")) %
|
||||
separator %
|
||||
QLatin1String("Local dev.dbg.: ") %
|
||||
QStringLiteral("Local dev.dbg.: ") %
|
||||
boolToYesNo(CBuildConfig::isLocalDeveloperDebugBuild()) %
|
||||
separator %
|
||||
QLatin1String("dev.env.: ") %
|
||||
QStringLiteral("dev.env.: ") %
|
||||
boolToYesNo(this->isRunningInDeveloperEnvironment()) %
|
||||
separator %
|
||||
QLatin1String("distribution: ") %
|
||||
QStringLiteral("distribution: ") %
|
||||
this->getOwnDistribution().toQString(true) %
|
||||
separator %
|
||||
QLatin1String("Windows NT: ") %
|
||||
QStringLiteral("Windows NT: ") %
|
||||
boolToYesNo(CBuildConfig::isRunningOnWindowsNtPlatform()) %
|
||||
QLatin1String(" Windows 10: ") %
|
||||
QStringLiteral(" Windows 10: ") %
|
||||
boolToYesNo(CBuildConfig::isRunningOnWindows10()) %
|
||||
separator %
|
||||
QLatin1String("Linux: ") %
|
||||
QStringLiteral("Linux: ") %
|
||||
boolToYesNo(CBuildConfig::isRunningOnLinuxPlatform()) %
|
||||
QLatin1String(" Unix: ") %
|
||||
QStringLiteral(" Unix: ") %
|
||||
boolToYesNo(CBuildConfig::isRunningOnUnixPlatform()) %
|
||||
separator %
|
||||
QLatin1String("MacOS: ") %
|
||||
QStringLiteral("MacOS: ") %
|
||||
boolToYesNo(CBuildConfig::isRunningOnMacOSPlatform()) %
|
||||
separator %
|
||||
QLatin1String("Build Abi: ") %
|
||||
QStringLiteral("Build Abi: ") %
|
||||
QSysInfo::buildAbi() %
|
||||
separator %
|
||||
QLatin1String("Build CPU: ") %
|
||||
QStringLiteral("Build CPU: ") %
|
||||
QSysInfo::buildCpuArchitecture() %
|
||||
separator %
|
||||
CBuildConfig::compiledWithInfo(false);
|
||||
|
||||
if (this->supportsContexts())
|
||||
{
|
||||
str += (separator % QStringLiteral("Supporting contexts"));
|
||||
if (this->getIContextNetwork())
|
||||
{
|
||||
str += (separator % this->getIContextNetwork()->getLibraryInfo(true));
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,6 +291,9 @@ namespace BlackCore
|
||||
//! Enable storing of aircraft parts
|
||||
virtual void enableAircraftPartsHistory(bool enabled) = 0;
|
||||
|
||||
//! Version of the underlying library (e.g. VATLIB)
|
||||
virtual QString getLibraryInfo(bool detailed) const = 0;
|
||||
|
||||
// ------------------------ testing ------------------------
|
||||
|
||||
//! Create dummy ATC stations for performance tests etc.
|
||||
|
||||
@@ -220,6 +220,14 @@ namespace BlackCore
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextNetwork::getLibraryInfo
|
||||
virtual QString getLibraryInfo(bool detailed) const override
|
||||
{
|
||||
Q_UNUSED(detailed);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return QString("N/A");
|
||||
}
|
||||
|
||||
//! \copydoc IContextNetwork::testCreateDummyOnlineAtcStations
|
||||
virtual void testCreateDummyOnlineAtcStations(int number) override
|
||||
{
|
||||
|
||||
@@ -690,6 +690,13 @@ namespace BlackCore
|
||||
return m_network->getInterimPositionReceivers();
|
||||
}
|
||||
|
||||
QString CContextNetwork::getLibraryInfo(bool detailed) const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << detailed; }
|
||||
Q_ASSERT(m_network);
|
||||
return m_network->getLibraryInfo(detailed);
|
||||
}
|
||||
|
||||
void CContextNetwork::testRequestAircraftConfig(const CCallsign &callsign)
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||
|
||||
@@ -180,6 +180,7 @@ namespace BlackCore
|
||||
virtual void requestAtisUpdates() override;
|
||||
virtual void setFastPositionEnabledCallsigns(BlackMisc::Aviation::CCallsignSet &callsigns) override;
|
||||
virtual BlackMisc::Aviation::CCallsignSet getFastPositionEnabledCallsigns() const override;
|
||||
virtual QString getLibraryInfo(bool detailed) const override;
|
||||
virtual void testCreateDummyOnlineAtcStations(int number) override;
|
||||
virtual void testAddAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts, bool incremental) override;
|
||||
virtual void testReceivedTextMessages(const BlackMisc::Network::CTextMessageList &textMessages) override;
|
||||
|
||||
@@ -256,6 +256,11 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<CAircraftPartsList>(QLatin1String("getRemoteAircraftParts"), callsign, cutoffTimeValuesBefore);
|
||||
}
|
||||
|
||||
QString CContextNetworkProxy::getLibraryInfo(bool detailed) const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<QString>(QLatin1String("getLibraryInfo"), detailed);
|
||||
}
|
||||
|
||||
bool CContextNetworkProxy::isAircraftPartsHistoryEnabled() const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("isAircraftPartsHistoryEnabled"));
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace BlackCore
|
||||
virtual void enableReverseLookupMessages(bool enabled) override;
|
||||
virtual BlackMisc::CStatusMessageList getAircraftPartsHistory(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual BlackMisc::Aviation::CAircraftPartsList getRemoteAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTimeValuesBefore) const override;
|
||||
virtual QString getLibraryInfo(bool detailed) const override;
|
||||
virtual bool isAircraftPartsHistoryEnabled() const override;
|
||||
virtual void enableAircraftPartsHistory(bool enabled) override;
|
||||
virtual void testCreateDummyOnlineAtcStations(int number) override;
|
||||
|
||||
@@ -68,6 +68,11 @@ namespace BlackCore
|
||||
*/
|
||||
virtual ~INetwork() {}
|
||||
|
||||
/*!
|
||||
* Underlying library info.
|
||||
*/
|
||||
virtual const QString &getLibraryInfo(bool detailed) const = 0;
|
||||
|
||||
/*!
|
||||
* Flags for capabilities bitfield.
|
||||
*/
|
||||
@@ -109,8 +114,8 @@ namespace BlackCore
|
||||
*/
|
||||
static QString connectionStatusToString(ConnectionStatus status)
|
||||
{
|
||||
int index = staticMetaObject.indexOfEnumerator("ConnectionStatus");
|
||||
QMetaEnum metaEnum = staticMetaObject.enumerator(index);
|
||||
const int index = staticMetaObject.indexOfEnumerator("ConnectionStatus");
|
||||
const QMetaEnum metaEnum = staticMetaObject.enumerator(index);
|
||||
return metaEnum.valueToKey(status);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,13 @@ namespace BlackCore
|
||||
terminateConnection();
|
||||
}
|
||||
|
||||
const QString &CNetworkVatlib::getLibraryInfo(bool detailed) const
|
||||
{
|
||||
static const QString vs(QStringLiteral("VATLIB: ") + Vat_GetVersionText());
|
||||
static const QString vd(QStringLiteral("VATLIB: ") + Vat_GetVersionText() + QStringLiteral("\n") + Vat_GetBuildInfo());
|
||||
return detailed ? vd : vs;
|
||||
}
|
||||
|
||||
void CNetworkVatlib::process()
|
||||
{
|
||||
if (!m_net) { return; }
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace BlackCore
|
||||
//! Destructor
|
||||
virtual ~CNetworkVatlib();
|
||||
|
||||
//! \copydoc INetwork::getLibraryInfo
|
||||
const QString &getLibraryInfo(bool detailed) const override;
|
||||
|
||||
//! \name Network functions
|
||||
//! @{
|
||||
virtual bool isConnected() const override { return m_status == vatStatusConnected; }
|
||||
@@ -139,7 +142,7 @@ namespace BlackCore
|
||||
void sendAircraftInfo(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendIncrementalAircraftConfig();
|
||||
|
||||
//! \name Shimlib callbacks
|
||||
//! \name VATLIB callbacks
|
||||
//! @{
|
||||
static void onConnectionStatusChanged(VatFsdClient *, VatConnectionStatus oldStatus, VatConnectionStatus newStatus, void *cbvar);
|
||||
static void onTextMessageReceived(VatFsdClient *, const char *from, const char *to, const char *msg, void *cbvar);
|
||||
|
||||
Reference in New Issue
Block a user