refactor: Use single function for compiledWith info

This should avoid duplication
This commit is contained in:
Lars Toenning
2024-12-29 14:31:31 +01:00
parent db72e55281
commit 66d548892d
4 changed files with 6 additions and 22 deletions

View File

@@ -67,9 +67,7 @@ namespace swift::config
return devBuild;
}
static QString boolToYesNo(bool v) { return v ? QStringLiteral("yes") : QStringLiteral("no"); }
const QString &CBuildConfig::compiledWithInfoShort()
const QString &CBuildConfig::compiledWithInfo()
{
static QString infoShort;
QStringList sl;
@@ -83,17 +81,6 @@ namespace swift::config
return infoShort;
}
const QString &CBuildConfig::compiledWithInfoLong()
{
static QString infoLong;
infoLong = infoLong.append(" FS9: ").append(boolToYesNo(isCompiledWithFs9Support()));
infoLong = infoLong.append(" FSX: ").append(boolToYesNo(isCompiledWithFsxSupport()));
infoLong = infoLong.append(" P3D: ").append(boolToYesNo(isCompiledWithP3DSupport()));
infoLong = infoLong.append(" XPlane: ").append(boolToYesNo(isCompiledWithXPlaneSupport()));
infoLong = infoLong.append(" FG: ").append(boolToYesNo(isCompiledWithFGSupport()));
return infoLong;
}
const QString &CBuildConfig::gitHubRepoUrl()
{
static const QString url = "https://github.com/swift-project/pilotclient/";

View File

@@ -63,14 +63,11 @@ namespace swift::config
//! Running on Unix (Linux or Mac OS X) platform
static constexpr bool isRunningOnUnixPlatform();
//! Info such as Win32, Win64, MacOs, Linux
//! Info such as Win32, Win64, macOS, Linux
static const QString &getPlatformString();
//! Info string about compilation (short version)
static const QString &compiledWithInfoShort();
//! Info string about compilation (long version)
static const QString &compiledWithInfoLong();
//! Info string about compilation
static const QString &compiledWithInfo();
//! Executable name for swift GUI, no(!) appendix
static const QString &swiftGuiExecutableName();

View File

@@ -466,7 +466,7 @@ namespace swift::core
boolToYesNo(CBuildConfig::isRunningOnUnixPlatform()) % separator % u"MacOS: " %
boolToYesNo(CBuildConfig::isRunningOnMacOSPlatform()) % separator % "Build Abi: " %
QSysInfo::buildAbi() % separator % u"Build CPU: " % QSysInfo::buildCpuArchitecture() % separator %
CBuildConfig::compiledWithInfoLong();
CBuildConfig::compiledWithInfo();
if (this->supportsContexts()) { str += (separator % u"Supporting contexts"); }

View File

@@ -18,7 +18,7 @@ namespace swift::misc
{
CApplicationInfo::CApplicationInfo(Application app)
: m_app(app), m_wordSize(CBuildConfig::buildWordSize()), m_exePath(QCoreApplication::applicationDirPath()),
m_version(CBuildConfig::getVersionString()), m_compileInfo(CBuildConfig::compiledWithInfoShort()),
m_version(CBuildConfig::getVersionString()), m_compileInfo(CBuildConfig::compiledWithInfo()),
m_platform(CBuildConfig::getPlatformString()), m_process(CProcessInfo::currentProcess())
{
if (app == CApplicationInfo::Unknown) { m_app = guessApplication(); }