From 0a74c3421dc912f055383bccac99dd6ecf886712 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 23 Sep 2015 15:07:55 +0200 Subject: [PATCH] refs #452, support for P3D in project class --- src/blackmisc/project.cpp | 34 ++++++++++++++++++++-------------- src/blackmisc/project.h | 9 ++++++++- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/blackmisc/project.cpp b/src/blackmisc/project.cpp index 261ca6d88..be10df895 100644 --- a/src/blackmisc/project.cpp +++ b/src/blackmisc/project.cpp @@ -1,6 +1,7 @@ #include "project.h" #include #include "blackmisc/blackmiscfreefunctions.h" +#include "blackmisc/simulation/simulatorinfo.h" #define BLACK_VERSION_STR_X(v) #v #define BLACK_VERSION_STR(v) BLACK_VERSION_STR_X(v) @@ -53,6 +54,16 @@ namespace BlackMisc #endif } + bool CProject::isCompiledWithP3DSupport() + { + return isCompiledWithFsxSupport(); + } + + bool CProject::isCompiledWithMsFlightSimulatorSupport() + { + return isCompiledWithFs9Support() || isCompiledWithFsxSupport() || isCompiledWithP3DSupport(); + } + bool CProject::isCompiledWithXPlaneSupport() { #ifdef WITH_XPLANE @@ -95,25 +106,20 @@ namespace BlackMisc return info; } - const QString &CProject::simulators() + const BlackMisc::Simulation::CSimulatorInfo &CProject::simulators() { - static QString sims; - if (sims.isEmpty()) - { - static QStringList sl; - if (isCompiledWithFsxSupport()) sl << "FSX"; - if (isCompiledWithXPlaneSupport()) sl << "XPlane"; - if (isCompiledWithFs9Support()) sl << "FS9"; - sims = sl.join(", "); - if (sims.isEmpty()) sims = ""; - } - return sims; + static const BlackMisc::Simulation::CSimulatorInfo simInfo( + isCompiledWithFsxSupport(), + isCompiledWithFs9Support(), + isCompiledWithXPlaneSupport(), + isCompiledWithP3DSupport() + ); + return simInfo; } const char *CProject::simulatorsChar() { - static const QByteArray a(simulators().toUtf8()); - return a.constData(); + return simulators().toQString().toUtf8().constData(); } const QString &CProject::version() diff --git a/src/blackmisc/project.h b/src/blackmisc/project.h index 699e4624d..fd8f4c322 100644 --- a/src/blackmisc/project.h +++ b/src/blackmisc/project.h @@ -11,6 +11,7 @@ #define BLACKMISC_CPROJECT_H #include "blackmiscexport.h" +#include "blackmisc/simulation/simulatorinfo.h" #include namespace BlackMisc @@ -37,6 +38,12 @@ namespace BlackMisc //! with FSX support? static bool isCompiledWithFsxSupport(); + //! with P3D support + static bool isCompiledWithP3DSupport(); + + //! Compiled with any MS Flight Simulator support (P3D, FSX, FS9) + static bool isCompiledWithMsFlightSimulatorSupport(); + //! with XPlane support? static bool isCompiledWithXPlaneSupport(); @@ -50,7 +57,7 @@ namespace BlackMisc static const QString &compiledInfo(); //! Simulator String info - static const QString &simulators(); + static const BlackMisc::Simulation::CSimulatorInfo &simulators(); //! Simulator String info static const char *simulatorsChar();