summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-04-22 23:00:05 -0700
committerJake Petroules <jake.petroules@qt.io>2016-04-25 02:11:20 +0000
commit8093da2e512dac287c9f967f7168b2518f63dd5a (patch)
tree5905968461f58f7b9f8f2aed5066bbcc4c93b684 /src
parentf9f777c40a7d8e5f24bbdf8ee509594a0e38c56a (diff)
Append the Windows OS/kernel version number in QSysInfo::prettyProductName().
The rationale is to be consistent with other operating systems, all of which print a version number following their name (possibly in parenthesis if the version is typically non-numeric as is always the case with OS X so far and has been with Windows). The version number printed here is only two digits, both for consistency with OS X and because the first two digits of an operating systems's version are typically the limit in marketing materials and general presentation. This also fixes a bug where the returned string would be "Windows " (note the space) in the case where the name of a future Windows version was not known. [ChangeLog][QtCore][QSysInfo] The output of QSysInfo::prettyProductName now includes the Windows OS/kernel version number. In case of future versions of Windows, a valid string is now returned. Change-Id: I588c2e0aaae19337eb69b4645f8bccf8270c75bc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index fee987a80c..320fe50b4c 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2782,7 +2782,17 @@ QString QSysInfo::prettyProductName()
#elif defined(Q_OS_WINPHONE)
return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());
#elif defined(Q_OS_WIN)
- return QLatin1String("Windows ") + QLatin1String(winVer_helper()) + winSp_helper();
+ const char *name = winVer_helper();
+ const OSVERSIONINFOEX osver = winOsVersion();
+ if (name)
+ return QLatin1String("Windows ") + QLatin1String(name) + winSp_helper()
+ + QLatin1String(" (") + QString::number(osver.dwMajorVersion)
+ + QLatin1Char('.') + QString::number(osver.dwMinorVersion)
+ + QLatin1Char(')');
+ else
+ return QLatin1String("Windows ")
+ + QString::number(osver.dwMajorVersion) + QLatin1Char('.')
+ + QString::number(osver.dwMinorVersion);
#elif defined(Q_OS_ANDROID)
return QLatin1String("Android ") + productVersion();
#elif defined(Q_OS_HAIKU)