diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-10-15 08:58:59 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-10-15 08:58:59 (GMT) |
commit | d245034a54d20a3ff59575158dbf8705547648a7 (patch) | |
tree | 6fdbf2718e6613e8af60b0fa4e77ba9b1f41660a /src/corelib | |
parent | 16dab236acbd35c351c1ac1d36dbf018db0d278c (diff) | |
parent | 376a5a845ba6d19751a58ea79a8d5701c4ba4d13 (diff) | |
download | Qt-d245034a54d20a3ff59575158dbf8705547648a7.zip Qt-d245034a54d20a3ff59575158dbf8705547648a7.tar.gz Qt-d245034a54d20a3ff59575158dbf8705547648a7.tar.bz2 |
Merge commit 'origin/4.6' into mmfphonon
Conflicts:
src/corelib/kernel/qcoreevent.cpp
src/corelib/kernel/qcoreevent.h
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 189 | ||||
-rw-r--r-- | src/corelib/animation/qabstractanimation_p.h | 42 | ||||
-rw-r--r-- | src/corelib/animation/qanimationgroup_p.h | 4 | ||||
-rw-r--r-- | src/corelib/animation/qparallelanimationgroup.cpp | 8 | ||||
-rw-r--r-- | src/corelib/animation/qpauseanimation.cpp | 1 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 30 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 33 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 51 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 15 | ||||
-rw-r--r-- | src/corelib/io/qprocess.cpp | 8 | ||||
-rw-r--r-- | src/corelib/io/qprocess.h | 7 | ||||
-rw-r--r-- | src/corelib/io/qprocess_p.h | 3 | ||||
-rw-r--r-- | src/corelib/io/qprocess_symbian.cpp | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreevent.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreevent.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 4 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.cpp | 13 |
17 files changed, 334 insertions, 85 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 2769040..c775a00 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -144,6 +144,7 @@ #include "qabstractanimation.h" #include "qanimationgroup.h" + #include <QtCore/qdebug.h> #include "qabstractanimation_p.h" @@ -176,7 +177,8 @@ Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer) QUnifiedTimer::QUnifiedTimer() : QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL), - currentAnimationIdx(0), consistentTiming(false) + currentAnimationIdx(0), consistentTiming(false), isPauseTimerActive(false), + runningLeafAnimations(0) { } @@ -192,50 +194,92 @@ QUnifiedTimer *QUnifiedTimer::instance() return inst; } +void QUnifiedTimer::ensureTimerUpdate(QAbstractAnimation *animation) +{ + if (isPauseTimerActive) { + updateAnimationsTime(); + } else { + // this code is needed when ensureTimerUpdate is called from setState because we update + // the currentTime when an animation starts running (otherwise we could remove it) + animation->setCurrentTime(animation->currentTime()); + } +} + +void QUnifiedTimer::updateAnimationsTime() +{ + // ignore consistentTiming in case the pause timer is active + const int delta = (consistentTiming && !isPauseTimerActive) ? + timingInterval : time.elapsed() - lastTick; + lastTick = time.elapsed(); + + //we make sure we only call update time if the time has actually changed + //it might happen in some cases that the time doesn't change because events are delayed + //when the CPU load is high + if (delta) { + for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { + QAbstractAnimation *animation = animations.at(currentAnimationIdx); + int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime + + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); + animation->setCurrentTime(elapsed); + } + currentAnimationIdx = 0; + } +} + +void QUnifiedTimer::restartAnimationTimer() +{ + if (runningLeafAnimations == 0 && !runningPauseAnimations.isEmpty()) { + int closestTimeToFinish = closestPauseAnimationTimeToFinish(); + animationTimer.start(closestTimeToFinish, this); + isPauseTimerActive = true; + } else if (!animationTimer.isActive() || isPauseTimerActive) { + animationTimer.start(timingInterval, this); + isPauseTimerActive = false; + } +} + void QUnifiedTimer::timerEvent(QTimerEvent *event) { if (event->timerId() == startStopAnimationTimer.timerId()) { startStopAnimationTimer.stop(); + //we transfer the waiting animations into the "really running" state animations += animationsToStart; animationsToStart.clear(); if (animations.isEmpty()) { animationTimer.stop(); - } else if (!animationTimer.isActive()) { - animationTimer.start(timingInterval, this); - lastTick = 0; - time.start(); - } - } else if (event->timerId() == animationTimer.timerId()) { - //this is simply the time we last received a tick - const int oldLastTick = lastTick; - lastTick = consistentTiming ? oldLastTick + timingInterval : time.elapsed(); - - //we make sure we only call update time if the time has actually changed - //it might happen in some cases that the time doesn't change because events are delayed - //when the CPU load is high - if (const int delta = lastTick - oldLastTick) { - for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { - QAbstractAnimation *animation = animations.at(currentAnimationIdx); - int elapsed = QAbstractAnimationPrivate::get(animation)->totalCurrentTime - + (animation->direction() == QAbstractAnimation::Forward ? delta : -delta); - animation->setCurrentTime(elapsed); + isPauseTimerActive = false; + // invalidate the start reference time + time = QTime(); + } else { + restartAnimationTimer(); + if (!time.isValid()) { + lastTick = 0; + time.start(); } - currentAnimationIdx = 0; } + } else if (event->timerId() == animationTimer.timerId()) { + // update current time on all top level animations + updateAnimationsTime(); + restartAnimationTimer(); } } -void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation) +void QUnifiedTimer::registerAnimation(QAbstractAnimation *animation, bool isTopLevel) { - Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer); - QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true; - animationsToStart << animation; - startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); + registerRunningAnimation(animation); + if (isTopLevel) { + Q_ASSERT(!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer); + QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = true; + animationsToStart << animation; + startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); + } } void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) { + unregisterRunningAnimation(animation); + if (!QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer) return; @@ -245,6 +289,7 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) // this is needed if we unregister an animation while its running if (idx <= currentAnimationIdx) --currentAnimationIdx; + if (animations.isEmpty()) startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } else { @@ -253,6 +298,46 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) QAbstractAnimationPrivate::get(animation)->hasRegisteredTimer = false; } +void QUnifiedTimer::registerRunningAnimation(QAbstractAnimation *animation) +{ + if (QAbstractAnimationPrivate::get(animation)->isGroup) + return; + + if (QAbstractAnimationPrivate::get(animation)->isPause) + runningPauseAnimations << animation; + else + runningLeafAnimations++; +} + +void QUnifiedTimer::unregisterRunningAnimation(QAbstractAnimation *animation) +{ + if (QAbstractAnimationPrivate::get(animation)->isGroup) + return; + + if (QAbstractAnimationPrivate::get(animation)->isPause) + runningPauseAnimations.removeOne(animation); + else + runningLeafAnimations--; +} + +int QUnifiedTimer::closestPauseAnimationTimeToFinish() +{ + int closestTimeToFinish = INT_MAX; + for (int i = 0; i < runningPauseAnimations.size(); ++i) { + QAbstractAnimation *animation = runningPauseAnimations.at(i); + int timeToFinish; + + if (animation->direction() == QAbstractAnimation::Forward) + timeToFinish = animation->totalDuration() - QAbstractAnimationPrivate::get(animation)->totalCurrentTime; + else + timeToFinish = QAbstractAnimationPrivate::get(animation)->totalCurrentTime; + + if (timeToFinish < closestTimeToFinish) + closestTimeToFinish = timeToFinish; + } + return closestTimeToFinish; +} + void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) { Q_Q(QAbstractAnimation); @@ -270,7 +355,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) //here we reset the time if needed //we don't call setCurrentTime because this might change the way the animation //behaves: changing the state or changing the current value - totalCurrentTime = currentTime =(direction == QAbstractAnimation::Forward) ? + totalCurrentTime = currentTime = (direction == QAbstractAnimation::Forward) ? 0 : (loopCount == -1 ? q->duration() : q->totalDuration()); } @@ -292,22 +377,31 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) switch (state) { case QAbstractAnimation::Paused: + if (hasRegisteredTimer) + // currentTime needs to be updated if pauseTimer is active + QUnifiedTimer::instance()->ensureTimerUpdate(q); + if (!guard) + return; + QUnifiedTimer::instance()->unregisterAnimation(q); + break; case QAbstractAnimation::Running: - //this ensures that the value is updated now that the animation is running - if(oldState == QAbstractAnimation::Stopped) { - q->setCurrentTime(currentTime); - if (!guard) - return; - } + { + bool isTopLevel = !group || group->state() == QAbstractAnimation::Stopped; + + // this ensures that the value is updated now that the animation is running + if (oldState == QAbstractAnimation::Stopped) { + if (isTopLevel) + // currentTime needs to be updated if pauseTimer is active + QUnifiedTimer::instance()->ensureTimerUpdate(q); + if (!guard) + return; + } - // Register timer if our parent is not running. - if (state == QAbstractAnimation::Running) { - if (!group || group->state() == QAbstractAnimation::Stopped) { - QUnifiedTimer::instance()->registerAnimation(q); + // test needed in case we stop in the setCurrentTime inside ensureTimerUpdate (zero duration) + if (state == QAbstractAnimation::Running) { + // register timer if our parent is not running + QUnifiedTimer::instance()->registerAnimation(q, isTopLevel); } - } else { - //new state is paused - QUnifiedTimer::instance()->unregisterAnimation(q); } break; case QAbstractAnimation::Stopped: @@ -452,7 +546,6 @@ void QAbstractAnimation::setDirection(Direction direction) if (d->direction == direction) return; - d->direction = direction; if (state() == Stopped) { if (direction == Backward) { d->currentTime = duration(); @@ -462,7 +555,19 @@ void QAbstractAnimation::setDirection(Direction direction) d->currentLoop = 0; } } + + // the commands order below is important: first we need to setCurrentTime with the old direction, + // then update the direction on this and all children and finally restart the pauseTimer if needed + if (d->hasRegisteredTimer) + QUnifiedTimer::instance()->ensureTimerUpdate(this); + + d->direction = direction; updateDirection(direction); + + if (d->hasRegisteredTimer) + // needed to update the timer interval in case of a pause animation + QUnifiedTimer::instance()->restartAnimationTimer(); + emit directionChanged(direction); } @@ -659,7 +764,7 @@ void QAbstractAnimation::stop() /*! Pauses the animation. When the animation is paused, state() returns Paused. - The value of currentTime will remain unchanged until resume() or start() + The value of currentTime will remain unchanged until resume() or start() is called. If you want to continue from the current time, call resume(). \sa start(), state(), resume() diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 1a79f40..bef0499 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -70,12 +70,14 @@ public: QAbstractAnimationPrivate() : state(QAbstractAnimation::Stopped), direction(QAbstractAnimation::Forward), - deleteWhenStopped(false), totalCurrentTime(0), currentTime(0), loopCount(1), currentLoop(0), + deleteWhenStopped(false), hasRegisteredTimer(false), + isPause(false), + isGroup(false), group(0) { } @@ -89,7 +91,6 @@ public: QAbstractAnimation::State state; QAbstractAnimation::Direction direction; - bool deleteWhenStopped; void setState(QAbstractAnimation::State state); int totalCurrentTime; @@ -97,7 +98,10 @@ public: int loopCount; int currentLoop; + bool deleteWhenStopped; bool hasRegisteredTimer; + bool isPause; + bool isGroup; QAnimationGroup *group; @@ -115,14 +119,14 @@ public: //XXX this is needed by dui static Q_CORE_EXPORT QUnifiedTimer *instance(); - void registerAnimation(QAbstractAnimation *animation); + void registerAnimation(QAbstractAnimation *animation, bool isTopLevel); void unregisterAnimation(QAbstractAnimation *animation); //defines the timing interval. Default is DEFAULT_TIMER_INTERVAL void setTimingInterval(int interval) { timingInterval = interval; - if (animationTimer.isActive()) { + if (animationTimer.isActive() && !isPauseTimerActive) { //we changed the timing interval animationTimer.start(timingInterval, this); } @@ -134,22 +138,46 @@ public: */ void setConsistentTiming(bool consistent) { consistentTiming = consistent; } - int elapsedTime() const { return lastTick; } + /* + this is used for updating the currentTime of all animations in case the pause + timer is active or, otherwise, only of the animation passed as parameter. + */ + void ensureTimerUpdate(QAbstractAnimation *animation); + + /* + this will evaluate the need of restarting the pause timer in case there is still + some pause animations running. + */ + void restartAnimationTimer(); protected: void timerEvent(QTimerEvent *); private: - // timer used for all active animations + // timer used for all active (running) animations QBasicTimer animationTimer; - // timer used to delay the check if we should start/stop the global timer + // timer used to delay the check if we should start/stop the animation timer QBasicTimer startStopAnimationTimer; + QTime time; int lastTick; int timingInterval; int currentAnimationIdx; bool consistentTiming; + // bool to indicate that only pause animations are active + bool isPauseTimerActive; + QList<QAbstractAnimation*> animations, animationsToStart; + + // this is the count of running animations that are not a group neither a pause animation + int runningLeafAnimations; + QList<QAbstractAnimation*> runningPauseAnimations; + + void registerRunningAnimation(QAbstractAnimation *animation); + void unregisterRunningAnimation(QAbstractAnimation *animation); + + void updateAnimationsTime(); + int closestPauseAnimationTimeToFinish(); }; QT_END_NAMESPACE diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h index 45eab58..bb1cfb3 100644 --- a/src/corelib/animation/qanimationgroup_p.h +++ b/src/corelib/animation/qanimationgroup_p.h @@ -68,7 +68,9 @@ class QAnimationGroupPrivate : public QAbstractAnimationPrivate Q_DECLARE_PUBLIC(QAnimationGroup) public: QAnimationGroupPrivate() - { } + { + isGroup = true; + } virtual void animationInsertedAt(int index) { Q_UNUSED(index) }; virtual void animationRemovedAt(int index); diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 2812854..0a04c14 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -136,7 +136,9 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) int dura = duration(); if (dura > 0) { for (int i = 0; i < d->animations.size(); ++i) { - d->animations.at(i)->setCurrentTime(dura); // will stop + QAbstractAnimation *animation = d->animations.at(i); + if (animation->state() != QAbstractAnimation::Stopped) + d->animations.at(i)->setCurrentTime(dura); // will stop } } } else if (d->currentLoop < d->lastLoop) { @@ -160,7 +162,7 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) QAbstractAnimation *animation = d->animations.at(i); const int dura = animation->totalDuration(); //if the loopcount is bigger we should always start all animations - if (d->currentLoop > d->lastLoop + if (d->currentLoop > d->lastLoop //if we're at the end of the animation, we need to start it if it wasn't already started in this loop //this happens in Backward direction where not all animations are started at the same time || d->shouldAnimationStart(animation, d->lastCurrentTime > dura /*startIfAtEnd*/)) { @@ -283,7 +285,7 @@ bool QParallelAnimationGroupPrivate::shouldAnimationStart(QAbstractAnimation *an void QParallelAnimationGroupPrivate::applyGroupState(QAbstractAnimation *animation) { - switch (state) + switch (state) { case QAbstractAnimation::Running: animation->start(); diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp index 2fd12aa..d90f001 100644 --- a/src/corelib/animation/qpauseanimation.cpp +++ b/src/corelib/animation/qpauseanimation.cpp @@ -75,6 +75,7 @@ class QPauseAnimationPrivate : public QAbstractAnimationPrivate public: QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(0) { + isPause = true; } int duration; diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 742f4ec..5a7b559 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -46,6 +46,7 @@ #include "qthreadstorage.h" #include "qdir.h" #include "qstringlist.h" +#include "qdatetime.h" #ifndef QT_NO_QOBJECT #include <private/qthread_p.h> @@ -2523,6 +2524,33 @@ void qsrand(uint seed) #endif } +/*! \internal + \relates <QtGlobal> + \since 4.6 + + Seed the PRNG, but only if it has not already been seeded. + + The default seed is a combination of current time, a stack address and a + serial counter (since thread stack addresses are re-used). +*/ +void qsrand() +{ +#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN) + SeedStorageType *pseed = randTLS()->localData(); + if (pseed) { + // already seeded + return; + } + randTLS()->setLocalData(pseed = new SeedStorageType); + static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0); + *pseed = QDateTime::currentDateTime().toTime_t() + + quintptr(&pseed) + + serial.fetchAndAddRelaxed(1); +#else + // On Windows, we assume that rand() already does the right thing +#endif +} + /*! \relates <QtGlobal> \since 4.2 @@ -2645,7 +2673,7 @@ int qrand() \relates <QtGlobal> Marks the string literal \a sourceText for dynamic translation in - the given \a context, i.e the stored \a sourceText will not be + the given \a context; i.e, the stored \a sourceText will not be altered. The \a context is typically a class and also needs to be specified as string literal. diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 9d76dcc..ad4bc55 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -71,8 +71,8 @@ Qt { Q_ENUMS(ArrowType ToolButtonStyle PenStyle PenCapStyle PenJoinStyle BrushStyle) Q_ENUMS(FillRule MaskMode BGMode ClipOperation SizeMode) Q_ENUMS(BackgroundMode) // Qt3 - Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation) - Q_FLAGS(Alignment Orientations) + Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation DropAction) + Q_FLAGS(Alignment Orientations DropActions) Q_FLAGS(DockWidgetAreas ToolBarAreas) Q_ENUMS(DockWidgetArea ToolBarArea) Q_ENUMS(TextFormat) @@ -501,8 +501,6 @@ public: WA_WState_AcceptedTouchBeginEvent = 122, WA_TouchPadAcceptSingleTouchEvents = 123, - WA_DontUseStandardGestures = 124, - // Add new attributes before this line WA_AttributeCount }; @@ -1615,9 +1613,29 @@ public: enum GestureState { NoGesture, - GestureStarted = 1, - GestureUpdated = 2, - GestureFinished = 3 + GestureStarted = 1, + GestureUpdated = 2, + GestureFinished = 3, + GestureCanceled = 4 + }; + + enum GestureType + { + TapGesture = 1, + TapAndHoldGesture = 2, + PanGesture = 3, + PinchGesture = 4, + SwipeGesture = 5, + + CustomGesture = 0x0100, + + LastGestureType = ~0u + }; + + enum GestureContext + { + WidgetGesture = 0, + WidgetWithChildrenGesture = 3 }; enum NavigationMode @@ -1638,7 +1656,6 @@ public: ; #endif - Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MouseButtons) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::Orientations) Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::KeyboardModifiers) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b7775bd..ba05b00 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -713,7 +713,13 @@ \omitvalue Dither_Mask \omitvalue AlphaDither_Mask \omitvalue DitherMode_Mask - \omitvalue NoOpaqueDetection + + \value NoOpaqueDetection Do not check whether the image contains non-opaque + pixels. Use this if you know that the image is semi-transparent and + you want to avoid the overhead of checking the pixels in the image + until a non-opaque pixel is found, or if you want the pixmap to + retain an alpha channel for some other reason. If the image has no + alpha channel this flag has no effect. */ /*! \enum Qt::GUIStyle @@ -1219,8 +1225,6 @@ \value WA_TouchPadAcceptSingleTouchEvents Allows touchpad single touch events to be sent to the widget. - \value WA_DontUseStandardGestures Disables standard gestures on Qt widgets. - \omitvalue WA_SetLayoutDirection \omitvalue WA_InputMethodTransparent \omitvalue WA_WState_CompressKeys @@ -2792,15 +2796,54 @@ This enum type describes the state of a gesture. - \value NoGesture Initial state \value GestureStarted A continuous gesture has started. \value GestureUpdated A gesture continues. \value GestureFinished A gesture has finished. + \value GestureCanceled A gesture was canceled. + \omitvalue NoGesture \sa QGesture */ /*! + \enum Qt::GestureType + \since 4.6 + + This enum type describes the standard gestures. + + \value TapGesture A Tap gesture. + \value TapAndHoldGesture A Tap-And-Hold (Long-Tap) gesture. + \value PanGesture A Pan gesture. + \value PinchGesture A Pinch gesture. + \value SwipeGesture A Swipe gesture. + \value CustomGesture User-defined gesture ID. + \value LastGestureType Last user gesture ID. + + User-defined gestures are registered with the + QApplication::registerGestureRecognizer() function which generates a custom gesture ID + in the range of values from CustomGesture to LastGestureType. + + \sa QGesture, QWidget::grabGesture() +*/ + +/*! + \enum Qt::GestureContext + \since 4.6 + + This enum type describes the context of a gesture. + + For a QGesture to trigger, the gesture recognizer should filter events for + a widget tree. This enum describes for which widget the gesture recognizer + should filter events: + + \value WidgetGesture Gestures can only start over the widget itself. + \value WidgetWithChildrenGesture Gestures can start on the widget or over + any of its children. + + \sa QWidget::grabGesture() +*/ + +/*! \enum Qt::NavigationMode \since 4.6 diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 114da3b..b0cddaa 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1255,8 +1255,19 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla int realOffset = offset / pagesSize; int extra = offset % pagesSize; - void *mapAddress = mmap((void*)0, (size_t)size + extra, - access, MAP_SHARED, nativeHandle(), realOffset * pagesSize); +#ifdef Q_OS_SYMBIAN + void *mapAddress; + TRAPD(err, mapAddress = mmap((void*)0, (size_t)size + extra, + access, MAP_SHARED, nativeHandle(), realOffset * pagesSize)); + if (err != KErrNone) { + qWarning("OpenC bug: leave from mmap %d", err); + mapAddress = MAP_FAILED; + errno = EINVAL; + } +#else + void *mapAddress = mmap((void*)0, (size_t)size + extra, + access, MAP_SHARED, nativeHandle(), realOffset * pagesSize); +#endif if (MAP_FAILED != mapAddress) { uchar *address = extra + static_cast<uchar*>(mapAddress); maps[address] = QPair<int,int>(extra, size); diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a6a61dd..37161bc 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -97,6 +97,10 @@ QT_END_NAMESPACE #include <private/qwineventnotifier_p.h> #endif +#ifdef Q_OS_SYMBIAN +#include <e32std.h> +#endif + #ifndef QT_NO_PROCESS QT_BEGIN_NAMESPACE @@ -412,7 +416,7 @@ void QProcessPrivate::Channel::clear() } /*! \fn bool QProcessPrivate::startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid) - + \internal */ @@ -2238,7 +2242,7 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() \relates QProcess Typedef for the identifiers used to represent processes on the underlying - platform. On Unix, this corresponds to \l qint64; on Windows, it + platform. On Unix and Symbian, this corresponds to \l qint64; on Windows, it corresponds to \c{_PROCESS_INFORMATION*}. \sa QProcess::pid() diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 09a6fc8..ffcd5de 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -54,13 +54,8 @@ QT_MODULE(Core) #ifndef QT_NO_PROCESS -#if (!defined(Q_OS_WIN32) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)) || defined(qdoc) +#if (!defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)) || defined(qdoc) typedef qint64 Q_PID; -#elif defined(Q_OS_SYMBIAN) -QT_END_NAMESPACE -# include <e32std.h> -QT_BEGIN_NAMESPACE -typedef TProcessId Q_PID; #else QT_END_NAMESPACE typedef struct _PROCESS_INFORMATION *Q_PID; diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 8092792..09be544 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -77,6 +77,9 @@ class QSocketNotifier; class QWindowsPipeWriter; class QWinEventNotifier; class QTimer; +#if defined(Q_OS_SYMBIAN) +class RProcess; +#endif class QProcessEnvironmentPrivate: public QSharedData { diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index f5de750..1f5117f 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -791,7 +791,7 @@ void QProcessPrivate::startProcess() TInt err = qt_create_symbian_process(&symbianProcess, program, arguments); if (err == KErrNone) { - pid = symbianProcess->Id(); + pid = symbianProcess->Id().Id(); ::fcntl(deathPipe[0], F_SETFL, ::fcntl(deathPipe[0], F_GETFL) | O_NONBLOCK); @@ -816,7 +816,7 @@ void QProcessPrivate::startProcess() symbianProcess->Resume(); - QPROCESS_DEBUG_PRINT("QProcessPrivate::startProcess(): this: 0x%x, pid: %d", this, (TUint)pid); + QPROCESS_DEBUG_PRINT("QProcessPrivate::startProcess(): this: 0x%x, pid: %ld", this, pid); // Notify child start _q_startupNotification(); @@ -1021,7 +1021,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a if (err == KErrNone) { if (pid) - *pid = (qint64)newProc->Id(); + *pid = newProc->Id().Id(); newProc->Resume(); newProc->Close(); diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 44a354b..9098515 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -229,6 +229,8 @@ QT_BEGIN_NAMESPACE \value TouchUpdate Touch-screen event (QTouchEvent) \value TouchEnd End of touch-event sequence (QTouchEvent) \value WinIdChange The window system identifer for this native widget has changed + \value Gesture A gesture was triggered (QGestureEvent) + \value GestureOverride A gesture override was triggered (QGestureEvent) User events should have values between \c User and \c{MaxUser}: diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 99280d3..6427d17 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -284,6 +284,8 @@ public: UpdateSoftKeys = 201, // Internal for compressing soft key updates WinIdChange = 203, + Gesture = 198, + GestureOverride = 202, // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event @@ -326,6 +328,7 @@ private: friend class QGraphicsView; friend class QGraphicsViewPrivate; friend class QGraphicsScenePrivate; + friend class QGestureManager; }; class Q_CORE_EXPORT QTimerEvent : public QEvent diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index acbb7e4..02f77a1 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -749,11 +749,11 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla block = false; if (timeState == TimeStarted && time.elapsed() > 100) { priority = m_processHandle.Priority(); - m_processHandle.SetPriority(EPriorityLow); + m_processHandle.SetPriority(EPriorityBackground); time.start(); // Slight chance of race condition in the next lines, but nothing fatal // will happen, just wrong priority. - if (m_processHandle.Priority() == EPriorityLow) { + if (m_processHandle.Priority() == EPriorityBackground) { m_processHandle.SetPriority(priority); } } diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 7224ad3..3c79653 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -548,9 +548,11 @@ bool QUuid::operator>(const QUuid &other) const On any platform other than Windows, this function returns a new UUID with variant QUuid::DCE and version QUuid::Random. The random numbers used to construct the UUID are obtained from the local - pseudo-random generator, which is usually not a cryptographic + pseudo-random generator, qrand(), which is usually not a cryptographic quality random number generator. Therefore, a UUID generated by - this function can't be guaranteed to be unique. + this function can't be guaranteed to be unique. If the pseudo-random + number generator for the calling thread has not yet been seeded, this + function will seed the pseudo-random number generator by calling qsrand(). On a Windows platform, a GUID is generated, which almost certainly \e{will} be unique, on this or any other system, networked or not. @@ -578,6 +580,8 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "stdlib.h" // For srand/rand QT_END_INCLUDE_NAMESPACE +extern void qsrand(); // in qglobal.cpp + QUuid QUuid::createUuid() { static const int intbits = sizeof(int)*8; @@ -585,10 +589,11 @@ QUuid QUuid::createUuid() if (!randbits) { int max = RAND_MAX; do { ++randbits; } while ((max=max>>1)); - qsrand((uint)QDateTime::currentDateTime().toTime_t()); - qrand(); // Skip first } + // reseed, but only if not already seeded + qsrand(); + QUuid result; uint *data = &(result.data1); int chunks = 16 / sizeof(uint); |