summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp189
-rw-r--r--src/corelib/animation/qabstractanimation_p.h42
-rw-r--r--src/corelib/animation/qanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp8
-rw-r--r--src/corelib/animation/qpauseanimation.cpp1
-rw-r--r--src/corelib/global/qglobal.cpp30
-rw-r--r--src/corelib/global/qnamespace.h33
-rw-r--r--src/corelib/global/qnamespace.qdoc43
-rw-r--r--src/corelib/io/qprocess.cpp8
-rw-r--r--src/corelib/io/qprocess.h7
-rw-r--r--src/corelib/io/qprocess_p.h3
-rw-r--r--src/corelib/io/qprocess_symbian.cpp6
-rw-r--r--src/corelib/io/qsettings.cpp24
-rw-r--r--src/corelib/io/qurl.cpp9
-rw-r--r--src/corelib/kernel/qcoreevent.cpp3
-rw-r--r--src/corelib/kernel/qcoreevent.h5
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp4
-rw-r--r--src/corelib/kernel/qobject.cpp5
-rw-r--r--src/corelib/plugin/quuid.cpp13
-rw-r--r--src/corelib/tools/qdatetime.cpp32
20 files changed, 342 insertions, 127 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 4234a7e..f28f94e 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -44,10 +44,6 @@
#include <QtCore/qglobal.h>
-#ifdef Q_OS_SYMBIAN
-# include <e32def.h>
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -501,8 +497,6 @@ public:
WA_WState_AcceptedTouchBeginEvent = 122,
WA_TouchPadAcceptSingleTouchEvents = 123,
- WA_DontUseStandardGestures = 124,
-
// Add new attributes before this line
WA_AttributeCount
};
@@ -1615,9 +1609,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 +1652,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 ab232bf..ba05b00 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1225,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
@@ -2798,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/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/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 1fd2165..a1c9833 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2565,8 +2565,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
Example:
\snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 10
- The scope is QSettings::UserScope and the format is
- QSettings::NativeFormat.
+ The scope is set to QSettings::UserScope, and the format is
+ set to QSettings::NativeFormat (i.e. calling setDefaultFormat()
+ before calling this constructor has no effect).
\sa setDefaultFormat(), {Fallback Mechanism}
*/
@@ -2583,11 +2584,12 @@ QSettings::QSettings(const QString &organization, const QString &application, QO
If \a scope is QSettings::UserScope, the QSettings object searches
user-specific settings first, before it searches system-wide
- settings as a fallback. If \a scope is
- QSettings::SystemScope, the QSettings object ignores user-specific
- settings and provides access to system-wide settings.
+ settings as a fallback. If \a scope is QSettings::SystemScope, the
+ QSettings object ignores user-specific settings and provides
+ access to system-wide settings.
- The storage format is QSettings::NativeFormat.
+ The storage format is set to QSettings::NativeFormat (i.e. calling
+ setDefaultFormat() before calling this constructor has no effect).
If no application name is given, the QSettings object will
only access the organization-wide \l{Fallback Mechanism}{locations}.
@@ -2668,6 +2670,8 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent)
The scope is QSettings::UserScope and the format is
defaultFormat() (QSettings::NativeFormat by default).
+ Use setDefaultFormat() before calling this constructor
+ to change the default format used by this constructor.
The code
@@ -3352,10 +3356,12 @@ QVariant QSettings::value(const QString &key, const QVariant &defaultValue) cons
/*!
\since 4.4
- Sets the default file format to the given \a format, used for storing
- settings for the QSettings(QObject *) constructor.
+ Sets the default file format to the given \a format, which is used
+ for storing settings for the QSettings(QObject *) constructor.
- If no default format is set, QSettings::NativeFormat is used.
+ If no default format is set, QSettings::NativeFormat is used. See
+ the documentation for the QSettings constructor you are using to
+ see if that constructor will ignore this function.
\sa format()
*/
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 22d0019..6001d9d 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3874,10 +3874,15 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
}
}
- if (host.startsWith(QLatin1Char('[')))
+ if (host.startsWith(QLatin1Char('['))) {
url += host.toLatin1();
- else
+ } else if (host.contains(QLatin1Char(':'))) {
+ url += '[';
+ url += host.toLatin1();
+ url += ']';
+ } else {
url += QUrl::toAce(host);
+ }
if (!(options & QUrl::RemovePort) && port != -1) {
url += ':';
url += QString::number(port).toAscii();
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 744e6a9..9098515 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -228,6 +228,9 @@ QT_BEGIN_NAMESPACE
\value TouchBegin Beginning of a sequence of touch-screen and/or track-pad events (QTouchEvent)
\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 d66cead..6427d17 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -283,6 +283,10 @@ 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
@@ -324,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/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index a8120cf..7be19b3 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3332,6 +3332,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
if (!connectionLists) {
+ locker.unlock();
if (qt_signal_spy_callback_set.signal_end_callback != 0)
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
return;
@@ -3401,11 +3402,11 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
}
#endif
- locker.relock();
-
if (qt_signal_spy_callback_set.slot_end_callback != 0)
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
+ locker.relock();
+
QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
if (connectionLists->orphaned)
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);
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 1277623..1b559cf 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -54,6 +54,7 @@
#ifndef Q_WS_WIN
#include <locale.h>
#endif
+
#include <time.h>
#if defined(Q_OS_WINCE)
#include "qfunctions_wince.h"
@@ -68,31 +69,6 @@
# define QDTPDEBUGN if (false) qDebug
#endif
-#if defined(Q_OS_SYMBIAN)
- // Workaround for OpenC bug.
-
- // OpenC incorrectly caches DST information between localtime_r
- // calls, i.e. if previous call to localtime_r has been called for DST
- // affected date, also the second call will be affected by DST even
- // the date is such that DST should not be applied.
-
- // The workaround is to call mktime with non-DST affected date before
- // calling localtime_r. mktime call resets the OpenC internal DST cache
- // to right value and localtime_r will return correct values.
-#define FIX_OPENC_DSTCACHE \
- tm localTM; \
- localTM.tm_sec = 0; \
- localTM.tm_min = 0; \
- localTM.tm_hour = 12; \
- localTM.tm_mday = 1; \
- localTM.tm_mon = 1; \
- localTM.tm_year = 2002 - 1900; \
- localTM.tm_isdst = -1; \
- time_t temp = mktime(&localTM);
-#else
-#define FIX_OPENC_DSTCACHE
-#endif
-
#if defined(Q_WS_MAC)
#include <private/qcore_mac_p.h>
#endif
@@ -1162,7 +1138,6 @@ QDate QDate::currentDate()
// use the reentrant version of localtime() where available
tzset();
tm res;
- FIX_OPENC_DSTCACHE
t = localtime_r(&ltime, &res);
#else
t = localtime(&ltime);
@@ -1859,13 +1834,12 @@ QTime QTime::currentTime()
// use the reentrant version of localtime() where available
tzset();
tm res;
- FIX_OPENC_DSTCACHE
t = localtime_r(&ltime, &res);
#else
t = localtime(&ltime);
#endif
Q_CHECK_PTR(t);
-
+
ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec
+ tv.tv_usec / 1000;
#else
@@ -2913,7 +2887,6 @@ QDateTime QDateTime::currentDateTime()
// use the reentrant version of localtime() where available
tzset();
tm res;
- FIX_OPENC_DSTCACHE
t = localtime_r(&ltime, &res);
#else
t = localtime(&ltime);
@@ -3731,7 +3704,6 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time)
// use the reentrant version of localtime() where available
tzset();
tm res;
- FIX_OPENC_DSTCACHE
brokenDown = localtime_r(&secsSince1Jan1970UTC, &res);
#elif defined(_MSC_VER) && _MSC_VER >= 1400
tm res;