source: subsurface/core/subsurfacesysinfo.cpp @ b368ecd

Last change on this file since b368ecd was b368ecd, checked in by Dirk Hohndel <dirk@…>, 8 months ago

Add SPDX header to remaining core files

Signed-off-by: Dirk Hohndel <dirk@…>

  • Property mode set to 100644
File size: 17.9 KB
Line 
1// SPDX-License-Identifier: LGPL-2.1+
2/****************************************************************************
3**
4** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
5** Copyright (C) 2014 Intel Corporation
6** Contact: http://www.qt-project.org/legal
7**
8** This file is part of the QtCore module of the Qt Toolkit.
9**
10** $QT_BEGIN_LICENSE:LGPL$
11** Commercial License Usage
12** Licensees holding valid commercial Qt licenses may use this file in
13** accordance with the commercial license agreement provided with the
14** Software or, alternatively, in accordance with the terms contained in
15** a written agreement between you and Digia.  For licensing terms and
16** conditions see http://qt.digia.com/licensing.  For further information
17** use the contact form at http://qt.digia.com/contact-us.
18**
19** GNU Lesser General Public License Usage
20** Alternatively, this file may be used under the terms of the GNU Lesser
21** General Public License version 2.1 as published by the Free Software
22** Foundation and appearing in the file LICENSE.LGPL included in the
23** packaging of this file.  Please review the following information to
24** ensure the GNU Lesser General Public License version 2.1 requirements
25** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26**
27** In addition, as a special exception, Digia gives you certain additional
28** rights.  These rights are described in the Digia Qt LGPL Exception
29** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30**
31** GNU General Public License Usage
32** Alternatively, this file may be used under the terms of the GNU
33** General Public License version 3.0 as published by the Free Software
34** Foundation and appearing in the file LICENSE.GPL included in the
35** packaging of this file.  Please review the following information to
36** ensure the GNU General Public License version 3.0 requirements will be
37** met: http://www.gnu.org/copyleft/gpl.html.
38**
39**
40** $QT_END_LICENSE$
41**
42****************************************************************************/
43
44#include "subsurfacesysinfo.h"
45#include <QString>
46
47#ifdef Q_OS_UNIX
48#include <sys/utsname.h>
49#endif
50
51#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
52
53#ifndef QStringLiteral
54#       define QStringLiteral QString::fromUtf8
55#endif
56
57#ifdef Q_OS_UNIX
58#include <qplatformdefs.h>
59#endif
60
61#ifdef __APPLE__
62#include <CoreServices/CoreServices.h>
63#endif
64
65// --- this is a copy of Qt 5.4's src/corelib/global/archdetect.cpp ---
66
67// main part: processor type
68#if defined(Q_PROCESSOR_ALPHA)
69#       define ARCH_PROCESSOR "alpha"
70#elif defined(Q_PROCESSOR_ARM)
71#       define ARCH_PROCESSOR "arm"
72#elif defined(Q_PROCESSOR_AVR32)
73#       define ARCH_PROCESSOR "avr32"
74#elif defined(Q_PROCESSOR_BLACKFIN)
75#       define ARCH_PROCESSOR "bfin"
76#elif defined(Q_PROCESSOR_X86_32)
77#       define ARCH_PROCESSOR "i386"
78#elif defined(Q_PROCESSOR_X86_64)
79#       define ARCH_PROCESSOR "x86_64"
80#elif defined(Q_PROCESSOR_IA64)
81#       define ARCH_PROCESSOR "ia64"
82#elif defined(Q_PROCESSOR_MIPS)
83#       define ARCH_PROCESSOR "mips"
84#elif defined(Q_PROCESSOR_POWER)
85#       define ARCH_PROCESSOR "power"
86#elif defined(Q_PROCESSOR_S390)
87#       define ARCH_PROCESSOR "s390"
88#elif defined(Q_PROCESSOR_SH)
89#       define ARCH_PROCESSOR "sh"
90#elif defined(Q_PROCESSOR_SPARC)
91#       define ARCH_PROCESSOR "sparc"
92#else
93#       define ARCH_PROCESSOR "unknown"
94#endif
95
96// endinanness
97#if defined(Q_LITTLE_ENDIAN)
98#       define ARCH_ENDIANNESS "little_endian"
99#elif defined(Q_BIG_ENDIAN)
100#       define ARCH_ENDIANNESS "big_endian"
101#endif
102
103// pointer type
104#if defined(Q_OS_WIN64) || (defined(Q_OS_WINRT) && defined(_M_X64))
105#       define ARCH_POINTER "llp64"
106#elif defined(__LP64__) || QT_POINTER_SIZE - 0 == 8
107#       define ARCH_POINTER "lp64"
108#else
109#       define ARCH_POINTER "ilp32"
110#endif
111
112// secondary: ABI string (includes the dash)
113#if defined(__ARM_EABI__) || defined(__mips_eabi)
114#       define ARCH_ABI1 "-eabi"
115#elif defined(_MIPS_SIM)
116#       if _MIPS_SIM == _ABIO32
117#               define ARCH_ABI1 "-o32"
118#       elif _MIPS_SIM == _ABIN32
119#               define ARCH_ABI1 "-n32"
120#       elif _MIPS_SIM == _ABI64
121#               define ARCH_ABI1 "-n64"
122#       elif _MIPS_SIM == _ABIO64
123#               define ARCH_ABI1 "-o64"
124#       endif
125#else
126#       define ARCH_ABI1 ""
127#endif
128#if defined(__ARM_PCS_VFP) || defined(__mips_hard_float)
129#       define ARCH_ABI2 "-hardfloat"
130#else
131#       define ARCH_ABI2 ""
132#endif
133
134#define ARCH_ABI ARCH_ABI1 ARCH_ABI2
135
136#define ARCH_FULL ARCH_PROCESSOR "-" ARCH_ENDIANNESS "-" ARCH_POINTER ARCH_ABI
137
138// --- end of archdetect.cpp ---
139// copied from Qt 5.4.1's src/corelib/global/qglobal.cpp
140
141#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
142
143QT_BEGIN_INCLUDE_NAMESPACE
144#include "qt_windows.h"
145QT_END_INCLUDE_NAMESPACE
146
147#ifndef Q_OS_WINRT
148#  ifndef Q_OS_WINCE
149// Fallback for determining Windows versions >= 8 by looping using the
150// version check macros. Note that it will return build number=0 to avoid
151// inefficient looping.
152static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result)
153{
154        result->dwBuildNumber = 0;
155        DWORDLONG conditionMask = 0;
156        VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
157        VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
158        OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0,
159                                         result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
160        for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion)
161                result->dwMajorVersion = checkVersion.dwMajorVersion;
162        conditionMask = 0;
163        checkVersion.dwMajorVersion = result->dwMajorVersion;
164        checkVersion.dwMinorVersion = 0;
165        VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL);
166        VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
167        VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
168        for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
169                result->dwMinorVersion = checkVersion.dwMinorVersion;
170}
171
172#  endif // !Q_OS_WINCE
173
174static inline OSVERSIONINFO winOsVersion()
175{
176        OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
177        // GetVersionEx() has been deprecated in Windows 8.1 and will return
178        // only Windows 8 from that version on.
179#  if defined(_MSC_VER) && _MSC_VER >= 1800
180#    pragma warning( push )
181#    pragma warning( disable : 4996 )
182#  endif
183        GetVersionEx(&result);
184#  if defined(_MSC_VER) && _MSC_VER >= 1800
185#    pragma warning( pop )
186#  endif
187#  ifndef Q_OS_WINCE
188        if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
189                determineWinOsVersionFallbackPost8(&result);
190        }
191#  endif // !Q_OS_WINCE
192        return result;
193}
194#endif // !Q_OS_WINRT
195
196static const char *winVer_helper()
197{
198        switch (int(SubsurfaceSysInfo::WindowsVersion)) {
199        case SubsurfaceSysInfo::WV_NT:
200                return "NT";
201        case SubsurfaceSysInfo::WV_2000:
202                return "2000";
203        case SubsurfaceSysInfo::WV_XP:
204                return "XP";
205        case SubsurfaceSysInfo::WV_2003:
206                return "2003";
207        case SubsurfaceSysInfo::WV_VISTA:
208                return "Vista";
209        case SubsurfaceSysInfo::WV_WINDOWS7:
210                return "7";
211        case SubsurfaceSysInfo::WV_WINDOWS8:
212                return "8";
213        case SubsurfaceSysInfo::WV_WINDOWS8_1:
214                return "8.1";
215
216        case SubsurfaceSysInfo::WV_CE:
217                return "CE";
218        case SubsurfaceSysInfo::WV_CENET:
219                return "CENET";
220        case SubsurfaceSysInfo::WV_CE_5:
221                return "CE5";
222        case SubsurfaceSysInfo::WV_CE_6:
223                return "CE6";
224        }
225        // unknown, future version
226        return 0;
227}
228#endif
229
230#if defined(Q_OS_UNIX)
231#  if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD)
232#    define USE_ETC_OS_RELEASE
233struct QUnixOSVersion
234{
235        // from /etc/os-release
236        QString productType;            // $ID
237        QString productVersion;         // $VERSION_ID
238        QString prettyName;             // $PRETTY_NAME
239};
240
241static QString unquote(const char *begin, const char *end)
242{
243    if (*begin == '"') {
244        Q_ASSERT(end[-1] == '"');
245        return QString::fromLatin1(begin + 1, end - begin - 2);
246    }
247    return QString::fromLatin1(begin, end - begin);
248}
249
250static bool readEtcOsRelease(QUnixOSVersion &v)
251{
252        // we're avoiding QFile here
253        int fd = QT_OPEN("/etc/os-release", O_RDONLY);
254        if (fd == -1)
255                return false;
256
257        QT_STATBUF sbuf;
258        if (QT_FSTAT(fd, &sbuf) == -1) {
259                QT_CLOSE(fd);
260                return false;
261        }
262
263        QByteArray buffer(sbuf.st_size, Qt::Uninitialized);
264        buffer.resize(QT_READ(fd, buffer.data(), sbuf.st_size));
265        QT_CLOSE(fd);
266
267        const char *ptr = buffer.constData();
268        const char *end = buffer.constEnd();
269        const char *eol;
270        for ( ; ptr != end; ptr = eol + 1) {
271                static const char idString[] = "ID=";
272                static const char prettyNameString[] = "PRETTY_NAME=";
273                static const char versionIdString[] = "VERSION_ID=";
274
275                // find the end of the line after ptr
276                eol = static_cast<const char *>(memchr(ptr, '\n', end - ptr));
277                if (!eol)
278                        eol = end - 1;
279
280                // note: we're doing a binary search here, so comparison
281                // must always be sorted
282                int cmp = strncmp(ptr, idString, strlen(idString));
283                if (cmp < 0)
284                        continue;
285                if (cmp == 0) {
286                        ptr += strlen(idString);
287                        v.productType = unquote(ptr, eol);
288                        continue;
289                }
290
291                cmp = strncmp(ptr, prettyNameString, strlen(prettyNameString));
292                if (cmp < 0)
293                        continue;
294                if (cmp == 0) {
295                        ptr += strlen(prettyNameString);
296                        v.prettyName = unquote(ptr, eol);
297                        continue;
298                }
299
300                cmp = strncmp(ptr, versionIdString, strlen(versionIdString));
301                if (cmp < 0)
302                        continue;
303                if (cmp == 0) {
304                        ptr += strlen(versionIdString);
305                        v.productVersion = unquote(ptr, eol);
306                        continue;
307                }
308        }
309
310        return true;
311}
312#  endif // USE_ETC_OS_RELEASE
313#endif // Q_OS_UNIX
314
315static QString unknownText()
316{
317        return QStringLiteral("unknown");
318}
319
320QString SubsurfaceSysInfo::buildCpuArchitecture()
321{
322        return QStringLiteral(ARCH_PROCESSOR);
323}
324
325QString SubsurfaceSysInfo::currentCpuArchitecture()
326{
327#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
328        // We don't need to catch all the CPU architectures in this function;
329        // only those where the host CPU might be different than the build target
330        // (usually, 64-bit platforms).
331        SYSTEM_INFO info;
332        GetNativeSystemInfo(&info);
333        switch (info.wProcessorArchitecture) {
334#  ifdef PROCESSOR_ARCHITECTURE_AMD64
335        case PROCESSOR_ARCHITECTURE_AMD64:
336                return QStringLiteral("x86_64");
337#  endif
338#  ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
339        case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
340#  endif
341        case PROCESSOR_ARCHITECTURE_IA64:
342                return QStringLiteral("ia64");
343        }
344#elif defined(Q_OS_UNIX)
345        long ret = -1;
346        struct utsname u;
347
348#  if defined(Q_OS_SOLARIS)
349        // We need a special call for Solaris because uname(2) on x86 returns "i86pc" for
350        // both 32- and 64-bit CPUs. Reference:
351        // http://docs.oracle.com/cd/E18752_01/html/816-5167/sysinfo-2.html#REFMAN2sysinfo-2
352        // http://fxr.watson.org/fxr/source/common/syscall/systeminfo.c?v=OPENSOLARIS
353        // http://fxr.watson.org/fxr/source/common/conf/param.c?v=OPENSOLARIS;im=10#L530
354        if (ret == -1)
355                ret = sysinfo(SI_ARCHITECTURE_64, u.machine, sizeof u.machine);
356#  endif
357
358        if (ret == -1)
359                ret = uname(&u);
360
361        // we could use detectUnixVersion() above, but we only need a field no other function does
362        if (ret != -1) {
363                // the use of QT_BUILD_INTERNAL here is simply to ensure all branches build
364                // as we don't often build on some of the less common platforms
365#  if defined(Q_PROCESSOR_ARM) || defined(QT_BUILD_INTERNAL)
366                if (strcmp(u.machine, "aarch64") == 0)
367                        return QStringLiteral("arm64");
368                if (strncmp(u.machine, "armv", 4) == 0)
369                        return QStringLiteral("arm");
370#  endif
371#  if defined(Q_PROCESSOR_POWER) || defined(QT_BUILD_INTERNAL)
372                // harmonize "powerpc" and "ppc" to "power"
373                if (strncmp(u.machine, "ppc", 3) == 0)
374                        return QLatin1String("power") + QLatin1String(u.machine + 3);
375                if (strncmp(u.machine, "powerpc", 7) == 0)
376                        return QLatin1String("power") + QLatin1String(u.machine + 7);
377                if (strcmp(u.machine, "Power Macintosh") == 0)
378                        return QLatin1String("power");
379#  endif
380#  if defined(Q_PROCESSOR_SPARC) || defined(QT_BUILD_INTERNAL)
381                // Solaris sysinfo(2) (above) uses "sparcv9", but uname -m says "sun4u";
382                // Linux says "sparc64"
383                if (strcmp(u.machine, "sun4u") == 0 || strcmp(u.machine, "sparc64") == 0)
384                        return QStringLiteral("sparcv9");
385                if (strcmp(u.machine, "sparc32") == 0)
386                        return QStringLiteral("sparc");
387#  endif
388#  if defined(Q_PROCESSOR_X86) || defined(QT_BUILD_INTERNAL)
389                // harmonize all "i?86" to "i386"
390                if (strlen(u.machine) == 4 && u.machine[0] == 'i'
391                                && u.machine[2] == '8' && u.machine[3] == '6')
392                        return QStringLiteral("i386");
393                if (strcmp(u.machine, "amd64") == 0) // Solaris
394                        return QStringLiteral("x86_64");
395#  endif
396                return QString::fromLatin1(u.machine);
397        }
398#endif
399        return buildCpuArchitecture();
400}
401
402
403QString SubsurfaceSysInfo::buildAbi()
404{
405        return QLatin1String(ARCH_FULL);
406}
407
408QString SubsurfaceSysInfo::kernelType()
409{
410#if defined(Q_OS_WINCE)
411        return QStringLiteral("wince");
412#elif defined(Q_OS_WIN)
413        return QStringLiteral("winnt");
414#elif defined(Q_OS_UNIX)
415        struct utsname u;
416        if (uname(&u) == 0)
417                return QString::fromLatin1(u.sysname).toLower();
418#endif
419        return unknownText();
420}
421
422QString SubsurfaceSysInfo::kernelVersion()
423{
424#ifdef Q_OS_WINRT
425        // TBD
426        return QString();
427#elif defined(Q_OS_WIN)
428        const OSVERSIONINFO osver = winOsVersion();
429        return QString::number(int(osver.dwMajorVersion)) + QLatin1Char('.') + QString::number(int(osver.dwMinorVersion))
430                        + QLatin1Char('.') + QString::number(int(osver.dwBuildNumber));
431#else
432        struct utsname u;
433        if (uname(&u) == 0)
434                return QString::fromLatin1(u.release);
435        return QString();
436#endif
437}
438
439QString SubsurfaceSysInfo::productType()
440{
441        // similar, but not identical to QFileSelectorPrivate::platformSelectors
442#if defined(Q_OS_WINPHONE)
443        return QStringLiteral("winphone");
444#elif defined(Q_OS_WINRT)
445        return QStringLiteral("winrt");
446#elif defined(Q_OS_WINCE)
447        return QStringLiteral("wince");
448#elif defined(Q_OS_WIN)
449        return QStringLiteral("windows");
450
451#elif defined(Q_OS_BLACKBERRY)
452        return QStringLiteral("blackberry");
453#elif defined(Q_OS_QNX)
454        return QStringLiteral("qnx");
455
456#elif defined(Q_OS_ANDROID)
457        return QStringLiteral("android");
458
459#elif defined(Q_OS_IOS)
460        return QStringLiteral("ios");
461#elif defined(Q_OS_OSX)
462        return QStringLiteral("osx");
463#elif defined(Q_OS_DARWIN)
464        return QStringLiteral("darwin");
465
466#elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX
467        QUnixOSVersion unixOsVersion;
468        readEtcOsRelease(unixOsVersion);
469        if (!unixOsVersion.productType.isEmpty())
470                return unixOsVersion.productType;
471#endif
472        return unknownText();
473}
474
475QString SubsurfaceSysInfo::productVersion()
476{
477#if defined(Q_OS_IOS)
478        int major = (int(MacintoshVersion) >> 4) & 0xf;
479        int minor = int(MacintoshVersion) & 0xf;
480        if (Q_LIKELY(major < 10 && minor < 10)) {
481                char buf[4] = { char(major + '0'), '.', char(minor + '0'), '\0' };
482                return QString::fromLatin1(buf, 3);
483        }
484        return QString::number(major) + QLatin1Char('.') + QString::number(minor);
485#elif defined(Q_OS_OSX)
486        int minor = int(MacintoshVersion) - 2;  // we're not running on Mac OS 9
487        Q_ASSERT(minor < 100);
488        char buf[] = "10.0\0";
489        if (Q_LIKELY(minor < 10)) {
490                buf[3] += minor;
491        } else {
492                buf[3] += minor / 10;
493                buf[4] = '0' + minor % 10;
494        }
495        return QString::fromLatin1(buf);
496#elif defined(Q_OS_WIN)
497        const char *version = winVer_helper();
498        if (version)
499                return QString::fromLatin1(version).toLower();
500        // fall through
501
502        // Android and Blackberry should not fall through to the Unix code
503#elif defined(Q_OS_ANDROID)
504        // TBD
505#elif defined(Q_OS_BLACKBERRY)
506        deviceinfo_details_t *deviceInfo;
507        if (deviceinfo_get_details(&deviceInfo) == BPS_SUCCESS) {
508                QString bbVersion = QString::fromLatin1(deviceinfo_details_get_device_os_version(deviceInfo));
509                deviceinfo_free_details(&deviceInfo);
510                return bbVersion;
511        }
512#elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX
513        QUnixOSVersion unixOsVersion;
514        readEtcOsRelease(unixOsVersion);
515        if (!unixOsVersion.productVersion.isEmpty())
516                return unixOsVersion.productVersion;
517#endif
518
519        // fallback
520        return unknownText();
521}
522
523QString SubsurfaceSysInfo::prettyProductName()
524{
525#if defined(Q_OS_IOS)
526        return QLatin1String("iOS ") + productVersion();
527#elif defined(Q_OS_OSX)
528        // get the known codenames
529        const char *basename = 0;
530        switch (int(MacintoshVersion)) {
531        case MV_CHEETAH:
532        case MV_PUMA:
533        case MV_JAGUAR:
534        case MV_PANTHER:
535        case MV_TIGER:
536                // This version of Qt does not run on those versions of OS X
537                // so this case label will never be reached
538                Q_UNREACHABLE();
539                break;
540        case MV_LEOPARD:
541                basename = "Mac OS X Leopard (";
542                break;
543        case MV_SNOWLEOPARD:
544                basename = "Mac OS X Snow Leopard (";
545                break;
546        case MV_LION:
547                basename = "Mac OS X Lion (";
548                break;
549        case MV_MOUNTAINLION:
550                basename = "OS X Mountain Lion (";
551                break;
552        case MV_MAVERICKS:
553                basename = "OS X Mavericks (";
554                break;
555#ifdef MV_YOSEMITE
556        case MV_YOSEMITE:
557#else
558        case 0x000C: // MV_YOSEMITE
559#endif
560                basename = "OS X Yosemite (";
561                break;
562#ifdef MV_ELCAPITAN
563        case MV_ELCAPITAN :
564#else
565        case 0x000D: // MV_ELCAPITAN
566#endif
567                basename = "OS X El Capitan (";
568                break;
569        }
570        if (basename)
571                return QLatin1String(basename) + productVersion() + QLatin1Char(')');
572
573        // a future version of OS X
574        return QLatin1String("OS X ") + productVersion();
575#elif defined(Q_OS_WINPHONE)
576        return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());
577#elif defined(Q_OS_WIN)
578        return QLatin1String("Windows ") + QLatin1String(winVer_helper());
579#elif defined(Q_OS_ANDROID)
580        return QLatin1String("Android ") + productVersion();
581#elif defined(Q_OS_BLACKBERRY)
582        return QLatin1String("BlackBerry ") + productVersion();
583#elif defined(Q_OS_UNIX)
584#  ifdef USE_ETC_OS_RELEASE
585        QUnixOSVersion unixOsVersion;
586        readEtcOsRelease(unixOsVersion);
587        if (!unixOsVersion.prettyName.isEmpty())
588                return unixOsVersion.prettyName;
589#  endif
590        struct utsname u;
591        if (uname(&u) == 0)
592                return QString::fromLatin1(u.sysname) + QLatin1Char(' ') + QString::fromLatin1(u.release);
593#endif
594        return unknownText();
595}
596
597#endif // Qt >= 5.4
598
599QString SubsurfaceSysInfo::prettyOsName()
600{
601        // Matches the pre-release version of Qt 5.4
602        QString pretty = prettyProductName();
603#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
604        // QSysInfo::kernelType() returns lowercase ("linux" instead of "Linux")
605        struct utsname u;
606        if (uname(&u) == 0)
607                return QString::fromLatin1(u.sysname) + QLatin1String(" (") + pretty + QLatin1Char(')');
608#endif
609        return pretty;
610}
611
612extern "C" {
613bool isWin7Or8()
614{
615#ifdef Q_OS_WIN
616       return (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) >= QSysInfo::WV_WINDOWS7;
617#else
618       return false;
619#endif
620}
621}
Note: See TracBrowser for help on using the repository browser.