From dd5e40d9c683dbedcde911e1abd7bfcec87ca514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 11 Oct 2013 12:24:30 +0200 Subject: Allow custom definition of Q_FORWARD_DECLARE_OBJC_CLASS and friends MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I761ef508672d5d4e8b9067a1b5f91debe09607d4 Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qglobal.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b1a22ddf03..d7253c39c6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -998,13 +998,19 @@ template struct QEnableIf; template struct QEnableIf { typedef T Type; }; } -#ifdef __OBJC__ -#define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname -#else -#define Q_FORWARD_DECLARE_OBJC_CLASS(classname) typedef struct objc_object classname +#ifndef Q_FORWARD_DECLARE_OBJC_CLASS +# ifdef __OBJC__ +# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname +# else +# define Q_FORWARD_DECLARE_OBJC_CLASS(classname) typedef struct objc_object classname +# endif +#endif +#ifndef Q_FORWARD_DECLARE_CF_TYPE +# define Q_FORWARD_DECLARE_CF_TYPE(type) typedef const struct __ ## type * type ## Ref +#endif +#ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE +# define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref #endif -#define Q_FORWARD_DECLARE_CF_TYPE(type) typedef const struct __ ## type * type ## Ref -#define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref QT_END_NAMESPACE // Q_GLOBAL_STATIC -- cgit v1.2.3 From 7a47aebe9ed41d6cd9c9bcd45758d4d553668e99 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 10 Oct 2013 17:06:37 +0200 Subject: Let QLoggingCategory::defaultCategory return a pointer The pointer can be null. Going trough the reference invokes undefined behavior here. Change-Id: Ia84e4e732cdcbbaee0f5f0679765d18069ea8b2d Reviewed-by: Kai Koehne --- src/corelib/global/qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 063e94069f..b9b5173881 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -927,7 +927,7 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex #ifndef QT_BOOTSTRAPPED // qDebug, qWarning, ... macros do not check whether category is enabled if (!context.category || (strcmp(context.category, "default") == 0)) { - if (QLoggingCategory *defaultCategory = &QLoggingCategory::defaultCategory()) { + if (QLoggingCategory *defaultCategory = QLoggingCategory::defaultCategory()) { if (!defaultCategory->isEnabled(msgType)) return; } -- cgit v1.2.3 From 2cf39c87756ee84dc832958255f01dcdacce1cac Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 4 Oct 2013 18:53:30 +0200 Subject: Documentation: Add '\since' to doc for Qt::Edge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That enum got introduced in b6e9a8f21ac8b4cc3cc56232ce346ebd7ba17a70 Change-Id: I2d69179624cecff63549bfee66bc68bb4b27af8c Reviewed-by: Topi Reiniö Reviewed-by: Jerome Pasion --- src/corelib/global/qnamespace.qdoc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f46640ea0e..90f38fd51c 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1735,6 +1735,8 @@ \value LeftEdge The left edge of the rectangle. \value RightEdge The right edge of the rectangle. \value BottomEdge The bottom edge of the rectangle. + + \since 5.1 */ /*! -- cgit v1.2.3 From b8da27bc909ccef51269a59233d2b943e9acb220 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 22 Jul 2013 19:24:49 +0200 Subject: Update keycode mappings of multimedia keys Updates keycode mappings for evdev, directfb and android. Change-Id: I6789f13dbb662da4261a3c947757644e12306dd9 Reviewed-by: BogDan Vatra --- src/corelib/global/qnamespace.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 420721cb54..e2c6039989 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -907,7 +907,7 @@ public: Key_BrightnessAdjust = 0x010000c2, Key_Finance = 0x010000c3, Key_Community = 0x010000c4, - Key_AudioRewind = 0x010000c5, + Key_AudioRewind = 0x010000c5, // Media rewind Key_BackForward = 0x010000c6, Key_ApplicationLeft = 0x010000c7, Key_ApplicationRight = 0x010000c8, @@ -919,7 +919,7 @@ public: Key_Close = 0x010000ce, Key_Copy = 0x010000cf, Key_Cut = 0x010000d0, - Key_Display = 0x010000d1, + Key_Display = 0x010000d1, // Output switch key Key_DOS = 0x010000d2, Key_Documents = 0x010000d3, Key_Excel = 0x010000d4, @@ -968,9 +968,9 @@ public: Key_Bluetooth = 0x010000ff, Key_WLAN = 0x01000100, Key_UWB = 0x01000101, - Key_AudioForward = 0x01000102, - Key_AudioRepeat = 0x01000103, - Key_AudioRandomPlay = 0x01000104, + Key_AudioForward = 0x01000102, // Media fast-forward + Key_AudioRepeat = 0x01000103, // Toggle repeat mode + Key_AudioRandomPlay = 0x01000104, // Toggle shuffle mode Key_Subtitle = 0x01000105, Key_AudioCycleTrack = 0x01000106, Key_Time = 0x01000107, -- cgit v1.2.3 From c1417023d502200ef2b68cf46d72e6496d787020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 10 Oct 2013 13:34:42 +0200 Subject: Correct PrefixPath on iOS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The iOS bundles are "flat", do not insert "/Contents/" like we do on OS X. Change-Id: I4e848f4425482b92cac04d940e5bce06b7199fc6 Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qlibraryinfo.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8d681f0c4c..33d7b71cff 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -442,7 +442,11 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) QCFType urlRef = CFBundleCopyBundleURL(bundleRef); if (urlRef) { QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); +#ifdef Q_OS_MACX return QDir::cleanPath(QString(path) + QLatin1String("/Contents/") + ret); +#else + return QDir::cleanPath(QString(path) + QLatin1Char('/') + ret); // iOS +#endif } } #endif -- cgit v1.2.3 From 816e7f11f192b199e62c7128efedbc63c05ffd79 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 9 Oct 2013 12:08:43 +0200 Subject: Avoid other threads blocking for Q_GLOBAL_STATIC constructor on Mac The compiler inserts __cxa_guard_acquire, __cxa_guard_release calls around the initialization of local static objects to make the initialization thread safe. However, the implementation of _cxa_guard_acquire in Apple's libc++abi uses a global lock, which means that only one thread can initialize a local static variable at a time. This can be a problem if e.g. the constructor of the variable is blocking while waiting for another thread ... This behavior has caused issues so far in webkit and the qml debugging infrastructure. Better avoid it by using our custom lock implementation. __cxa_guard_acquire implementation: http://www.opensource.apple.com/source/libcppabi/libcppabi-24.2/src/cxa_guard.cxx Task-number: QTBUG-33967 Change-Id: I0d50531ed91ddd074aa07f61f6bf7791e23d990b Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/global/qglobalstatic.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobalstatic.h b/src/corelib/global/qglobalstatic.h index 5d0b1e8514..ad39452cf4 100644 --- a/src/corelib/global/qglobalstatic.h +++ b/src/corelib/global/qglobalstatic.h @@ -57,11 +57,16 @@ enum GuardValues { }; } -#if defined(QT_NO_THREAD) || defined(Q_CC_GNU) +#if defined(QT_NO_THREAD) || (defined(Q_CC_GNU) && !defined(Q_OS_MAC)) // some compilers support thread-safe statics // The IA-64 C++ ABI requires this, so we know that all GCC versions since 3.4 // support it. C++11 also requires this behavior. -// Clang and Intel CC masquerade as GCC when compiling on Linux and Mac OS X. +// Clang and Intel CC masquerade as GCC when compiling on Linux. +// +// Apple's libc++abi however uses a global lock for initializing local statics, +// which will block other threads also trying to initialize a local static +// until the constructor returns ... +// We better avoid these kind of problems by using our own locked implementation. #define Q_GLOBAL_STATIC_INTERNAL(ARGS) \ Q_DECL_HIDDEN inline Type *innerFunction() \ -- cgit v1.2.3 From dd2e1c58a76d946f8e7b6acb8dc14c52633e703a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 14 Oct 2013 14:10:33 +0200 Subject: Document %{category} for qSetMessagePattern Change-Id: Ib6ad515ce4ba27d501538ba45fd65e60ce5332df Reviewed-by: Jerome Pasion Reviewed-by: hjk --- src/corelib/global/qlogging.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index b9b5173881..7a759ef8f5 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1108,6 +1108,7 @@ void qErrnoWarning(int code, const char *msg, ...) \table \header \li Placeholder \li Description \row \li \c %{appname} \li QCoreApplication::applicationName() + \row \li \c %{category} \li Logging category \row \li \c %{file} \li Path to source file \row \li \c %{function} \li Function \row \li \c %{line} \li Line in source file -- cgit v1.2.3 From 704616605b571f126bce59243c8bc3be48f5ace8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 14 Oct 2013 14:05:57 -0700 Subject: Remove compatibility support for sealed/override in C++/CLI Those features have slightly different behavior as the C++11 keywords that MSVC 2012 officially supports. When compiling in C++/CLI mode, the "virtual" keyword must be present too. We have not actually tested whether the official MSVC 2012 support for C++/CLI still requires the virtual keyword. This is just going on the assumption that C++/CLI follows the C++11 spec. Task-number: QTBUG-34019 Change-Id: I148a443bfbff985033c555f5a9cfcd5be7f5f106 Reviewed-by: Olivier Goffart Reviewed-by: Lars Knoll --- src/corelib/global/qcompilerdetection.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index a388bdb96f..280c5066a6 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -696,15 +696,20 @@ # if _MSC_VER >= 1400 /* C++11 features supported in VC8 = VC2005: */ # define Q_COMPILER_VARIADIC_MACROS + +# ifndef __cplusplus_cli /* 2005 supports the override and final contextual keywords, in the same positions as the C++11 variants, but 'final' is called 'sealed' instead: http://msdn.microsoft.com/en-us/library/0w2w91tf%28v=vs.80%29.aspx + The behavior is slightly different in C++/CLI, which requires the + "virtual" keyword to be present too, so don't define for that. So don't define Q_COMPILER_EXPLICIT_OVERRIDES (since it's not the same as the C++11 version), but define the Q_DECL_* flags accordingly: */ # define Q_DECL_OVERRIDE override # define Q_DECL_FINAL sealed +# endif # endif # if _MSC_VER >= 1600 /* C++11 features supported in VC10 = VC2010: */ -- cgit v1.2.3 From 15ddb91bc767b55297cbb35f293f5900379fee18 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 20 Sep 2013 11:45:54 +0200 Subject: Print non-default categories in default message handler Change the default output of the logging framework to prefix messages with a 'category: ' in case the category is not "default", so that e.g. QLoggingCategory cat("qt.core.codes.windows"); qCWarning(cat) << "MultiByteToWideChar: Cannot convert multibyte text"; will print qt.core.codes.windows: MultiByteToWideChar: Cannot convert multibyte text while output from qWarning etc will show unaltered output. This should help users to discover categories, and to group output together. Change-Id: Iac2e1514f7dc5671966c36a440a119c857564cfc Reviewed-by: Thiago Macieira Reviewed-by: hjk --- src/corelib/global/qlogging.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 7a759ef8f5..0a261acc77 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -549,6 +549,7 @@ static const char functionTokenC[] = "%{function}"; static const char pidTokenC[] = "%{pid}"; static const char appnameTokenC[] = "%{appname}"; static const char threadidTokenC[] = "%{threadid}"; +static const char ifCategoryTokenC[] = "%{if-category}"; static const char ifDebugTokenC[] = "%{if-debug}"; static const char ifWarningTokenC[] = "%{if-warning}"; static const char ifCriticalTokenC[] = "%{if-critical}"; @@ -556,7 +557,7 @@ static const char ifFatalTokenC[] = "%{if-fatal}"; static const char endifTokenC[] = "%{endif}"; static const char emptyTokenC[] = ""; -static const char defaultPattern[] = "%{message}"; +static const char defaultPattern[] = "%{if-category}%{category}: %{endif}%{message}"; struct QMessagePattern { @@ -675,6 +676,7 @@ void QMessagePattern::setPattern(const QString &pattern) tokens[i] = LEVEL; \ inIf = true; \ } + IF_TOKEN(ifCategoryTokenC) IF_TOKEN(ifDebugTokenC) IF_TOKEN(ifWarningTokenC) IF_TOKEN(ifCriticalTokenC) @@ -837,6 +839,9 @@ Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogCont message.append(QLatin1String("0x")); message.append(QString::number(qlonglong(QThread::currentThread()->currentThread()), 16)); #endif + } else if (token == ifCategoryTokenC) { + if (!context.category || (strcmp(context.category, "default") == 0)) + skip = true; #define HANDLE_IF_TOKEN(LEVEL) \ } else if (token == if##LEVEL##TokenC) { \ skip = type != Qt##LEVEL##Msg; -- cgit v1.2.3 From 77adddae373cb9e5019a1d789014925330fb8d75 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 15 Oct 2013 12:40:35 -0700 Subject: Move the Apple Clang specific features outside of the C++11 section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those are not related to C++11, so move them to the Clang detection block. Change-Id: I80b298e1df5f74a865d743625895e0f01cb5fd6b Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/corelib/global/qcompilerdetection.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 280c5066a6..d02e4cf199 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -161,6 +161,13 @@ # /* Compatibility with older Clang versions */ # define __has_extension __has_feature # endif +# if defined(__APPLE__) + /* Apple/clang specific features */ +# define Q_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) +# ifdef __OBJC__ +# define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) +# endif +# endif # else /* Plain GCC */ # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 @@ -620,14 +627,6 @@ # endif #endif // Q_CC_CLANG -#if defined(Q_CC_CLANG) && defined(__APPLE__) -/* Apple/clang specific features */ -# define Q_DECL_CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) -# ifdef __OBJC__ -# define Q_DECL_NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) -# endif -#endif - #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 -- cgit v1.2.3 From 021c79f038c218a55b145fafcda5c59cf3a309d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Fri, 11 Oct 2013 14:55:33 +0200 Subject: Android: Use java.util.Random in qrand() Android does not provide rand_r(), so we would fall back to rand() and srand() which means we where not keeping the promise of qrand and qsrand being thread-safe. As a replacement we can use the Java api and have one Random object for each thread. Task-number: QTBUG-32814 Change-Id: Id46d195a0bb122bc7a5a8de43bdf088e11a9c42e Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/corelib/global/qglobal.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index ff2c4bbe5e..1dd77c5859 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -76,6 +76,10 @@ #include #endif +#if defined(Q_OS_ANDROID) +#include +#endif + QT_BEGIN_NAMESPACE #if !QT_DEPRECATED_SINCE(5, 0) @@ -2335,6 +2339,9 @@ typedef uint SeedStorageType; typedef QThreadStorage SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value +#elif defined(Q_OS_ANDROID) +typedef QThreadStorage AndroidRandomStorage; +Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) #endif /*! @@ -2368,6 +2375,16 @@ void qsrand(uint seed) //global static object, fallback to srand(seed) srand(seed); } +#elif defined(Q_OS_ANDROID) + QJNIObjectPrivate random = QJNIObjectPrivate("java/util/Random", + "(J)V", + jlong(seed)); + if (!random.isValid()) { + srand(seed); + return; + } + + randomTLS->setLocalData(random); #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls @@ -2409,6 +2426,25 @@ int qrand() //global static object, fallback to rand() return rand(); } +#elif defined(Q_OS_ANDROID) + AndroidRandomStorage *randomStorage = randomTLS(); + if (!randomStorage) + return rand(); + + QJNIObjectPrivate random; + if (!randomStorage->hasLocalData()) { + random = QJNIObjectPrivate("java/util/Random", + "(J)V", + jlong(1)); + if (!random.isValid()) + return rand(); + + randomStorage->setLocalData(random); + } else { + random = randomStorage->localData(); + } + + return random.callMethod("nextInt", "(I)I", RAND_MAX); #else // On Windows srand() and rand() already use Thread-Local-Storage // to store the seed between calls -- cgit v1.2.3 From fbfc8ffbf39e2e7a540d4d576ec61bea7db63416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 2 Oct 2013 08:52:26 +0200 Subject: Implement native gestures on OS X. Add QWindowSystemInterface::GestureEvent and QNativeGestureEvent to QtGui. These events are copies of Qt4's QNativeGestureEvent, where it was an implementation detail of QGestureManager. Add gesture message handlers to QNSView and bring back the Mac gesture recognizers for QGestureManager. Task-number: QTBUG-28126 Change-Id: I1304e09e776fa7c44d133d54ca8b895ca2f544c5 Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta --- src/corelib/global/qnamespace.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index e2c6039989..8a46f3a6ab 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1557,6 +1557,18 @@ public: IgnoredGesturesPropagateToParent = 0x04 }; Q_DECLARE_FLAGS(GestureFlags, GestureFlag) + + enum NativeGestureType + { + BeginNativeGesture, + EndNativeGesture, + PanNativeGesture, + ZoomNativeGesture, + SmartZoomNativeGesture, + RotateNativeGesture, + SwipeNativeGesture + }; + #endif // QT_NO_GESTURES enum NavigationMode -- cgit v1.2.3