diff options
author | Thiago Macieira <thiago@macieira.org> | 2014-06-15 13:57:22 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-18 04:55:23 -0700 |
commit | aad393aa4f39935eb0183daed02dc0e408758742 (patch) | |
tree | 3c6500fc4bcf278f31452cbb98f550956ab44115 /subsurfacesysinfo.h | |
parent | 44f872cc5996a50e9dec5e5321f9609d9b70d0bc (diff) | |
download | subsurface-aad393aa4f39935eb0183daed02dc0e408758742.tar.gz |
Clean up SubsurfaceSysInfo by inheriting QSysInfo
Most of the mechanics are already in QSysInfo, we only need to add the
extra details that were missing until Qt 5.4. This greatly simplifies
the code and will allow us to update it more easily from upstream.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurfacesysinfo.h')
-rw-r--r-- | subsurfacesysinfo.h | 132 |
1 files changed, 7 insertions, 125 deletions
diff --git a/subsurfacesysinfo.h b/subsurfacesysinfo.h index 896ff5899..2cd8abace 100644 --- a/subsurfacesysinfo.h +++ b/subsurfacesysinfo.h @@ -43,9 +43,12 @@ #ifndef SUBSURFACESYSINFO_H #define SUBSURFACESYSINFO_H -#include <QtGlobal> +#include <QSysInfo> #if QT_VERSION < 0x050000 +#ifdef Q_OS_MACX +# define Q_OS_OSX +#endif #if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(__arm64__) # define Q_PROCESSOR_ARM # if defined(__arm64__) @@ -200,137 +203,16 @@ #endif #endif // Qt < 5.0.0 -class QString; -class SubsurfaceSysInfo { +class SubsurfaceSysInfo : public QSysInfo { public: - enum Sizes { - WordSize = (sizeof(void *)<<3) - }; - -#ifndef QStringLiteral - // no lambdas, not GCC, or GCC in C++98 mode with 4-byte wchar_t - // fallback, return a temporary QString - // source code is assumed to be encoded in UTF-8 - -# define QStringLiteral(str) QString::fromUtf8("" str "", sizeof(str) - 1) -#endif - - -#if defined(QT_BUILD_QMAKE) - enum Endian { - BigEndian, - LittleEndian - }; - /* needed to bootstrap qmake */ - static const int ByteOrder; -#elif defined(Q_BYTE_ORDER) - enum Endian { - BigEndian, - LittleEndian - -# ifdef Q_QDOC - , ByteOrder = <platform-dependent> -# elif Q_BYTE_ORDER == Q_BIG_ENDIAN - , ByteOrder = BigEndian -# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN - , ByteOrder = LittleEndian -# else -# error "Undefined byte order" -# endif - }; -#endif -#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) - enum WinVersion { - WV_32s = 0x0001, - WV_95 = 0x0002, - WV_98 = 0x0003, - WV_Me = 0x0004, - WV_DOS_based= 0x000f, - - /* codenames */ - WV_NT = 0x0010, - WV_2000 = 0x0020, - WV_XP = 0x0030, - WV_2003 = 0x0040, - WV_VISTA = 0x0080, - WV_WINDOWS7 = 0x0090, - WV_WINDOWS8 = 0x00a0, - WV_WINDOWS8_1 = 0x00b0, - WV_NT_based = 0x00f0, - - /* version numbers */ - WV_4_0 = WV_NT, - WV_5_0 = WV_2000, - WV_5_1 = WV_XP, - WV_5_2 = WV_2003, - WV_6_0 = WV_VISTA, - WV_6_1 = WV_WINDOWS7, - WV_6_2 = WV_WINDOWS8, - WV_6_3 = WV_WINDOWS8_1, - - WV_CE = 0x0100, - WV_CENET = 0x0200, - WV_CE_5 = 0x0300, - WV_CE_6 = 0x0400, - WV_CE_based = 0x0f00 - }; - static const WinVersion WindowsVersion; - static WinVersion windowsVersion(); - -#endif -#ifdef Q_OS_MAC -# define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor) - enum MacVersion { - MV_Unknown = 0x0000, - - /* version */ - MV_9 = 0x0001, - MV_10_0 = 0x0002, - MV_10_1 = 0x0003, - MV_10_2 = 0x0004, - MV_10_3 = 0x0005, - MV_10_4 = 0x0006, - MV_10_5 = 0x0007, - MV_10_6 = 0x0008, - MV_10_7 = 0x0009, - MV_10_8 = 0x000A, - MV_10_9 = 0x000B, - MV_10_10 = 0x000C, - - /* codenames */ - MV_CHEETAH = MV_10_0, - MV_PUMA = MV_10_1, - MV_JAGUAR = MV_10_2, - MV_PANTHER = MV_10_3, - MV_TIGER = MV_10_4, - MV_LEOPARD = MV_10_5, - MV_SNOWLEOPARD = MV_10_6, - MV_LION = MV_10_7, - MV_MOUNTAINLION = MV_10_8, - MV_MAVERICKS = MV_10_9, - MV_YOSEMITE = MV_10_10, - - /* iOS */ - MV_IOS = 1 << 8, - MV_IOS_4_3 = Q_MV_IOS(4, 3), - MV_IOS_5_0 = Q_MV_IOS(5, 0), - MV_IOS_5_1 = Q_MV_IOS(5, 1), - MV_IOS_6_0 = Q_MV_IOS(6, 0), - MV_IOS_6_1 = Q_MV_IOS(6, 1), - MV_IOS_7_0 = Q_MV_IOS(7, 0), - MV_IOS_7_1 = Q_MV_IOS(7, 1), - MV_IOS_8_0 = Q_MV_IOS(8, 0) - }; - static const MacVersion MacintoshVersion; - static MacVersion macVersion(); -#endif - static QString unknownText(); +#if QT_VERSION <= 0x050400 static QString cpuArchitecture(); static QString fullCpuArchitecture(); static QString osType(); static QString osKernelVersion(); static QString osVersion(); static QString prettyOsName(); +#endif }; |