diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:16:29 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-10-11 16:23:19 +0200 |
commit | f4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (patch) | |
tree | 4119707660438ff58bd51f9cbe0f9e2a33f4b806 /src/corelib/global | |
parent | 9bd6cec74dbbc5aece55dc0c8808494db29b9963 (diff) | |
parent | 93f2f33a49f6c96a4f94f344edf03164ed944d02 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qconfig-bootstrapped.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 55 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 12 | ||||
-rw-r--r-- | src/corelib/global/qglobalstatic.h | 3 | ||||
-rw-r--r-- | src/corelib/global/qhooks.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 5 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 10 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 22 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.cpp | 8 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.h | 1 | ||||
-rw-r--r-- | src/corelib/global/qsystemdetection.h | 14 |
12 files changed, 110 insertions, 30 deletions
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 10458e41d7..2e58dabf5f 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -79,12 +79,16 @@ #define QT_NO_DATASTREAM #define QT_FEATURE_datestring 1 #define QT_FEATURE_datetimeparser -1 +#define QT_FEATURE_easingcurve -1 #define QT_FEATURE_etw -1 #define QT_FEATURE_getauxval (QT_HAS_INCLUDE(<sys/auxv.h>) ? 1 : -1) #define QT_FEATURE_getentropy -1 #define QT_NO_GEOM_VARIANT +#define QT_FEATURE_hijricalendar -1 #define QT_FEATURE_iconv -1 #define QT_FEATURE_icu -1 +#define QT_FEATURE_islamiccivilcalendar -1 +#define QT_FEATURE_jalalicalendar -1 #define QT_FEATURE_journald -1 #define QT_FEATURE_futimens -1 #define QT_FEATURE_futimes -1 diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index a8ed8ca6fd..2b1a40cf4c 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -52,6 +52,7 @@ #include <private/qlocale_tools_p.h> #include <qmutex.h> +#include <QtCore/private/qlocking_p.h> #include <stdlib.h> #include <limits.h> @@ -88,6 +89,11 @@ # include <sys/systeminfo.h> #endif +#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE(<IOKit/IOKitLib.h>) +# include <IOKit/IOKitLib.h> +# include <private/qcore_mac_p.h> +#endif + #ifdef Q_OS_UNIX #include <sys/utsname.h> #include <private/qcore_unix_p.h> @@ -1194,11 +1200,14 @@ bool qSharedBuild() noexcept the application is compiled (32 or 64). */ +#if QT_DEPRECATED_SINCE(5, 9) /*! \deprecated \variable QSysInfo::WindowsVersion \brief the version of the Windows operating system on which the application is run. + + Use QOperatingSystemVersion::current() instead. */ /*! @@ -1206,6 +1215,8 @@ bool qSharedBuild() noexcept \fn QSysInfo::WindowsVersion QSysInfo::windowsVersion() \since 4.4 + Use QOperatingSystemVersion::current() instead. + Returns the version of the Windows operating system on which the application is run, or WV_None if the operating system is not Windows. @@ -1216,16 +1227,21 @@ bool qSharedBuild() noexcept \variable QSysInfo::MacintoshVersion \brief the version of the Macintosh operating system on which the application is run. + + Use QOperatingSystemVersion::current() instead. */ /*! \deprecated \fn QSysInfo::MacVersion QSysInfo::macVersion() + Use QOperatingSystemVersion::current() instead. + Returns the version of Darwin (\macos or iOS) on which the application is run, or MV_None if the operating system is not a version of Darwin. */ +#endif /*! \enum QSysInfo::Endian @@ -1236,10 +1252,13 @@ bool qSharedBuild() noexcept the platform's byte order. */ +#if QT_DEPRECATED_SINCE(5, 9) /*! \deprecated \enum QSysInfo::WinVersion + Use the versions defined in QOperatingSystemVersion instead. + This enum provides symbolic names for the various versions of the Windows operating system. On Windows, the QSysInfo::WindowsVersion variable gives the version of the system @@ -1297,6 +1316,8 @@ bool qSharedBuild() noexcept \deprecated \enum QSysInfo::MacVersion + Use the versions defined in QOperatingSystemVersion instead. + This enum provides symbolic names for the various versions of the Darwin operating system, covering both \macos and iOS. The QSysInfo::MacintoshVersion variable gives the version of the @@ -1367,6 +1388,7 @@ bool qSharedBuild() noexcept \sa WinVersion */ +#endif /*! \macro Q_OS_DARWIN @@ -2996,20 +3018,19 @@ enum { */ QByteArray QSysInfo::machineUniqueId() { -#ifdef Q_OS_BSD4 +#if defined(Q_OS_DARWIN) && QT_HAS_INCLUDE(<IOKit/IOKitLib.h>) + char uuid[UuidStringLen + 1]; + io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +#elif defined(Q_OS_BSD4) && defined(KERN_HOSTUUID) char uuid[UuidStringLen + 1]; size_t uuidlen = sizeof(uuid); -# ifdef KERN_HOSTUUID int name[] = { CTL_KERN, KERN_HOSTUUID }; if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) return QByteArray(uuid, uuidlen - 1); - -# else - // Darwin: no fixed value, we need to search by name - if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) - return QByteArray(uuid, uuidlen - 1); -# endif #elif defined(Q_OS_UNIX) // The modern name on Linux is /etc/machine-id, but that path is // unlikely to exist on non-Linux (non-systemd) systems. The old @@ -3347,7 +3368,7 @@ static QBasicMutex environmentMutex; */ void qTzSet() { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #if defined(Q_OS_WIN) _tzset(); #else @@ -3361,7 +3382,7 @@ void qTzSet() */ time_t qMkTime(struct tm *when) { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); return mktime(when); } @@ -3393,7 +3414,7 @@ time_t qMkTime(struct tm *when) */ QByteArray qgetenv(const char *varName) { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #ifdef Q_CC_MSVC size_t requiredSize = 0; QByteArray buffer; @@ -3461,7 +3482,7 @@ QByteArray qgetenv(const char *varName) QString qEnvironmentVariable(const char *varName, const QString &defaultValue) { #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); QVarLengthArray<wchar_t, 32> wname(int(strlen(varName)) + 1); for (int i = 0; i < wname.size(); ++i) // wname.size() is correct: will copy terminating null wname[i] = uchar(varName[i]); @@ -3509,7 +3530,7 @@ QString qEnvironmentVariable(const char *varName) */ bool qEnvironmentVariableIsEmpty(const char *varName) noexcept { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #ifdef Q_CC_MSVC // we provide a buffer that can only hold the empty string, so // when the env.var isn't empty, we'll get an ERANGE error (buffer @@ -3548,7 +3569,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept static const int MaxDigitsForOctalInt = (std::numeric_limits<uint>::digits + NumBinaryDigitsPerOctalDigit - 1) / NumBinaryDigitsPerOctalDigit; - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #ifdef Q_CC_MSVC // we provide a buffer that can hold any int value: char buffer[MaxDigitsForOctalInt + 2]; // +1 for NUL +1 for optional '-' @@ -3613,7 +3634,7 @@ int qEnvironmentVariableIntValue(const char *varName, bool *ok) noexcept */ bool qEnvironmentVariableIsSet(const char *varName) noexcept { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #ifdef Q_CC_MSVC size_t requiredSize = 0; (void)getenv_s(&requiredSize, 0, 0, varName); @@ -3643,7 +3664,7 @@ bool qEnvironmentVariableIsSet(const char *varName) noexcept */ bool qputenv(const char *varName, const QByteArray& value) { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #if defined(Q_CC_MSVC) return _putenv_s(varName, value.constData()) == 0; #elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_HAIKU) @@ -3674,7 +3695,7 @@ bool qputenv(const char *varName, const QByteArray& value) */ bool qunsetenv(const char *varName) { - QMutexLocker locker(&environmentMutex); + const auto locker = qt_scoped_lock(environmentMutex); #if defined(Q_CC_MSVC) return _putenv_s(varName, "") == 0; #elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_BSD4) || defined(Q_OS_HAIKU) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 736378508f..7db7dba9b5 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -383,6 +383,14 @@ typedef double qreal; #define QT_DEPRECATED_VERSION_5(minor) QT_DEPRECATED_VERSION_5_##minor #define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major(minor) +#ifdef __cplusplus +// A tag to help mark stuff deprecated (cf. QStringViewLiteral) +namespace QtPrivate { +enum class Deprecated_t {}; +constexpr Q_DECL_UNUSED Deprecated_t Deprecated = {}; +} +#endif + /* The Qt modules' export macros. The options are: @@ -843,10 +851,6 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) # endif #endif -#if defined(QT_NO_DEBUG) && !defined(QT_PAINT_DEBUG) -#define QT_NO_PAINT_DEBUG -#endif - #ifndef Q_CC_MSVC Q_NORETURN #endif diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index 7a7d65ed76..e56fe1dbcb 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -98,6 +98,7 @@ enum GuardValues { QT_END_NAMESPACE #include <QtCore/qmutex.h> +#include <mutex> QT_BEGIN_NAMESPACE #define Q_GLOBAL_STATIC_INTERNAL(ARGS) \ @@ -107,7 +108,7 @@ QT_BEGIN_NAMESPACE static QBasicMutex mutex; \ int x = guard.loadAcquire(); \ if (Q_UNLIKELY(x >= QtGlobalStatic::Uninitialized)) { \ - QMutexLocker locker(&mutex); \ + const std::lock_guard<QBasicMutex> locker(mutex); \ if (guard.loadRelaxed() == QtGlobalStatic::Uninitialized) { \ d = new Type ARGS; \ static struct Cleanup { \ diff --git a/src/corelib/global/qhooks.cpp b/src/corelib/global/qhooks.cpp index 020dee3710..79f9b7d6c2 100644 --- a/src/corelib/global/qhooks.cpp +++ b/src/corelib/global/qhooks.cpp @@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = { // The required sizes and offsets are tested in tests/auto/other/toolsupport. // When this fails and the change was intentional, adjust the test and // adjust this value here. - 17 + 18 }; Q_STATIC_ASSERT(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0])); diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index e82939dcd9..2b271ef5be 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -322,8 +322,10 @@ QLibraryInfo::buildDate() #elif defined(Q_CC_MSVC) # if _MSC_VER < 1910 # define COMPILER_STRING "MSVC 2015" -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1917 # define COMPILER_STRING "MSVC 2017" +# elif _MSC_VER < 2000 +# define COMPILER_STRING "MSVC 2019" # else # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER) # endif diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index f635a84e21..a97a496290 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -49,6 +49,7 @@ #include "qvarlengtharray.h" #include "qdebug.h" #include "qmutex.h" +#include <QtCore/private/qlocking_p.h> #include "qloggingcategory.h" #ifndef QT_BOOTSTRAPPED #include "qelapsedtimer.h" @@ -1375,7 +1376,7 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con { QString message; - QMutexLocker lock(&QMessagePattern::mutex); + const auto locker = qt_scoped_lock(QMessagePattern::mutex); QMessagePattern *pattern = qMessagePattern(); if (!pattern) { @@ -2091,7 +2092,7 @@ QtMsgHandler qInstallMsgHandler(QtMsgHandler h) void qSetMessagePattern(const QString &pattern) { - QMutexLocker lock(&QMessagePattern::mutex); + const auto locker = qt_scoped_lock(QMessagePattern::mutex); if (!qMessagePattern()->fromEnvironment) qMessagePattern()->setPattern(pattern); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index f5f7176670..810c55709c 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1754,6 +1754,15 @@ public: ChecksumItuV41 }; + enum class HighDpiScaleFactorRoundingPolicy { + Unset, + Round, + Ceil, + Floor, + RoundPreferFloor, + PassThrough + }; + #ifndef Q_QDOC // NOTE: Generally, do not add QT_Q_ENUM if a corresponding Q_Q_FLAG exists. QT_Q_ENUM(ScrollBarPolicy) @@ -1840,6 +1849,7 @@ public: QT_Q_ENUM(MouseEventSource) QT_Q_FLAG(MouseEventFlag) QT_Q_ENUM(ChecksumType) + QT_Q_ENUM(HighDpiScaleFactorRoundingPolicy) QT_Q_ENUM(TabFocusBehavior) #endif // Q_DOC diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 0ff6be2049..886aedb4f3 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3275,3 +3275,25 @@ \value ChecksumItuV41 Checksum calculation based on ITU-V.41. */ + +/*! + \enum Qt::HighDpiScaleFactorRoundingPolicy + \since 5.14 + + This enum describes the possible High-DPI scale factor rounding policies, which + decide how non-integer scale factors (such as Windows 150%) are handled. + + The active policy is set by calling QGuiApplication::setHighDdpiScaleFactorRoundingPolicy() before + the application object is created, or by setting the QT_SCALE_FACTOR_ROUNDING_POLICY + environment variable. + + \sa QGuiApplication::setHighDdpiScaleFactorRoundingPolicy() + \sa AA_EnableHighDpiScaling. + + \omitvalue Unset + \value Round Round up for .5 and above. + \value Ceil Always round up. + \value Floor Always round down. + \value RoundPreferFloor Round up for .75 and above. + \value PassThrough Don't round. +*/ diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 9084ad933c..ded86cbc4e 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -444,6 +444,14 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSMojave = QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14); /*! + \variable QOperatingSystemVersion::MacOSCatalina + \brief a version corresponding to macOS Catalina (version 10.15). + \since 5.12.5 + */ +const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina = + QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15); + +/*! \variable QOperatingSystemVersion::AndroidJellyBean \brief a version corresponding to Android Jelly Bean (version 4.1, API level 16). \since 5.9 diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 75c54b60df..879bd379b0 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -72,6 +72,7 @@ public: static const QOperatingSystemVersion MacOSSierra; static const QOperatingSystemVersion MacOSHighSierra; static const QOperatingSystemVersion MacOSMojave; + static const QOperatingSystemVersion MacOSCatalina; static const QOperatingSystemVersion AndroidJellyBean; static const QOperatingSystemVersion AndroidJellyBean_MR1; diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 4ebbe16ead..a020788b11 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -240,17 +240,23 @@ # if !defined(__MAC_10_14) # define __MAC_10_14 101400 # endif +# if !defined(__MAC_10_15) +# define __MAC_10_15 101500 +# endif # if !defined(MAC_OS_X_VERSION_10_11) -# define MAC_OS_X_VERSION_10_11 101100 +# define MAC_OS_X_VERSION_10_11 __MAC_10_11 # endif # if !defined(MAC_OS_X_VERSION_10_12) -# define MAC_OS_X_VERSION_10_12 101200 +# define MAC_OS_X_VERSION_10_12 __MAC_10_12 # endif # if !defined(MAC_OS_X_VERSION_10_13) -# define MAC_OS_X_VERSION_10_13 101300 +# define MAC_OS_X_VERSION_10_13 __MAC_10_13 # endif # if !defined(MAC_OS_X_VERSION_10_14) -# define MAC_OS_X_VERSION_10_14 101400 +# define MAC_OS_X_VERSION_10_14 __MAC_10_14 +# endif +# if !defined(MAC_OS_X_VERSION_10_15) +# define MAC_OS_X_VERSION_10_15 __MAC_10_15 # endif # # if !defined(__IPHONE_10_0) |