From cf10521b1ef0a55940ae6b0c5d38f88941d037e9 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Mon, 22 Dec 2014 21:54:12 +0100 Subject: [PATCH] Add basic Windows runtime version support --- src/libtomahawk/utils/TomahawkUtils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp index b7f5ffd7f..048286108 100644 --- a/src/libtomahawk/utils/TomahawkUtils.cpp +++ b/src/libtomahawk/utils/TomahawkUtils.cpp @@ -628,6 +628,21 @@ operatingSystemVersionDetail() { #ifdef Q_OS_LINUX return QSettings( "/etc/os-release", QSettings::IniFormat ).value( "PRETTY_NAME", "Linux" ).toString(); +#elif defined ( Q_OS_WIN ) + QString version( "Windows" ); + OSVERSIONINFOEX osvi; + BOOL bOsVersionInfoEx; + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); + if(bOsVersionInfoEx == 0) + return version; + + version.append( QString( " %1.%2" ).arg( osvi.dwMajorVersion ).arg( osvi.dwMinorVersion ) ); + + return version; #else return "Unknown"; #endif