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>
This commit is contained in:
Jake Petroules 2016-04-22 23:00:05 -07:00
parent f9f777c40a
commit 8093da2e51

View File

@ -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)