• R/O
  • HTTP
  • SSH
  • HTTPS

MUtilities: Commit

MUtilities development repository


Commit MetaInfo

Revision03dda7316547d835eb4910d66984db55758d0552 (tree)
Time2018-10-28 03:11:51
AuthorLoRd_MuldeR <mulder2@gmx....>
CommiterLoRd_MuldeR

Log Message

Some improvements to minimum OS version check.

Change Summary

Incremental Difference

--- a/include/MUtils/Startup.h
+++ b/include/MUtils/Startup.h
@@ -40,7 +40,7 @@ namespace MUtils
4040 MUTILS_API int startup(int &argc, char **argv, main_function_t *const entry_point, const char* const appName, const bool &debugConsole);
4141
4242 //Initialize Qt
43- MUTILS_API QApplication *create_qt(int &argc, char **argv, const QString &appName, const QString &appAuthor = QLatin1String("LoRd_MuldeR"), const QString &appDomain = QLatin1String("muldersoft.com"));
43+ MUTILS_API QApplication *create_qt(int &argc, char **argv, const QString &appName, const QString &appAuthor = QLatin1String("LoRd_MuldeR"), const QString &appDomain = QLatin1String("muldersoft.com"), const bool xpSupport = true);
4444 }
4545 }
4646
--- a/src/Startup.cpp
+++ b/src/Startup.cpp
@@ -244,6 +244,13 @@ int MUtils::Startup::startup(int &argc, char **argv, main_function_t *const entr
244244 static QMutex g_init_lock;
245245 static const char *const g_imageformats[] = {"bmp", "png", "jpg", "gif", "ico", "xpm", "svg", NULL};
246246
247+#define REQUIRE_OS(MIN_OS, MIN_SP) \
248+ ((osVersion.type == MUtils::OS::Version::OS_WINDOWS) && ((osVersion > MUtils::OS::Version::MIN_OS) || \
249+ ((osVersion == MUtils::OS::Version::MIN_OS) && (osVersion.versionSPack >= (MIN_SP)))))
250+
251+#define REQUIRE_SP(OS_VER, MIN_SP) \
252+ ((osVersion != MUtils::OS::Version::OS_VER) || (osVersion.versionSPack >= (MIN_SP)))
253+
247254 static FORCE_INLINE QString getExecutableName(int &argc, char **argv)
248255 {
249256 if(argc >= 1)
@@ -271,7 +278,7 @@ static FORCE_INLINE void qt_registry_cleanup(void)
271278 MUtils::Registry::reg_key_delete(MUtils::Registry::root_user, MUTILS_QSTR(QT_JUNK_KEY), true, true);
272279 }
273280
274-QApplication *MUtils::Startup::create_qt(int &argc, char **argv, const QString &appName, const QString &appAuthor, const QString &appDomain)
281+QApplication *MUtils::Startup::create_qt(int &argc, char **argv, const QString &appName, const QString &appAuthor, const QString &appDomain, const bool xpSupport)
275282 {
276283 QMutexLocker lock(&g_init_lock);
277284 const OS::ArgumentMap &arguments = MUtils::OS::arguments();
@@ -308,17 +315,28 @@ QApplication *MUtils::Startup::create_qt(int &argc, char **argv, const QString &
308315
309316 //Check the Windows version
310317 const MUtils::OS::Version::os_version_t &osVersion = MUtils::OS::os_version();
311-#ifdef QT_NODLL
312- if ((osVersion.type != MUtils::OS::Version::OS_WINDOWS) || (osVersion < MUtils::OS::Version::WINDOWS_WINXP) || ((osVersion == MUtils::OS::Version::WINDOWS_WINXP) && (osVersion.versionSPack < 3)))
318+ if (xpSupport)
319+ {
320+ if (!REQUIRE_OS(WINDOWS_WINXP, 3))
321+ {
322+ qFatal("%s", MUTILS_L1STR(QApplication::tr("Executable '%1' requires Windows XP with SP-3 or later.").arg(executableName)));
323+ }
324+ if (!REQUIRE_SP(WINDOWS_XPX64, 2))
325+ {
326+ qFatal("%s", MUTILS_L1STR(QApplication::tr("Executable '%1' requires Windows XP x64-Edition with SP-2 or later.").arg(executableName)));
327+ }
328+ }
329+ else
313330 {
314- qFatal("%s", QApplication::tr("Executable '%1' requires Windows XP with SP-3 or later.").arg(executableName).toLatin1().constData());
331+ if (!REQUIRE_OS(WINDOWS_VISTA, 2))
332+ {
333+ qFatal("%s", MUTILS_L1STR(QApplication::tr("Executable '%1' requires Windows Vista with SP-2 or later.").arg(executableName)));
334+ }
315335 }
316-#else
317- if ((osVersion.type != MUtils::OS::Version::OS_WINDOWS) || (osVersion < MUtils::OS::Version::WINDOWS_VISTA) || ((osVersion == MUtils::OS::Version::WINDOWS_VISTA) && (osVersion.versionSPack < 2)))
336+ if (osVersion == MUtils::OS::Version::WINDOWS_WIN80)
318337 {
319- qFatal("%s", QApplication::tr("Executable '%1' requires Windows Vista with SP-2 or later.").arg(executableName).toLatin1().constData());
338+ qFatal("%s", MUTILS_L1STR(QApplication::tr("Executable '%1' requires Windows 8.1 or later.").arg(executableName)));
320339 }
321-#endif
322340
323341 //Check whether we are running on a supported Windows version
324342 if(const char *const friendlyName = MUtils::OS::os_friendly_name(osVersion))
Show on old repository browser