diff options
Diffstat (limited to 'src/corelib')
39 files changed, 211 insertions, 83 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 61d61df..fcc63a4 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -142,8 +142,6 @@ \sa direction */ -#ifndef QT_NO_ANIMATION - #include "qabstractanimation.h" #include "qanimationgroup.h" #include <QtCore/qdebug.h> @@ -155,6 +153,8 @@ #include <QtCore/qcoreevent.h> #include <QtCore/qpointer.h> +#ifndef QT_NO_ANIMATION + #define DEFAULT_TIMER_INTERVAL 16 QT_BEGIN_NAMESPACE diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp index 839b522..e192a6c 100644 --- a/src/corelib/animation/qanimationgroup.cpp +++ b/src/corelib/animation/qanimationgroup.cpp @@ -89,13 +89,13 @@ \sa QAbstractAnimation, QVariantAnimation, {The Animation Framework} */ -#ifndef QT_NO_ANIMATION - #include "qanimationgroup.h" #include <QtCore/qdebug.h> #include <QtCore/qcoreevent.h> #include "qanimationgroup_p.h" +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 13f6073..c148cb5d 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -68,11 +68,13 @@ \sa QAnimationGroup, QPropertyAnimation, {The Animation Framework} */ -#ifndef QT_NO_ANIMATION #include "qparallelanimationgroup.h" #include "qparallelanimationgroup_p.h" //#define QANIMATION_DEBUG + +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE /*! diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index b175f0c..93043c2 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -62,12 +62,12 @@ \sa QSequentialAnimationGroup */ -#ifndef QT_NO_ANIMATION - #include "qpauseanimation.h" #include "qabstractanimation_p.h" +#ifndef QT_NO_ANIMATION + QT_BEGIN_NAMESPACE class QPauseAnimationPrivate : public QAbstractAnimationPrivate diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index 43b5283..65f1361 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -87,23 +87,21 @@ \sa QVariantAnimation, QAnimationGroup, {The Animation Framework} */ -#ifndef QT_NO_ANIMATION - #include "qpropertyanimation.h" #include "qanimationgroup.h" -#include <QtCore/qdebug.h> - #include "qpropertyanimation_p.h" #include <QtCore/qmath.h> #include <QtCore/qmutex.h> +#include <private/qmutexpool_p.h> + +#ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE typedef QPair<QObject *, QByteArray> QPropertyAnimationPair; typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash; Q_GLOBAL_STATIC(QPropertyAnimationHash, _q_runningAnimations) -Q_GLOBAL_STATIC_WITH_ARGS(QMutex, guardHashLock, (QMutex::Recursive) ) void QPropertyAnimationPrivate::updateMetaProperty() { @@ -284,27 +282,32 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, } QVariantAnimation::updateState(oldState, newState); - QMutexLocker locker(guardHashLock()); - QPropertyAnimationHash * hash = _q_runningAnimations(); - QPropertyAnimationPair key(d->target, d->propertyName); - if (newState == Running) { - d->updateMetaProperty(); - QPropertyAnimation *oldAnim = hash->value(key, 0); - if (oldAnim) { - // try to stop the top level group - QAbstractAnimation *current = oldAnim; - while (current->group() && current->state() != Stopped) - current = current->group(); - current->stop(); - } - hash->insert(key, this); - // update the default start value - if (oldState == Stopped) { - d->setDefaultStartValue(d->target->property(d->propertyName.constData())); + QPropertyAnimation *animToStop = 0; + { + QPropertyAnimationHash * hash = _q_runningAnimations(); + QMutexLocker locker(QMutexPool::globalInstanceGet(hash)); + QPropertyAnimationPair key(d->target, d->propertyName); + if (newState == Running) { + d->updateMetaProperty(); + animToStop = hash->value(key, 0); + hash->insert(key, this); + // update the default start value + if (oldState == Stopped) { + d->setDefaultStartValue(d->target->property(d->propertyName.constData())); + } + } else if (hash->value(key) == this) { + hash->remove(key); } - } else if (hash->value(key) == this) { - hash->remove(key); + } + + //we need to do that after the mutex was unlocked + if (animToStop) { + // try to stop the top level group + QAbstractAnimation *current = animToStop; + while (current->group() && current->state() != Stopped) + current = current->group(); + current->stop(); } } diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 14814a7..25db52f 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -77,8 +77,6 @@ \sa QAnimationGroup, QAbstractAnimation, {The Animation Framework} */ -#ifndef QT_NO_ANIMATION - #include "qsequentialanimationgroup.h" #include "qsequentialanimationgroup_p.h" @@ -86,9 +84,9 @@ #include <QtCore/qdebug.h> -QT_BEGIN_NAMESPACE - +#ifndef QT_NO_ANIMATION +QT_BEGIN_NAMESPACE bool QSequentialAnimationGroupPrivate::atEnd() const { diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index e973ec5..ab73373 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -39,16 +39,15 @@ ** ****************************************************************************/ -#ifndef QT_NO_ANIMATION - #include "qvariantanimation.h" #include "qvariantanimation_p.h" -#include <QtCore/QRect> -#include <QtCore/QLineF> -#include <QtCore/QLine> -#include <QtCore/QReadWriteLock> -#include <QtCore/qdebug.h> +#include <QtCore/qrect.h> +#include <QtCore/qline.h> +#include <QtCore/qmutex.h> +#include <private/qmutexpool_p.h> + +#ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE @@ -365,8 +364,8 @@ void QVariantAnimation::setEasingCurve(const QEasingCurve &easing) d->recalculateCurrentInterval(); } -Q_GLOBAL_STATIC(QVector<QVariantAnimation::Interpolator>, registeredInterpolators) -Q_GLOBAL_STATIC(QReadWriteLock, registeredInterpolatorsLock) +typedef QVector<QVariantAnimation::Interpolator> QInterpolatorVector; +Q_GLOBAL_STATIC(QInterpolatorVector, registeredInterpolators) /*! \fn void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) @@ -398,10 +397,11 @@ Q_GLOBAL_STATIC(QReadWriteLock, registeredInterpolatorsLock) void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator func, int interpolationType) { // will override any existing interpolators - QWriteLocker locker(registeredInterpolatorsLock()); - if (int(interpolationType) >= registeredInterpolators()->count()) - registeredInterpolators()->resize(int(interpolationType) + 1); - registeredInterpolators()->replace(interpolationType, func); + QInterpolatorVector *interpolators = registeredInterpolators(); + QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators)); + if (int(interpolationType) >= interpolators->count()) + interpolators->resize(int(interpolationType) + 1); + interpolators->replace(interpolationType, func); } @@ -412,10 +412,11 @@ template<typename T> static inline QVariantAnimation::Interpolator castToInterpo QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType) { - QReadLocker locker(registeredInterpolatorsLock()); + QInterpolatorVector *interpolators = registeredInterpolators(); + QMutexLocker locker(QMutexPool::globalInstanceGet(interpolators)); QVariantAnimation::Interpolator ret = 0; - if (interpolationType < registeredInterpolators()->count()) { - ret = registeredInterpolators()->at(interpolationType); + if (interpolationType < interpolators->count()) { + ret = interpolators->at(interpolationType); if (ret) return ret; } diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h index ac26b4f..5135575 100644 --- a/src/corelib/arch/qatomic_windows.h +++ b/src/corelib/arch/qatomic_windows.h @@ -220,6 +220,9 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo #if !defined(Q_OS_WINCE) // use compiler intrinsics for all atomic functions +//those functions need to be define in the global namespace +QT_END_NAMESPACE + extern "C" { long __cdecl _InterlockedIncrement(volatile long *); long __cdecl _InterlockedDecrement(volatile long *); @@ -252,6 +255,9 @@ extern "C" { # define _InterlockedExchangeAddPointer(a,b) \ _InterlockedExchangeAdd(reinterpret_cast<volatile long *>(a), long(b)) # endif + +QT_BEGIN_NAMESPACE + inline bool QBasicAtomicInt::ref() { return _InterlockedIncrement(reinterpret_cast<volatile long *>(&_q_value)) != 0; @@ -335,6 +341,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo #define Q_ARGUMENT_TYPE #endif +QT_END_NAMESPACE + extern "C" { long __cdecl InterlockedIncrement(long Q_ARGUMENT_TYPE * lpAddend); long __cdecl InterlockedDecrement(long Q_ARGUMENT_TYPE * lpAddend); @@ -351,6 +359,8 @@ long __cdecl InterlockedExchangeAdd(long Q_ARGUMENT_TYPE * Addend, long Value); # pragma intrinsic (_InterlockedExchangeAdd) #endif +QT_BEGIN_NAMESPACE + #endif @@ -409,6 +419,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueTo // MinGW's definition, such that we pick up variations in the headers. #ifndef __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED +QT_END_NAMESPACE + extern "C" { __declspec(dllimport) long __stdcall InterlockedCompareExchange(long *, long, long); __declspec(dllimport) long __stdcall InterlockedIncrement(long *); @@ -416,6 +428,8 @@ extern "C" { __declspec(dllimport) long __stdcall InterlockedExchange(long *, long); __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long *, long); } + +QT_BEGIN_NAMESPACE #endif inline bool QBasicAtomicInt::ref() diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index 1ac592e..d9defe1 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -478,7 +478,7 @@ QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt data[2] = 0; data[3] = 0; } - data += 2; + data += 4; } if (endian == BE) { for (int i = 0; i < len; ++i) { diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index f11c9df..9f7c7ba 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -311,6 +311,11 @@ #define QT_NO_ACCESSIBILITY #endif +// Animation +#if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES)) +#define QT_NO_ANIMATION +#endif + // QButtonGroup #if !defined(QT_NO_BUTTONGROUP) && (defined(QT_NO_GROUPBOX)) #define QT_NO_BUTTONGROUP diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 23ec7b0..9408a5b 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1164,6 +1164,13 @@ Requires: PROPERTIES Name: Animation SeeAlso: ??? +Feature: STATEMACHINE +Description: Provides hierarchical finite state machines. +Section: Utilities +Requires: PROPERTIES +Name: State machine +SeeAlso: ??? + # SVG diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 6aa3b56..033225b 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -263,7 +263,7 @@ QTimerInfoList::QTimerInfoList() # if (_POSIX_MONOTONIC_CLOCK == 0) // detect if the system support monotonic timers long x = sysconf(_SC_MONOTONIC_CLOCK); - useMonotonicTimers = x >= 200112L; + useMonotonicTimers = x != -1; # endif getTime(currentTime); @@ -420,10 +420,18 @@ bool QTimerInfoList::timerWait(timeval &tm) timeval currentTime = updateCurrentTime(); repairTimersIfNeeded(); - if (isEmpty()) - return false; + // Find first waiting timer not already active + QTimerInfo *t = 0; + for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) { + if (!(*it)->inTimerEvent) { + t = *it; + break; + } + } + + if (!t) + return false; - QTimerInfo *t = first(); // first waiting timer if (currentTime < t->timeout) { // time to wait tm = t->timeout - currentTime; diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index be622d9..1501351 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -897,7 +897,8 @@ QObjectPrivate::Connection::~Connection() \relates QObject Returns the given \a object cast to type T if the object is of type - T (or of a subclass); otherwise returns 0. + T (or of a subclass); otherwise returns 0. If \a object is 0 then + it will also return 0. The class T must inherit (directly or indirectly) QObject and be declared with the \l Q_OBJECT macro. @@ -2051,7 +2052,7 @@ void QObject::deleteLater() or - \tt{/*: ... \starslash} + \tt{\begincomment: ... \endcomment} Examples: diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 08821d4..8ca53b9 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -211,7 +211,7 @@ void QTimer::start() */ void QTimer::start(int msec) { - setInterval(msec); + inter = msec; start(); } diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 5ba9898..38fa216 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -149,6 +149,9 @@ static int numerusHelper(int n, const uchar *rules, int rulesSize) leftOperand %= 10; } else if (opcode & Q_MOD_100) { leftOperand %= 100; + } else if (opcode & Q_LEAD_1000) { + while (leftOperand >= 1000) + leftOperand /= 1000; } int op = opcode & Q_OP_MASK; diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h index 77ec8f5..a7d58c5 100644 --- a/src/corelib/kernel/qtranslator_p.h +++ b/src/corelib/kernel/qtranslator_p.h @@ -62,6 +62,7 @@ enum { Q_NOT = 0x08, Q_MOD_10 = 0x10, Q_MOD_100 = 0x20, + Q_LEAD_1000 = 0x40, Q_AND = 0xFD, Q_OR = 0xFE, diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 033b760..02b507e 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -105,28 +105,28 @@ private: // constructs a new variant if copy is 0, otherwise copy-constructs template <class T> -inline void v_construct(QVariant::Private *x, const T &t) +inline void v_construct(QVariant::Private *x, const void *copy, T * = 0) { if (sizeof(T) > sizeof(QVariant::Private::Data)) { - x->data.shared = new QVariantPrivateSharedEx<T>(t); + x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy)) + : new QVariantPrivateSharedEx<T>; x->is_shared = true; } else { - new (&x->data.ptr) T(t); + if (copy) + new (&x->data.ptr) T(*static_cast<const T *>(copy)); + else + new (&x->data.ptr) T; } } template <class T> -inline void v_construct(QVariant::Private *x, const void *copy, T * = 0) +inline void v_construct(QVariant::Private *x, const T &t) { if (sizeof(T) > sizeof(QVariant::Private::Data)) { - x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy)) - : new QVariantPrivateSharedEx<T>; + x->data.shared = new QVariantPrivateSharedEx<T>(t); x->is_shared = true; } else { - if (copy) - new (&x->data.ptr) T(*static_cast<const T *>(copy)); - else - new (&x->data.ptr) T; + new (&x->data.ptr) T(t); } } diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp index 942722f..b9a50a2 100644 --- a/src/corelib/statemachine/qabstractstate.cpp +++ b/src/corelib/statemachine/qabstractstate.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qabstractstate.h" + +#ifndef QT_NO_STATEMACHINE + #include "qabstractstate_p.h" #include "qstate.h" #include "qstate_p.h" @@ -200,3 +203,5 @@ bool QAbstractState::event(QEvent *e) } QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h index d0ebb52..ee55541 100644 --- a/src/corelib/statemachine/qabstractstate.h +++ b/src/corelib/statemachine/qabstractstate.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QState; class QStateMachine; @@ -83,6 +85,8 @@ private: Q_DECLARE_PRIVATE(QAbstractState) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index dfcafeb..f582b8c 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qabstracttransition.h" + +#ifndef QT_NO_STATEMACHINE + #include "qabstracttransition_p.h" #include "qabstractstate.h" #include "qstate.h" @@ -340,3 +343,5 @@ bool QAbstractTransition::event(QEvent *e) } QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h index c63d55a..a1a62c9 100644 --- a/src/corelib/statemachine/qabstracttransition.h +++ b/src/corelib/statemachine/qabstracttransition.h @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QEvent; class QAbstractState; class QState; @@ -104,6 +106,8 @@ private: Q_DECLARE_PRIVATE(QAbstractTransition) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index f25d821..4c40256 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qeventtransition.h" + +#ifndef QT_NO_STATEMACHINE + #include "qeventtransition_p.h" #include "qwrappedevent.h" #include "qstate.h" @@ -283,3 +286,5 @@ bool QEventTransition::event(QEvent *e) } QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h index 3530bdd..40ffecf 100644 --- a/src/corelib/statemachine/qeventtransition.h +++ b/src/corelib/statemachine/qeventtransition.h @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QEventTransitionPrivate; class Q_CORE_EXPORT QEventTransition : public QAbstractTransition { @@ -89,6 +91,8 @@ private: Q_DECLARE_PRIVATE(QEventTransition) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp index 0980336..0eb531f 100644 --- a/src/corelib/statemachine/qfinalstate.cpp +++ b/src/corelib/statemachine/qfinalstate.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qfinalstate.h" + +#ifndef QT_NO_STATEMACHINE + #include "qabstractstate_p.h" QT_BEGIN_NAMESPACE @@ -132,3 +135,5 @@ bool QFinalState::event(QEvent *e) } QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h index fa68394..865f333 100644 --- a/src/corelib/statemachine/qfinalstate.h +++ b/src/corelib/statemachine/qfinalstate.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QFinalStatePrivate; class Q_CORE_EXPORT QFinalState : public QAbstractState { @@ -69,6 +71,8 @@ private: Q_DECLARE_PRIVATE(QFinalState) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index 517faa8..4304da3 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qhistorystate.h" + +#ifndef QT_NO_STATEMACHINE + #include "qhistorystate_p.h" QT_BEGIN_NAMESPACE @@ -221,3 +224,5 @@ bool QHistoryState::event(QEvent *e) } QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h index a0682bd..eee43d1 100644 --- a/src/corelib/statemachine/qhistorystate.h +++ b/src/corelib/statemachine/qhistorystate.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QHistoryStatePrivate; class Q_CORE_EXPORT QHistoryState : public QAbstractState { @@ -84,6 +86,8 @@ private: Q_DECLARE_PRIVATE(QHistoryState) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h index 8221f68..79d1053 100644 --- a/src/corelib/statemachine/qsignalevent.h +++ b/src/corelib/statemachine/qsignalevent.h @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class Q_CORE_EXPORT QSignalEvent : public QEvent { public: @@ -70,6 +72,8 @@ private: QList<QVariant> m_arguments; }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index 9ffcb9c..2e150a7 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qsignaltransition.h" + +#ifndef QT_NO_STATEMACHINE + #include "qsignaltransition_p.h" #include "qsignalevent.h" #include "qstate.h" @@ -258,3 +261,5 @@ bool QSignalTransition::event(QEvent *e) } QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index b485785..02b1de9 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QSignalTransitionPrivate; class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition { @@ -82,6 +84,8 @@ private: Q_DECLARE_PRIVATE(QSignalTransition) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 5463059..5dd56c0 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qstate.h" + +#ifndef QT_NO_STATEMACHINE + #include "qstate_p.h" #include "qhistorystate.h" #include "qhistorystate_p.h" @@ -329,9 +332,10 @@ QSignalTransition *QState::addTransition(QObject *sender, const char *signal, qWarning("QState::addTransition: cannot add transition to null state"); return 0; } - if (*signal && sender->metaObject()->indexOfSignal(signal+1) == -1) { + int offset = (*signal == '0'+QSIGNAL_CODE) ? 1 : 0; + if (sender->metaObject()->indexOfSignal(signal+offset) == -1) { qWarning("QState::addTransition: no such signal %s::%s", - sender->metaObject()->className(), signal+1); + sender->metaObject()->className(), signal+offset); return 0; } QSignalTransition *trans = new QSignalTransition(sender, signal, QList<QAbstractState*>() << target); @@ -481,3 +485,5 @@ bool QState::event(QEvent *e) */ QT_END_NAMESPACE + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 6729c69..c98bb64 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QAbstractTransition; class QSignalTransition; @@ -106,6 +108,8 @@ private: Q_DECLARE_PRIVATE(QState) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 84619d7..64b33ac 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qstatemachine.h" + +#ifndef QT_NO_STATEMACHINE + #include "qstate.h" #include "qstate_p.h" #include "qstatemachine_p.h" @@ -92,7 +95,7 @@ QT_BEGIN_NAMESPACE QAbstractState) and transitions (descendants of QAbstractTransition) between those states; these states and transitions define a state graph. Once a state graph has been - built, the state machine can execute it. \l{QStateMachine}'s + built, the state machine can execute it. QStateMachine's execution algorithm is based on the \l{State Chart XML: State Machine Notation for Control Abstraction}{State Chart XML (SCXML)} algorithm. The framework's \l{The State Machine @@ -1329,7 +1332,7 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio if (!ok) { #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": FAILED to add signal transition from" << transition->sourceState() - << ": ( sender =" << sender << ", signal =" << (signal.mid(1)) + << ": ( sender =" << sender << ", signal =" << signal << ", targets =" << transition->targetStates() << ')'; #endif return; @@ -1339,7 +1342,7 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio QSignalTransitionPrivate::get(transition)->signalIndex = signalIndex; #ifdef QSTATEMACHINE_DEBUG qDebug() << q << ": added signal transition from" << transition->sourceState() - << ": ( sender =" << sender << ", signal =" << (signal.mid(1)) + << ": ( sender =" << sender << ", signal =" << signal << ", targets =" << transition->targetStates() << ')'; #endif } @@ -2207,3 +2210,5 @@ QWrappedEvent::~QWrappedEvent() QT_END_NAMESPACE #include "moc_qstatemachine.cpp" + +#endif //QT_NO_STATEMACHINE diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 2a98a9a..0b3c728 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QEvent; class QAbstractState; class QState; @@ -159,6 +161,8 @@ private: #endif }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/statemachine/qwrappedevent.h b/src/corelib/statemachine/qwrappedevent.h index b01c608..cb4261b 100644 --- a/src/corelib/statemachine/qwrappedevent.h +++ b/src/corelib/statemachine/qwrappedevent.h @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) +#ifndef QT_NO_STATEMACHINE + class QObject; class Q_CORE_EXPORT QWrappedEvent : public QEvent @@ -69,6 +71,8 @@ private: Q_DISABLE_COPY(QWrappedEvent) }; +#endif //QT_NO_STATEMACHINE + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 9953155..8c740bd 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -42,7 +42,6 @@ #include "qglobal.h" #ifndef QT_NO_SYSTEMLOCALE -#define QLOCALE_CPP QT_BEGIN_NAMESPACE class QSystemLocale; static QSystemLocale *QSystemLocale_globalSystemLocale(); @@ -1602,6 +1601,8 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) This constructor converts the locale name to a language/country pair; it does not use the system locale database. + QLocale's data is based on Common Locale Data Repository v1.6.1. + The double-to-string and string-to-double conversion functions are covered by the following licenses: @@ -1622,8 +1623,6 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) This product includes software developed by the University of California, Berkeley and its contributors. - QLocale's data is based on Common Locale Data Repository v1.6.1. - \sa QString::arg(), QString::toInt(), QString::toDouble() */ diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 5b611eb..987ab4e 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -99,11 +99,9 @@ public: virtual QVariant query(QueryType type, QVariant in) const; virtual QLocale fallbackLocale() const; -#ifdef QLOCALE_CPP private: QSystemLocale(bool); friend QSystemLocale *QSystemLocale_globalSystemLocale(); -#endif }; #endif diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 2b4a242..4f24f76 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -64,7 +64,7 @@ \sa QStringBuilder, QLatin1String, QString, QStringRef */ -/*! \fn QLatin1Literal::QLatin1Literal(const char(&string)[]) +/*! \fn QLatin1Literal::QLatin1Literal(const char(&string)[N]) Constructs a new literal from the given \a string. */ @@ -93,7 +93,7 @@ \reentrant \since 4.6 - \brief QStringBuilder is a template class that provides a facility to build + \brief The QStringBuilder class is a template class that provides a facility to build up QStrings from smaller chunks. \ingroup tools @@ -102,7 +102,7 @@ \mainclass When creating strings from smaller chunks, typically \c QString::operator+() - is used, resulting in \i{n - 1} reallocations when operating on \i{n} chunks. + is used, resulting in \e{n - 1} reallocations when operating on \e{n} chunks. QStringBuilder uses expression templates to collect the individual parts, compute the total size, allocate memory for the resulting QString object, diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 7bdcba0..38254cd 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -94,7 +94,14 @@ template <typename T> class QVector { typedef QVectorTypedData<T> Data; - union { QVectorData *d; Data *p; }; + union { + QVectorData *d; +#if defined(Q_CC_SUN) && (__SUNPRO_CC <= 0x550) + QVectorTypedData<T> *p; +#else + Data *p; +#endif + }; public: inline QVector() : d(&QVectorData::shared_null) { d->ref.ref(); } |