| 
									
										
										
										
											2017-04-27 20:24:53 +02:00
										 |  |  | // SPDX-License-Identifier: LGPL-2.1+
 | 
					
						
							| 
									
										
											  
											
												OS Detection
--001a113a374080d8af04fbd33a62
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Sun, Jun 15, 2014 at 1:07 AM, Thiago Macieira <thiago@macieira.org>
wrote:
> Em s=C3=A1b 14 jun 2014, =C3=A0s 15:05:24, Thiago Macieira escreveu:
>
>
> Also, please keep the original copyright headers from the files you copie=
d.
> --
>
Attached patch adds Qt copyright to both files.
--=20
Thanks,
Joshua
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jun 15, 2014 at 1:07 AM, Thiago Macieira <span dir="ltr"><<a href="mailto:thiago@macieira.org" target="_blank">thiago@macieira.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Em sáb 14 jun 2014, às 15:05:24, Thiago Macieira escreveu:<br>
<div class=""><br>
<br>
</div>Also, please keep the original copyright headers from the files you copied.<br>
<div class="HOEnZb"><div class="h5">--<br></div></div></blockquote><div><br></div><div>Attached patch adds Qt copyright to both files. </div></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Thanks,</div><div>
Joshua</div><div><b><br></b></div></div>
</div></div>
From 092bea260da8b02437c54eac51fd4fa044069e0e Mon Sep 17 00:00:00 2001
From: "Joseph W. Joshua" <joejoshw@gmail.com>
Date: Sun, 15 Jun 2014 01:20:12 +0300
Subject: [PATCH] Include Qt copyright headers in SubsurfaceSysInfo
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
											
										 
											2014-06-15 01:22:24 +03:00
										 |  |  | /****************************************************************************
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | 
					
						
							|  |  |  | ** Copyright (C) 2014 Intel Corporation | 
					
						
							|  |  |  | ** Contact: http://www.qt-project.org/legal
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** This file is part of the QtCore module of the Qt Toolkit. | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** $QT_BEGIN_LICENSE:LGPL$ | 
					
						
							|  |  |  | ** Commercial License Usage | 
					
						
							|  |  |  | ** Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | ** accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | ** Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | ** a written agreement between you and Digia.  For licensing terms and | 
					
						
							|  |  |  | ** conditions see http://qt.digia.com/licensing.  For further information
 | 
					
						
							|  |  |  | ** use the contact form at http://qt.digia.com/contact-us.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU Lesser General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
					
						
							|  |  |  | ** General Public License version 2.1 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
					
						
							|  |  |  | ** packaging of this file.  Please review the following information to | 
					
						
							|  |  |  | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
					
						
							|  |  |  | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** In addition, as a special exception, Digia gives you certain additional | 
					
						
							|  |  |  | ** rights.  These rights are described in the Digia Qt LGPL Exception | 
					
						
							|  |  |  | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** GNU General Public License Usage | 
					
						
							|  |  |  | ** Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | ** General Public License version 3.0 as published by the Free Software | 
					
						
							|  |  |  | ** Foundation and appearing in the file LICENSE.GPL included in the | 
					
						
							|  |  |  | ** packaging of this file.  Please review the following information to | 
					
						
							|  |  |  | ** ensure the GNU General Public License version 3.0 requirements will be | 
					
						
							|  |  |  | ** met: http://www.gnu.org/copyleft/gpl.html.
 | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ** $QT_END_LICENSE$ | 
					
						
							|  |  |  | ** | 
					
						
							|  |  |  | ****************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #include "subsurfacesysinfo.h"
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef Q_OS_UNIX
 | 
					
						
							|  |  |  | #include <sys/utsname.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-15 13:57:22 -07:00
										 |  |  | #ifndef QStringLiteral
 | 
					
						
							|  |  |  | #	define QStringLiteral QString::fromUtf8
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #ifdef Q_OS_UNIX
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #include <qplatformdefs.h>
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-14 13:29:13 -07:00
										 |  |  | #ifdef __APPLE__
 | 
					
						
							|  |  |  | #include <CoreServices/CoreServices.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-15 13:57:22 -07:00
										 |  |  | // --- this is a copy of Qt 5.4's src/corelib/global/archdetect.cpp ---
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | // main part: processor type
 | 
					
						
							|  |  |  | #if defined(Q_PROCESSOR_ALPHA)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "alpha"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_ARM)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "arm"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_AVR32)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "avr32"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_BLACKFIN)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "bfin"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_X86_32)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "i386"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_X86_64)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "x86_64"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_IA64)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "ia64"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_MIPS)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "mips"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_POWER)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "power"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_S390)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "s390"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_SH)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "sh"
 | 
					
						
							|  |  |  | #elif defined(Q_PROCESSOR_SPARC)
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "sparc"
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #	define ARCH_PROCESSOR "unknown"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // endinanness
 | 
					
						
							|  |  |  | #if defined(Q_LITTLE_ENDIAN)
 | 
					
						
							|  |  |  | #	define ARCH_ENDIANNESS "little_endian"
 | 
					
						
							|  |  |  | #elif defined(Q_BIG_ENDIAN)
 | 
					
						
							|  |  |  | #	define ARCH_ENDIANNESS "big_endian"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // pointer type
 | 
					
						
							|  |  |  | #if defined(Q_OS_WIN64) || (defined(Q_OS_WINRT) && defined(_M_X64))
 | 
					
						
							|  |  |  | #	define ARCH_POINTER "llp64"
 | 
					
						
							|  |  |  | #elif defined(__LP64__) || QT_POINTER_SIZE - 0 == 8
 | 
					
						
							|  |  |  | #	define ARCH_POINTER "lp64"
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #	define ARCH_POINTER "ilp32"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // secondary: ABI string (includes the dash)
 | 
					
						
							|  |  |  | #if defined(__ARM_EABI__) || defined(__mips_eabi)
 | 
					
						
							|  |  |  | #	define ARCH_ABI1 "-eabi"
 | 
					
						
							|  |  |  | #elif defined(_MIPS_SIM)
 | 
					
						
							|  |  |  | #	if _MIPS_SIM == _ABIO32
 | 
					
						
							|  |  |  | #		define ARCH_ABI1 "-o32"
 | 
					
						
							|  |  |  | #	elif _MIPS_SIM == _ABIN32
 | 
					
						
							|  |  |  | #		define ARCH_ABI1 "-n32"
 | 
					
						
							|  |  |  | #	elif _MIPS_SIM == _ABI64
 | 
					
						
							|  |  |  | #		define ARCH_ABI1 "-n64"
 | 
					
						
							|  |  |  | #	elif _MIPS_SIM == _ABIO64
 | 
					
						
							|  |  |  | #		define ARCH_ABI1 "-o64"
 | 
					
						
							|  |  |  | #	endif
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #	define ARCH_ABI1 ""
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #if defined(__ARM_PCS_VFP) || defined(__mips_hard_float)
 | 
					
						
							|  |  |  | #	define ARCH_ABI2 "-hardfloat"
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #	define ARCH_ABI2 ""
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define ARCH_ABI ARCH_ABI1 ARCH_ABI2
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define ARCH_FULL ARCH_PROCESSOR "-" ARCH_ENDIANNESS "-" ARCH_POINTER ARCH_ABI
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-15 13:57:22 -07:00
										 |  |  | // --- end of archdetect.cpp ---
 | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:50 -08:00
										 |  |  | // copied from Qt 5.4.1's src/corelib/global/qglobal.cpp
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-15 13:57:22 -07:00
										 |  |  | #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | QT_BEGIN_INCLUDE_NAMESPACE | 
					
						
							|  |  |  | #include "qt_windows.h"
 | 
					
						
							|  |  |  | QT_END_INCLUDE_NAMESPACE | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef Q_OS_WINRT
 | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:50 -08:00
										 |  |  | #  ifndef Q_OS_WINCE
 | 
					
						
							|  |  |  | // Fallback for determining Windows versions >= 8 by looping using the
 | 
					
						
							|  |  |  | // version check macros. Note that it will return build number=0 to avoid
 | 
					
						
							|  |  |  | // inefficient looping.
 | 
					
						
							|  |  |  | static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	result->dwBuildNumber = 0; | 
					
						
							|  |  |  | 	DWORDLONG conditionMask = 0; | 
					
						
							|  |  |  | 	VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); | 
					
						
							|  |  |  | 	VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); | 
					
						
							|  |  |  | 	OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0, | 
					
						
							|  |  |  | 					 result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 }; | 
					
						
							|  |  |  | 	for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion) | 
					
						
							|  |  |  | 		result->dwMajorVersion = checkVersion.dwMajorVersion; | 
					
						
							|  |  |  | 	conditionMask = 0; | 
					
						
							|  |  |  | 	checkVersion.dwMajorVersion = result->dwMajorVersion; | 
					
						
							|  |  |  | 	checkVersion.dwMinorVersion = 0; | 
					
						
							|  |  |  | 	VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL); | 
					
						
							|  |  |  | 	VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); | 
					
						
							|  |  |  | 	VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); | 
					
						
							|  |  |  | 	for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion) | 
					
						
							|  |  |  | 		result->dwMinorVersion = checkVersion.dwMinorVersion; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #  endif // !Q_OS_WINCE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | static inline OSVERSIONINFO winOsVersion() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}}; | 
					
						
							|  |  |  | 	// GetVersionEx() has been deprecated in Windows 8.1 and will return
 | 
					
						
							|  |  |  | 	// only Windows 8 from that version on.
 | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:50 -08:00
										 |  |  | #  if defined(_MSC_VER) && _MSC_VER >= 1800
 | 
					
						
							|  |  |  | #    pragma warning( push )
 | 
					
						
							|  |  |  | #    pragma warning( disable : 4996 )
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 	GetVersionEx(&result); | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:50 -08:00
										 |  |  | #  if defined(_MSC_VER) && _MSC_VER >= 1800
 | 
					
						
							|  |  |  | #    pragma warning( pop )
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #  ifndef Q_OS_WINCE
 | 
					
						
							|  |  |  | 	if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) { | 
					
						
							|  |  |  | 		determineWinOsVersionFallbackPost8(&result); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #  endif // !Q_OS_WINCE
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 	return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif // !Q_OS_WINRT
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const char *winVer_helper() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	switch (int(SubsurfaceSysInfo::WindowsVersion)) { | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_NT: | 
					
						
							|  |  |  | 		return "NT"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_2000: | 
					
						
							|  |  |  | 		return "2000"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_XP: | 
					
						
							|  |  |  | 		return "XP"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_2003: | 
					
						
							|  |  |  | 		return "2003"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_VISTA: | 
					
						
							|  |  |  | 		return "Vista"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_WINDOWS7: | 
					
						
							|  |  |  | 		return "7"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_WINDOWS8: | 
					
						
							|  |  |  | 		return "8"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_WINDOWS8_1: | 
					
						
							|  |  |  | 		return "8.1"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_CE: | 
					
						
							|  |  |  | 		return "CE"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_CENET: | 
					
						
							|  |  |  | 		return "CENET"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_CE_5: | 
					
						
							|  |  |  | 		return "CE5"; | 
					
						
							|  |  |  | 	case SubsurfaceSysInfo::WV_CE_6: | 
					
						
							|  |  |  | 		return "CE6"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	// unknown, future version
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if defined(Q_OS_UNIX)
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #  if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD)
 | 
					
						
							|  |  |  | #    define USE_ETC_OS_RELEASE
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | struct QUnixOSVersion | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	// from /etc/os-release
 | 
					
						
							|  |  |  | 	QString productType;            // $ID
 | 
					
						
							|  |  |  | 	QString productVersion;         // $VERSION_ID
 | 
					
						
							|  |  |  | 	QString prettyName;             // $PRETTY_NAME
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | static QString unquote(const char *begin, const char *end) | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-05-27 11:05:38 -07:00
										 |  |  | 	if (*begin == '"') { | 
					
						
							|  |  |  | 		Q_ASSERT(end[-1] == '"'); | 
					
						
							|  |  |  | 		return QString::fromLatin1(begin + 1, end - begin - 2); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return QString::fromLatin1(begin, end - begin); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | static bool readEtcOsRelease(QUnixOSVersion &v) | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	// we're avoiding QFile here
 | 
					
						
							|  |  |  | 	int fd = QT_OPEN("/etc/os-release", O_RDONLY); | 
					
						
							|  |  |  | 	if (fd == -1) | 
					
						
							|  |  |  | 		return false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	QT_STATBUF sbuf; | 
					
						
							|  |  |  | 	if (QT_FSTAT(fd, &sbuf) == -1) { | 
					
						
							|  |  |  | 		QT_CLOSE(fd); | 
					
						
							|  |  |  | 		return false; | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	QByteArray buffer(sbuf.st_size, Qt::Uninitialized); | 
					
						
							|  |  |  | 	buffer.resize(QT_READ(fd, buffer.data(), sbuf.st_size)); | 
					
						
							|  |  |  | 	QT_CLOSE(fd); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	const char *ptr = buffer.constData(); | 
					
						
							|  |  |  | 	const char *end = buffer.constEnd(); | 
					
						
							|  |  |  | 	const char *eol; | 
					
						
							|  |  |  | 	for ( ; ptr != end; ptr = eol + 1) { | 
					
						
							|  |  |  | 		static const char idString[] = "ID="; | 
					
						
							|  |  |  | 		static const char prettyNameString[] = "PRETTY_NAME="; | 
					
						
							|  |  |  | 		static const char versionIdString[] = "VERSION_ID="; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// find the end of the line after ptr
 | 
					
						
							|  |  |  | 		eol = static_cast<const char *>(memchr(ptr, '\n', end - ptr)); | 
					
						
							|  |  |  | 		if (!eol) | 
					
						
							|  |  |  | 			eol = end - 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// note: we're doing a binary search here, so comparison
 | 
					
						
							|  |  |  | 		// must always be sorted
 | 
					
						
							|  |  |  | 		int cmp = strncmp(ptr, idString, strlen(idString)); | 
					
						
							|  |  |  | 		if (cmp < 0) | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		if (cmp == 0) { | 
					
						
							|  |  |  | 			ptr += strlen(idString); | 
					
						
							|  |  |  | 			v.productType = unquote(ptr, eol); | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		cmp = strncmp(ptr, prettyNameString, strlen(prettyNameString)); | 
					
						
							|  |  |  | 		if (cmp < 0) | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		if (cmp == 0) { | 
					
						
							|  |  |  | 			ptr += strlen(prettyNameString); | 
					
						
							|  |  |  | 			v.prettyName = unquote(ptr, eol); | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 		cmp = strncmp(ptr, versionIdString, strlen(versionIdString)); | 
					
						
							|  |  |  | 		if (cmp < 0) | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		if (cmp == 0) { | 
					
						
							|  |  |  | 			ptr += strlen(versionIdString); | 
					
						
							|  |  |  | 			v.productVersion = unquote(ptr, eol); | 
					
						
							|  |  |  | 			continue; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return true; | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #  endif // USE_ETC_OS_RELEASE
 | 
					
						
							|  |  |  | #endif // Q_OS_UNIX
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-15 13:57:22 -07:00
										 |  |  | static QString unknownText() | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							|  |  |  | 	return QStringLiteral("unknown"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | QString SubsurfaceSysInfo::buildCpuArchitecture() | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							|  |  |  | 	return QStringLiteral(ARCH_PROCESSOR); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | QString SubsurfaceSysInfo::currentCpuArchitecture() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
 | 
					
						
							|  |  |  | 	// We don't need to catch all the CPU architectures in this function;
 | 
					
						
							|  |  |  | 	// only those where the host CPU might be different than the build target
 | 
					
						
							|  |  |  | 	// (usually, 64-bit platforms).
 | 
					
						
							|  |  |  | 	SYSTEM_INFO info; | 
					
						
							|  |  |  | 	GetNativeSystemInfo(&info); | 
					
						
							|  |  |  | 	switch (info.wProcessorArchitecture) { | 
					
						
							|  |  |  | #  ifdef PROCESSOR_ARCHITECTURE_AMD64
 | 
					
						
							|  |  |  | 	case PROCESSOR_ARCHITECTURE_AMD64: | 
					
						
							|  |  |  | 		return QStringLiteral("x86_64"); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #  ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
 | 
					
						
							|  |  |  | 	case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | 	case PROCESSOR_ARCHITECTURE_IA64: | 
					
						
							|  |  |  | 		return QStringLiteral("ia64"); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #elif defined(Q_OS_UNIX)
 | 
					
						
							|  |  |  | 	long ret = -1; | 
					
						
							|  |  |  | 	struct utsname u; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #  if defined(Q_OS_SOLARIS)
 | 
					
						
							|  |  |  | 	// We need a special call for Solaris because uname(2) on x86 returns "i86pc" for
 | 
					
						
							|  |  |  | 	// both 32- and 64-bit CPUs. Reference:
 | 
					
						
							|  |  |  | 	// http://docs.oracle.com/cd/E18752_01/html/816-5167/sysinfo-2.html#REFMAN2sysinfo-2
 | 
					
						
							|  |  |  | 	// http://fxr.watson.org/fxr/source/common/syscall/systeminfo.c?v=OPENSOLARIS
 | 
					
						
							|  |  |  | 	// http://fxr.watson.org/fxr/source/common/conf/param.c?v=OPENSOLARIS;im=10#L530
 | 
					
						
							|  |  |  | 	if (ret == -1) | 
					
						
							|  |  |  | 		ret = sysinfo(SI_ARCHITECTURE_64, u.machine, sizeof u.machine); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (ret == -1) | 
					
						
							|  |  |  | 		ret = uname(&u); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// we could use detectUnixVersion() above, but we only need a field no other function does
 | 
					
						
							|  |  |  | 	if (ret != -1) { | 
					
						
							|  |  |  | 		// the use of QT_BUILD_INTERNAL here is simply to ensure all branches build
 | 
					
						
							|  |  |  | 		// as we don't often build on some of the less common platforms
 | 
					
						
							|  |  |  | #  if defined(Q_PROCESSOR_ARM) || defined(QT_BUILD_INTERNAL)
 | 
					
						
							|  |  |  | 		if (strcmp(u.machine, "aarch64") == 0) | 
					
						
							|  |  |  | 			return QStringLiteral("arm64"); | 
					
						
							|  |  |  | 		if (strncmp(u.machine, "armv", 4) == 0) | 
					
						
							|  |  |  | 			return QStringLiteral("arm"); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #  if defined(Q_PROCESSOR_POWER) || defined(QT_BUILD_INTERNAL)
 | 
					
						
							|  |  |  | 		// harmonize "powerpc" and "ppc" to "power"
 | 
					
						
							|  |  |  | 		if (strncmp(u.machine, "ppc", 3) == 0) | 
					
						
							|  |  |  | 			return QLatin1String("power") + QLatin1String(u.machine + 3); | 
					
						
							|  |  |  | 		if (strncmp(u.machine, "powerpc", 7) == 0) | 
					
						
							|  |  |  | 			return QLatin1String("power") + QLatin1String(u.machine + 7); | 
					
						
							|  |  |  | 		if (strcmp(u.machine, "Power Macintosh") == 0) | 
					
						
							|  |  |  | 			return QLatin1String("power"); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #  if defined(Q_PROCESSOR_SPARC) || defined(QT_BUILD_INTERNAL)
 | 
					
						
							|  |  |  | 		// Solaris sysinfo(2) (above) uses "sparcv9", but uname -m says "sun4u";
 | 
					
						
							|  |  |  | 		// Linux says "sparc64"
 | 
					
						
							|  |  |  | 		if (strcmp(u.machine, "sun4u") == 0 || strcmp(u.machine, "sparc64") == 0) | 
					
						
							|  |  |  | 			return QStringLiteral("sparcv9"); | 
					
						
							|  |  |  | 		if (strcmp(u.machine, "sparc32") == 0) | 
					
						
							|  |  |  | 			return QStringLiteral("sparc"); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | #  if defined(Q_PROCESSOR_X86) || defined(QT_BUILD_INTERNAL)
 | 
					
						
							|  |  |  | 		// harmonize all "i?86" to "i386"
 | 
					
						
							|  |  |  | 		if (strlen(u.machine) == 4 && u.machine[0] == 'i' | 
					
						
							|  |  |  | 				&& u.machine[2] == '8' && u.machine[3] == '6') | 
					
						
							|  |  |  | 			return QStringLiteral("i386"); | 
					
						
							|  |  |  | 		if (strcmp(u.machine, "amd64") == 0) // Solaris
 | 
					
						
							|  |  |  | 			return QStringLiteral("x86_64"); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | 		return QString::fromLatin1(u.machine); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	return buildCpuArchitecture(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString SubsurfaceSysInfo::buildAbi() | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							|  |  |  | 	return QLatin1String(ARCH_FULL); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | QString SubsurfaceSysInfo::kernelType() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | #if defined(Q_OS_WINCE)
 | 
					
						
							|  |  |  | 	return QStringLiteral("wince"); | 
					
						
							|  |  |  | #elif defined(Q_OS_WIN)
 | 
					
						
							|  |  |  | 	return QStringLiteral("winnt"); | 
					
						
							|  |  |  | #elif defined(Q_OS_UNIX)
 | 
					
						
							|  |  |  | 	struct utsname u; | 
					
						
							|  |  |  | 	if (uname(&u) == 0) | 
					
						
							|  |  |  | 		return QString::fromLatin1(u.sysname).toLower(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	return unknownText(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString SubsurfaceSysInfo::kernelVersion() | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #ifdef Q_OS_WINRT
 | 
					
						
							|  |  |  | 	// TBD
 | 
					
						
							|  |  |  | 	return QString(); | 
					
						
							|  |  |  | #elif defined(Q_OS_WIN)
 | 
					
						
							|  |  |  | 	const OSVERSIONINFO osver = winOsVersion(); | 
					
						
							|  |  |  | 	return QString::number(int(osver.dwMajorVersion)) + QLatin1Char('.') + QString::number(int(osver.dwMinorVersion)) | 
					
						
							|  |  |  | 			+ QLatin1Char('.') + QString::number(int(osver.dwBuildNumber)); | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 	struct utsname u; | 
					
						
							|  |  |  | 	if (uname(&u) == 0) | 
					
						
							|  |  |  | 		return QString::fromLatin1(u.release); | 
					
						
							|  |  |  | 	return QString(); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString SubsurfaceSysInfo::productType() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	// similar, but not identical to QFileSelectorPrivate::platformSelectors
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #if defined(Q_OS_WINPHONE)
 | 
					
						
							|  |  |  | 	return QStringLiteral("winphone"); | 
					
						
							|  |  |  | #elif defined(Q_OS_WINRT)
 | 
					
						
							|  |  |  | 	return QStringLiteral("winrt"); | 
					
						
							|  |  |  | #elif defined(Q_OS_WINCE)
 | 
					
						
							|  |  |  | 	return QStringLiteral("wince"); | 
					
						
							|  |  |  | #elif defined(Q_OS_WIN)
 | 
					
						
							|  |  |  | 	return QStringLiteral("windows"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #elif defined(Q_OS_BLACKBERRY)
 | 
					
						
							|  |  |  | 	return QStringLiteral("blackberry"); | 
					
						
							|  |  |  | #elif defined(Q_OS_QNX)
 | 
					
						
							|  |  |  | 	return QStringLiteral("qnx"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #elif defined(Q_OS_ANDROID)
 | 
					
						
							|  |  |  | 	return QStringLiteral("android"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #elif defined(Q_OS_IOS)
 | 
					
						
							|  |  |  | 	return QStringLiteral("ios"); | 
					
						
							|  |  |  | #elif defined(Q_OS_OSX)
 | 
					
						
							|  |  |  | 	return QStringLiteral("osx"); | 
					
						
							|  |  |  | #elif defined(Q_OS_DARWIN)
 | 
					
						
							|  |  |  | 	return QStringLiteral("darwin"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX
 | 
					
						
							|  |  |  | 	QUnixOSVersion unixOsVersion; | 
					
						
							|  |  |  | 	readEtcOsRelease(unixOsVersion); | 
					
						
							|  |  |  | 	if (!unixOsVersion.productType.isEmpty()) | 
					
						
							|  |  |  | 		return unixOsVersion.productType; | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 	return unknownText(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | QString SubsurfaceSysInfo::productVersion() | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							|  |  |  | #if defined(Q_OS_IOS)
 | 
					
						
							|  |  |  | 	int major = (int(MacintoshVersion) >> 4) & 0xf; | 
					
						
							|  |  |  | 	int minor = int(MacintoshVersion) & 0xf; | 
					
						
							|  |  |  | 	if (Q_LIKELY(major < 10 && minor < 10)) { | 
					
						
							|  |  |  | 		char buf[4] = { char(major + '0'), '.', char(minor + '0'), '\0' }; | 
					
						
							|  |  |  | 		return QString::fromLatin1(buf, 3); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return QString::number(major) + QLatin1Char('.') + QString::number(minor); | 
					
						
							|  |  |  | #elif defined(Q_OS_OSX)
 | 
					
						
							|  |  |  | 	int minor = int(MacintoshVersion) - 2;  // we're not running on Mac OS 9
 | 
					
						
							|  |  |  | 	Q_ASSERT(minor < 100); | 
					
						
							|  |  |  | 	char buf[] = "10.0\0"; | 
					
						
							|  |  |  | 	if (Q_LIKELY(minor < 10)) { | 
					
						
							|  |  |  | 		buf[3] += minor; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		buf[3] += minor / 10; | 
					
						
							|  |  |  | 		buf[4] = '0' + minor % 10; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return QString::fromLatin1(buf); | 
					
						
							|  |  |  | #elif defined(Q_OS_WIN)
 | 
					
						
							|  |  |  | 	const char *version = winVer_helper(); | 
					
						
							|  |  |  | 	if (version) | 
					
						
							|  |  |  | 		return QString::fromLatin1(version).toLower(); | 
					
						
							|  |  |  | 	// fall through
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Android and Blackberry should not fall through to the Unix code
 | 
					
						
							|  |  |  | #elif defined(Q_OS_ANDROID)
 | 
					
						
							|  |  |  | 	// TBD
 | 
					
						
							|  |  |  | #elif defined(Q_OS_BLACKBERRY)
 | 
					
						
							|  |  |  | 	deviceinfo_details_t *deviceInfo; | 
					
						
							|  |  |  | 	if (deviceinfo_get_details(&deviceInfo) == BPS_SUCCESS) { | 
					
						
							|  |  |  | 		QString bbVersion = QString::fromLatin1(deviceinfo_details_get_device_os_version(deviceInfo)); | 
					
						
							|  |  |  | 		deviceinfo_free_details(&deviceInfo); | 
					
						
							|  |  |  | 		return bbVersion; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX
 | 
					
						
							|  |  |  | 	QUnixOSVersion unixOsVersion; | 
					
						
							|  |  |  | 	readEtcOsRelease(unixOsVersion); | 
					
						
							|  |  |  | 	if (!unixOsVersion.productVersion.isEmpty()) | 
					
						
							|  |  |  | 		return unixOsVersion.productVersion; | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// fallback
 | 
					
						
							|  |  |  | 	return unknownText(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | QString SubsurfaceSysInfo::prettyProductName() | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | { | 
					
						
							|  |  |  | #if defined(Q_OS_IOS)
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return QLatin1String("iOS ") + productVersion(); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #elif defined(Q_OS_OSX)
 | 
					
						
							|  |  |  | 	// get the known codenames
 | 
					
						
							|  |  |  | 	const char *basename = 0; | 
					
						
							|  |  |  | 	switch (int(MacintoshVersion)) { | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	case MV_CHEETAH: | 
					
						
							|  |  |  | 	case MV_PUMA: | 
					
						
							|  |  |  | 	case MV_JAGUAR: | 
					
						
							|  |  |  | 	case MV_PANTHER: | 
					
						
							|  |  |  | 	case MV_TIGER: | 
					
						
							|  |  |  | 		// This version of Qt does not run on those versions of OS X
 | 
					
						
							|  |  |  | 		// so this case label will never be reached
 | 
					
						
							|  |  |  | 		Q_UNREACHABLE(); | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 	case MV_LEOPARD: | 
					
						
							|  |  |  | 		basename = "Mac OS X Leopard ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case MV_SNOWLEOPARD: | 
					
						
							|  |  |  | 		basename = "Mac OS X Snow Leopard ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case MV_LION: | 
					
						
							|  |  |  | 		basename = "Mac OS X Lion ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case MV_MOUNTAINLION: | 
					
						
							|  |  |  | 		basename = "OS X Mountain Lion ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case MV_MAVERICKS: | 
					
						
							|  |  |  | 		basename = "OS X Mavericks ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2015-04-04 13:10:23 -07:00
										 |  |  | #ifdef MV_YOSEMITE
 | 
					
						
							| 
									
										
										
										
											2014-07-25 12:49:55 -07:00
										 |  |  | 	case MV_YOSEMITE: | 
					
						
							| 
									
										
										
										
											2015-04-04 13:10:23 -07:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 	case 0x000C: // MV_YOSEMITE
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 		basename = "OS X Yosemite ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2015-09-10 13:18:43 -07:00
										 |  |  | #ifdef MV_ELCAPITAN
 | 
					
						
							|  |  |  | 	case MV_ELCAPITAN : | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 	case 0x000D: // MV_ELCAPITAN
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 		basename = "OS X El Capitan ("; | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if (basename) | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 		return QLatin1String(basename) + productVersion() + QLatin1Char(')'); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// a future version of OS X
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return QLatin1String("OS X ") + productVersion(); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #elif defined(Q_OS_WINPHONE)
 | 
					
						
							|  |  |  | 	return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper()); | 
					
						
							|  |  |  | #elif defined(Q_OS_WIN)
 | 
					
						
							|  |  |  | 	return QLatin1String("Windows ") + QLatin1String(winVer_helper()); | 
					
						
							|  |  |  | #elif defined(Q_OS_ANDROID)
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return QLatin1String("Android ") + productVersion(); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #elif defined(Q_OS_BLACKBERRY)
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return QLatin1String("BlackBerry ") + productVersion(); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #elif defined(Q_OS_UNIX)
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #  ifdef USE_ETC_OS_RELEASE
 | 
					
						
							|  |  |  | 	QUnixOSVersion unixOsVersion; | 
					
						
							|  |  |  | 	readEtcOsRelease(unixOsVersion); | 
					
						
							|  |  |  | 	if (!unixOsVersion.prettyName.isEmpty()) | 
					
						
							|  |  |  | 		return unixOsVersion.prettyName; | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | 	struct utsname u; | 
					
						
							|  |  |  | 	if (uname(&u) == 0) | 
					
						
							|  |  |  | 		return QString::fromLatin1(u.sysname) + QLatin1Char(' ') + QString::fromLatin1(u.release); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return unknownText(); | 
					
						
							| 
									
										
										
										
											2014-06-14 22:27:57 +03:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-06-30 15:40:08 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | #endif // Qt >= 5.4
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QString SubsurfaceSysInfo::prettyOsName() | 
					
						
							| 
									
										
										
										
											2014-06-30 15:40:08 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	// Matches the pre-release version of Qt 5.4
 | 
					
						
							|  |  |  | 	QString pretty = prettyProductName(); | 
					
						
							|  |  |  | #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
 | 
					
						
							|  |  |  | 	// QSysInfo::kernelType() returns lowercase ("linux" instead of "Linux")
 | 
					
						
							| 
									
										
										
										
											2014-06-30 15:40:08 -07:00
										 |  |  | 	struct utsname u; | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	if (uname(&u) == 0) | 
					
						
							|  |  |  | 		return QString::fromLatin1(u.sysname) + QLatin1String(" (") + pretty + QLatin1Char(')'); | 
					
						
							| 
									
										
										
										
											2014-06-30 15:40:08 -07:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:58 -08:00
										 |  |  | 	return pretty; | 
					
						
							| 
									
										
										
										
											2014-06-30 15:40:08 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-08-22 15:22:02 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | bool isWin7Or8() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:49 -08:00
										 |  |  | #ifdef Q_OS_WIN
 | 
					
						
							| 
									
										
										
										
											2017-05-27 11:05:38 -07:00
										 |  |  | 	return (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) >= QSysInfo::WV_WINDOWS7; | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:49 -08:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2017-05-27 11:05:38 -07:00
										 |  |  | 	return false; | 
					
						
							| 
									
										
										
										
											2015-02-11 22:45:49 -08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2014-08-22 15:22:02 -07:00
										 |  |  | } | 
					
						
							|  |  |  | } |