From b6dd06460847626f268e3fe9e39c5a1a4e7c442c Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 28 Oct 2018 14:41:52 +0100 Subject: [PATCH] Small improvement to operating system detection. --- src/Startup.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/Startup.cpp b/src/Startup.cpp index e71936a..3ac83ea 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -313,8 +313,18 @@ QApplication *MUtils::Startup::create_qt(int &argc, char **argv, const QString & qDebug("Compiled with Qt v%s\n", QT_VERSION_STR); #endif - //Check the Windows version + //Detect the operating system version const MUtils::OS::Version::os_version_t &osVersion = MUtils::OS::os_version(); + if (const char *const friendlyName = MUtils::OS::os_friendly_name(osVersion)) + { + qDebug("Running on %s (NT v%u.%u.%u-sp%u).\n", friendlyName, osVersion.versionMajor, osVersion.versionMinor, osVersion.versionBuild, osVersion.versionSPack); + } + else + { + qWarning("Running on an unknown WindowsNT-based system (v%u.%u.%u-sp%u).\n", osVersion.versionMajor, osVersion.versionMinor, osVersion.versionBuild, osVersion.versionSPack); + } + + //Check whether we are running on a supported Windows version if (xpSupport) { if (!REQUIRE_OS(WINDOWS_WINXP, 3)) @@ -338,18 +348,6 @@ QApplication *MUtils::Startup::create_qt(int &argc, char **argv, const QString & qFatal("%s", MUTILS_L1STR(QApplication::tr("Executable '%1' requires Windows 8.1 or later.").arg(executableName))); } - //Check whether we are running on a supported Windows version - if(const char *const friendlyName = MUtils::OS::os_friendly_name(osVersion)) - { - qDebug("Running on %s (NT v%u.%u.%u-sp%u).\n", friendlyName, osVersion.versionMajor, osVersion.versionMinor, osVersion.versionBuild, osVersion.versionSPack); - } - else - { - const QString message = QString().sprintf("Running on an unknown WindowsNT-based system (NT v%u.%u.%u-sp%u).", osVersion.versionMajor, osVersion.versionMinor, osVersion.versionBuild, osVersion.versionSPack); - qWarning("%s\n", MUTILS_UTF8(message)); - MUtils::OS::system_message_wrn(MUTILS_WCHR(executableName), MUTILS_WCHR(message)); - } - //Check for compat mode if(osVersion.overrideFlag && (osVersion <= MUtils::OS::Version::WINDOWS_WN100)) {