diff options
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 131 |
1 files changed, 58 insertions, 73 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 6ca2ecff91..dc7f492bb1 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -47,7 +47,6 @@ #include "qdatetime.h" #include <private/qlocale_tools_p.h> -#include <private/qsystemlibrary_p.h> #include <qmutex.h> #ifndef QT_NO_QOBJECT @@ -64,11 +63,9 @@ # include <exception> #endif -#if !defined(Q_OS_WINCE) -# include <errno.h> -# if defined(Q_CC_MSVC) -# include <crtdbg.h> -# endif +#include <errno.h> +#if defined(Q_CC_MSVC) +# include <crtdbg.h> #endif #ifdef Q_OS_WINRT @@ -573,11 +570,11 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in \snippet code/src_corelib_global_qglobal.cpp 4 The remaining functions are qRound() and qRound64(), which both - accept a \l qreal value as their argument returning the value - rounded up to the nearest integer and 64-bit integer respectively, - the qInstallMessageHandler() function which installs the given - QtMessageHandler, and the qVersion() function which returns the - version number of Qt at run-time as a string. + accept a \c double or \c float value as their argument returning + the value rounded up to the nearest integer and 64-bit integer + respectively, the qInstallMessageHandler() function which installs + the given QtMessageHandler, and the qVersion() function which + returns the version number of Qt at run-time as a string. \section1 Macros @@ -864,24 +861,44 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in \snippet code/src_corelib_global_qglobal.cpp 10 */ -/*! \fn int qRound(qreal value) +/*! \fn int qRound(double value) + \relates <QtGlobal> + + Rounds \a value to the nearest integer. + + Example: + + \snippet code/src_corelib_global_qglobal.cpp 11A +*/ + +/*! \fn int qRound(float value) \relates <QtGlobal> Rounds \a value to the nearest integer. Example: - \snippet code/src_corelib_global_qglobal.cpp 11 + \snippet code/src_corelib_global_qglobal.cpp 11B */ -/*! \fn qint64 qRound64(qreal value) +/*! \fn qint64 qRound64(double value) \relates <QtGlobal> Rounds \a value to the nearest 64-bit integer. Example: - \snippet code/src_corelib_global_qglobal.cpp 12 + \snippet code/src_corelib_global_qglobal.cpp 12A +*/ + +/*! \fn qint64 qRound64(float value) + \relates <QtGlobal> + + Rounds \a value to the nearest 64-bit integer. + + Example: + + \snippet code/src_corelib_global_qglobal.cpp 12B */ /*! \fn const T &qMin(const T &value1, const T &value2) @@ -1016,7 +1033,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in example, "4.1.2"). This may be a different version than the version the application was compiled against. - \sa QT_VERSION_STR + \sa QT_VERSION_STR, QLibraryInfo::version() */ const char *qVersion() Q_DECL_NOTHROW @@ -1147,19 +1164,11 @@ bool qSharedBuild() Q_DECL_NOTHROW \value WV_6_3 Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2 \value WV_10_0 Operating system version 10.0, corresponds to Windows 10, introduced in Qt 5.5 - CE-based versions: - - \value WV_CE Windows CE - \value WV_CENET Windows CE .NET - \value WV_CE_5 Windows CE 5.x - \value WV_CE_6 Windows CE 6.x - The following masks can be used for testing whether a Windows version is MS-DOS-based, NT-based, or CE-based: \value WV_DOS_based MS-DOS-based version of Windows \value WV_NT_based NT-based version of Windows - \value WV_CE_based CE-based version of Windows \value WV_None Operating system other than Windows. @@ -1262,7 +1271,7 @@ bool qSharedBuild() Q_DECL_NOTHROW \relates <QtGlobal> Defined on all supported versions of Windows. That is, if - \l Q_OS_WIN32, \l Q_OS_WIN64, \l Q_OS_WINCE or \l Q_OS_WINRT is defined. + \l Q_OS_WIN32, \l Q_OS_WIN64 or \l Q_OS_WINRT is defined. */ /*! @@ -1280,13 +1289,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_WINCE - \relates <QtGlobal> - - Defined on Windows CE. -*/ - -/*! \macro Q_OS_WINRT \relates <QtGlobal> @@ -1916,13 +1918,15 @@ QSysInfo::MacVersion QSysInfo::macVersion() return QSysInfo::MacVersion(Q_MV_OSX(version.major, version.minor)); #elif defined(Q_OS_IOS) return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor)); +#elif defined(Q_OS_TVOS) + return QSysInfo::MacVersion(Q_MV_TVOS(version.major, version.minor)); #else return QSysInfo::MV_Unknown; #endif } const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion(); -#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT) QT_BEGIN_INCLUDE_NAMESPACE #include "qt_windows.h" @@ -1975,9 +1979,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() { OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0}; -#ifndef Q_OS_WINCE #define GetProcAddressA GetProcAddress -#endif // GetModuleHandle is not supported in WinRT and linking to it at load time // will not pass the Windows App Certification Kit... but it exists and is functional, @@ -2052,11 +2054,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() const OSVERSIONINFOEX osver = winOsVersion(); if (osver.dwMajorVersion == 0) return QSysInfo::WV_None; -#ifdef Q_OS_WINCE - DWORD qt_cever = 0; - qt_cever = osver.dwMajorVersion * 100; - qt_cever += osver.dwMinorVersion * 10; -#endif switch (osver.dwPlatformId) { case VER_PLATFORM_WIN32s: winver = QSysInfo::WV_32s; @@ -2070,18 +2067,6 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() else winver = QSysInfo::WV_95; break; -#ifdef Q_OS_WINCE - case VER_PLATFORM_WIN32_CE: - if (qt_cever >= 600) - winver = QSysInfo::WV_CE_6; - if (qt_cever >= 500) - winver = QSysInfo::WV_CE_5; - else if (qt_cever >= 400) - winver = QSysInfo::WV_CENET; - else - winver = QSysInfo::WV_CE; - break; -#endif default: // VER_PLATFORM_WIN32_NT if (osver.dwMajorVersion < 5) { winver = QSysInfo::WV_NT; @@ -2172,15 +2157,6 @@ static const char *winVer_helper() return workstation ? "8.1" : "Server 2012 R2"; case QSysInfo::WV_WINDOWS10: return workstation ? "10" : "Server 2016"; - - case QSysInfo::WV_CE: - return "CE"; - case QSysInfo::WV_CENET: - return "CENET"; - case QSysInfo::WV_CE_5: - return "CE5"; - case QSysInfo::WV_CE_6: - return "CE6"; } // unknown, future version return 0; @@ -2438,7 +2414,7 @@ QString QSysInfo::buildCpuArchitecture() */ QString QSysInfo::currentCpuArchitecture() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // 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). @@ -2590,9 +2566,7 @@ static QString unknownText() */ QString QSysInfo::kernelType() { -#if defined(Q_OS_WINCE) - return QStringLiteral("wince"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) return QStringLiteral("winnt"); #elif defined(Q_OS_UNIX) struct utsname u; @@ -2648,16 +2622,15 @@ QString QSysInfo::kernelVersion() to determine the distribution name and returns that. If determining the distribution name failed, it returns "unknown". - \b{Darwin, OS X and iOS note}: this function returns "osx" for OS X - systems, "ios" for iOS systems and "darwin" in case the system could not be - determined. + \b{Darwin, OS X, iOS and tvOS note}: this function returns "osx" for OS X + systems, "ios" for iOS systems, "tvos" for tvOS systems and "darwin" in case + the system could not be determined. \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and "unknown" otherwise. \b{Windows note}: this function returns "winphone" for builds for Windows - Phone, "winrt" for WinRT builds, "wince" for Windows CE and Embedded - Compact builds, and "windows" for normal desktop builds. + Phone, "winrt" for WinRT builds and "windows" for normal desktop builds. For other Unix-type systems, this function usually returns "unknown". @@ -2670,8 +2643,6 @@ QString QSysInfo::productType() 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"); @@ -2683,6 +2654,8 @@ QString QSysInfo::productType() #elif defined(Q_OS_IOS) return QStringLiteral("ios"); +#elif defined(Q_OS_TVOS) + return QStringLiteral("tvos"); #elif defined(Q_OS_OSX) return QStringLiteral("osx"); #elif defined(Q_OS_DARWIN) @@ -2766,6 +2739,8 @@ QString QSysInfo::prettyProductName() { #if defined(Q_OS_IOS) return QLatin1String("iOS ") + productVersion(); +#elif defined(Q_OS_TVOS) + return QLatin1String("tvOS ") + productVersion(); #elif defined(Q_OS_OSX) // get the known codenames const char *basename = 0; @@ -2809,7 +2784,17 @@ QString QSysInfo::prettyProductName() #elif defined(Q_OS_WINPHONE) return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper()); #elif defined(Q_OS_WIN) - return QLatin1String("Windows ") + QLatin1String(winVer_helper()) + winSp_helper(); + const char *name = winVer_helper(); + const OSVERSIONINFOEX osver = winOsVersion(); + if (name) + return QLatin1String("Windows ") + QLatin1String(name) + winSp_helper() + + QLatin1String(" (") + QString::number(osver.dwMajorVersion) + + QLatin1Char('.') + QString::number(osver.dwMinorVersion) + + QLatin1Char(')'); + else + return QLatin1String("Windows ") + + QString::number(osver.dwMajorVersion) + QLatin1Char('.') + + QString::number(osver.dwMinorVersion); #elif defined(Q_OS_ANDROID) return QLatin1String("Android ") + productVersion(); #elif defined(Q_OS_HAIKU) |