From 988251b079b429e7beff9afb30dc22077e69b5e4 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Tue, 24 May 2016 23:47:34 +0200 Subject: [PATCH] refs #661, default value for enabled simulators --- src/blackconfig/buildconfig.cpp | 11 +++++++++++ src/blackconfig/buildconfig.h | 3 +++ src/blackcore/settings/application.h | 28 +++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/blackconfig/buildconfig.cpp b/src/blackconfig/buildconfig.cpp index c000c80cf..88106d122 100644 --- a/src/blackconfig/buildconfig.cpp +++ b/src/blackconfig/buildconfig.cpp @@ -65,6 +65,17 @@ namespace BlackConfig #endif } + bool CBuildConfig::isRunningOnWindows10() + { +#ifdef Q_OS_WIN + // QSysInfo::WindowsVersion only available on Win platforms + if (!isRunningOnWindowsNtPlatform()) { return false; } + return (QSysInfo::WindowsVersion == QSysInfo::WV_10_0); +#else + return false; +#endif + } + bool CBuildConfig::isRunningOnMacOSXPlatform() { #ifdef Q_OS_OSX diff --git a/src/blackconfig/buildconfig.h b/src/blackconfig/buildconfig.h index 8620a5a96..383f15edd 100644 --- a/src/blackconfig/buildconfig.h +++ b/src/blackconfig/buildconfig.h @@ -72,6 +72,9 @@ namespace BlackConfig //! Running on Windows NT platform? static bool isRunningOnWindowsNtPlatform(); + //! Windows 10 + static bool isRunningOnWindows10(); + //! Running on Mac OS X platform? static bool isRunningOnMacOSXPlatform(); diff --git a/src/blackcore/settings/application.h b/src/blackcore/settings/application.h index b5f5d4477..d7b995792 100644 --- a/src/blackcore/settings/application.h +++ b/src/blackcore/settings/application.h @@ -13,6 +13,7 @@ #define BLACKCORE_SETTINGS_APPLICATION_H #include "blackmisc/settingscache.h" +#include "blackconfig/buildconfig.h" #include "blackmisc/input/actionhotkeylist.h" #include @@ -51,14 +52,35 @@ namespace BlackCore static const QStringList &defaultValue() { // All default simulators - static const QStringList enabledSimulators + static const QStringList enabledSimulators(defaultValueImpl()); + return enabledSimulators; + } + + private: + //! Determine default value + static QStringList defaultValueImpl() + { + if (BlackConfig::CBuildConfig::isRunningOnWindows10()) + { + // On WIN10 we have no direct play, so disable FS9 as per default + return QStringList + { + QStringLiteral("org.swift-project.plugins.simulator.fsx"), + QStringLiteral("org.swift-project.plugins.simulator.xplane") + }; + } + else if (BlackConfig::CBuildConfig::isRunningOnUnixPlatform()) + { + // On UNIX we likely run XP + return QStringList { QStringLiteral("org.swift-project.plugins.simulator.xplane") }; + } + + return QStringList { QStringLiteral("org.swift-project.plugins.simulator.fs9"), QStringLiteral("org.swift-project.plugins.simulator.fsx"), QStringLiteral("org.swift-project.plugins.simulator.xplane") }; - - return enabledSimulators; } }; } // ns