summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorAndré Klitzing <aklitzing@gmail.com>2015-12-08 09:08:31 +0100
committerAndré Klitzing <aklitzing@gmail.com>2016-01-04 13:29:31 +0000
commit0cd73f23f2ed3752b488e70f901c1bc43eceba2e (patch)
tree01448049cb8d483e692cbd04b8fcb2bc3b6f4009 /src/corelib/global
parenta862474839fde920d49909e6ae7a1129989dc07b (diff)
Print correct OS name if it is a server version
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833%28v=vs.85%29.aspx Change-Id: I7ee4c78959696ee2b662899a6a1408cfd1ebcacd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 3775cd421f..a8385d3174 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2104,6 +2104,8 @@ static QString winSp_helper()
static const char *winVer_helper()
{
+ const bool workstation = winOsVersion().wProductType == VER_NT_WORKSTATION;
+
switch (int(QSysInfo::WindowsVersion)) {
case QSysInfo::WV_NT:
return "NT";
@@ -2114,15 +2116,15 @@ static const char *winVer_helper()
case QSysInfo::WV_2003:
return "2003";
case QSysInfo::WV_VISTA:
- return "Vista";
+ return workstation ? "Vista" : "Server 2008";
case QSysInfo::WV_WINDOWS7:
- return "7";
+ return workstation ? "7" : "Server 2008 R2";
case QSysInfo::WV_WINDOWS8:
- return "8";
+ return workstation ? "8" : "Server 2012";
case QSysInfo::WV_WINDOWS8_1:
- return "8.1";
+ return workstation ? "8.1" : "Server 2012 R2";
case QSysInfo::WV_WINDOWS10:
- return "10";
+ return workstation ? "10" : "Server 2016";
case QSysInfo::WV_CE:
return "CE";
@@ -2679,8 +2681,10 @@ QString QSysInfo::productVersion()
return QString::number(version.major) + QLatin1Char('.') + QString::number(version.minor);
#elif defined(Q_OS_WIN)
const char *version = winVer_helper();
- if (version)
- return QString::fromLatin1(version).toLower() + winSp_helper().remove(QLatin1Char(' ')).toLower();
+ if (version) {
+ const QLatin1Char spaceChar(' ');
+ return QString::fromLatin1(version).remove(spaceChar).toLower() + winSp_helper().remove(spaceChar).toLower();
+ }
// fall through
// Android should not fall through to the Unix code