diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-01-21 12:34:52 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-01-21 12:36:42 (GMT) |
commit | 6b92cb8ec199159d629c013fbd4b4b7ab8ad60db (patch) | |
tree | c22cba83d08cc61791a7a1914665694264f4e65e | |
parent | 01a54a8d903abddd8b1fbddb1410e56878f41b7c (diff) | |
download | Qt-6b92cb8ec199159d629c013fbd4b4b7ab8ad60db.zip Qt-6b92cb8ec199159d629c013fbd4b4b7ab8ad60db.tar.gz Qt-6b92cb8ec199159d629c013fbd4b4b7ab8ad60db.tar.bz2 |
Make the animation api compile when QT_NO_THREAD is defined
Task-number: QTBUG-6890
Reviewed-by: Thierry
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 7 | ||||
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 2 | ||||
-rw-r--r-- | src/corelib/animation/qvariantanimation.cpp | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index b7afd9f..f5a9d16 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -161,7 +161,9 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_THREAD Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer) +#endif QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), @@ -173,12 +175,17 @@ QUnifiedTimer::QUnifiedTimer() : QUnifiedTimer *QUnifiedTimer::instance() { QUnifiedTimer *inst; +#ifndef QT_NO_THREAD if (!unifiedTimer()->hasLocalData()) { inst = new QUnifiedTimer; unifiedTimer()->setLocalData(inst); } else { inst = unifiedTimer()->localData(); } +#else + static QUnifiedTimer unifiedTimer; + inst = &unifiedTimer; +#endif return inst; } diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index eec5b30..ea807db 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -264,7 +264,9 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState, QPropertyAnimation *animToStop = 0; { +#ifndef QT_NO_THREAD QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject)); +#endif typedef QPair<QObject *, QByteArray> QPropertyAnimationPair; typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash; static QPropertyAnimationHash hash; diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 115edbe..173802d 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -431,7 +431,9 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun { // will override any existing interpolators QInterpolatorVector *interpolators = registeredInterpolators(); +#ifndef QT_NO_THREAD QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators)); +#endif if (int(interpolationType) >= interpolators->count()) interpolators->resize(int(interpolationType) + 1); interpolators->replace(interpolationType, func); @@ -446,7 +448,9 @@ template<typename T> static inline QVariantAnimation::Interpolator castToInterpo QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType) { QInterpolatorVector *interpolators = registeredInterpolators(); +#ifndef QT_NO_THREAD QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators)); +#endif QVariantAnimation::Interpolator ret = 0; if (interpolationType < interpolators->count()) { ret = interpolators->at(interpolationType); |