summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-09-08 00:14:12 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-09-08 00:14:12 (GMT)
commitf6c08f5e68c90338a8402c0912cd6be72e84b1e6 (patch)
treed928f975e686b752cd1fc47eca812f376d9d0a03 /src/corelib
parent276a44c0867a76a90b425baa8dcbda733d25b3fb (diff)
parent0cbbc9cb9e87a3a39ee1597f4cea1c2b77d8f8da (diff)
downloadQt-f6c08f5e68c90338a8402c0912cd6be72e84b1e6.zip
Qt-f6c08f5e68c90338a8402c0912cd6be72e84b1e6.tar.gz
Qt-f6c08f5e68c90338a8402c0912cd6be72e84b1e6.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/arch/i386/qatomic_i386.s40
-rw-r--r--src/corelib/arch/qatomic_windows.h49
-rw-r--r--src/corelib/arch/x86_64/qatomic_sun.s40
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp3
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp12
-rw-r--r--src/corelib/kernel/qobject.cpp14
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp42
8 files changed, 59 insertions, 143 deletions
diff --git a/src/corelib/arch/i386/qatomic_i386.s b/src/corelib/arch/i386/qatomic_i386.s
index 63facc1..08158f9 100644
--- a/src/corelib/arch/i386/qatomic_i386.s
+++ b/src/corelib/arch/i386/qatomic_i386.s
@@ -1,43 +1,3 @@
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!
-!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-!! Contact: Nokia Corporation (qt-info@nokia.com)
-!!
-!! This file is part of the QtGui module of the Qt Toolkit.
-!!
-!! $QT_BEGIN_LICENSE:LGPL$
-!! No Commercial Usage
-!! This file contains pre-release code and may not be distributed.
-!! You may use this file in accordance with the terms and conditions
-!! contained in the Technology Preview License Agreement accompanying
-!! this package.
-!!
-!! GNU Lesser General Public License Usage
-!! Alternatively, this file may be used under the terms of the GNU Lesser
-!! General Public License version 2.1 as published by the Free Software
-!! Foundation and appearing in the file LICENSE.LGPL included in the
-!! packaging of this file. Please review the following information to
-!! ensure the GNU Lesser General Public License version 2.1 requirements
-!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-!!
-!! In addition, as a special exception, Nokia gives you certain
-!! additional rights. These rights are described in the Nokia Qt LGPL
-!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
-!! package.
-!!
-!! If you have questions regarding the use of this file, please contact
-!! Nokia at qt-info@nokia.com.
-!!
-!!
-!!
-!!
-!!
-!!
-!!
-!!
-!! $QT_END_LICENSE$
-!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.text
.align 4,0x90
diff --git a/src/corelib/arch/qatomic_windows.h b/src/corelib/arch/qatomic_windows.h
index 6082d0b..07b0b25 100644
--- a/src/corelib/arch/qatomic_windows.h
+++ b/src/corelib/arch/qatomic_windows.h
@@ -102,9 +102,14 @@
#define QT_INTERLOCKED_CONCAT(prefix, suffix) \
QT_INTERLOCKED_CONCAT_I(prefix, suffix)
-// MSVC intrinsics prefix function names with an underscore
+// MSVC intrinsics prefix function names with an underscore. Also, if platform
+// SDK headers have been included, the Interlocked names may be defined as
+// macros.
+// To avoid double underscores, we paste the prefix with Interlocked first and
+// then the remainder of the function name.
#define QT_INTERLOCKED_FUNCTION(name) \
- QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, name)
+ QT_INTERLOCKED_CONCAT( \
+ QT_INTERLOCKED_CONCAT(QT_INTERLOCKED_PREFIX, Interlocked), name)
#ifdef QT_INTERLOCKED_NO_VOLATILE
# define QT_INTERLOCKED_VOLATILE
@@ -127,16 +132,16 @@
extern "C" {
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedIncrement )(long QT_INTERLOCKED_VOLATILE *);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedDecrement )(long QT_INTERLOCKED_VOLATILE *);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedCompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchange )(long QT_INTERLOCKED_VOLATILE *, long);
- long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Increment )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Decrement )(long QT_INTERLOCKED_VOLATILE *);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( CompareExchange )(long QT_INTERLOCKED_VOLATILE *, long, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( Exchange )(long QT_INTERLOCKED_VOLATILE *, long);
+ long QT_INTERLOCKED_PROTOTYPE QT_INTERLOCKED_FUNCTION( ExchangeAdd )(long QT_INTERLOCKED_VOLATILE *, long);
# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
- void * QT_INTERLOCKED_FUNCTION( InterlockedCompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
- void * QT_INTERLOCKED_FUNCTION( InterlockedExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
- __int64 QT_INTERLOCKED_FUNCTION( InterlockedExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
+ void * QT_INTERLOCKED_FUNCTION( CompareExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *, void *);
+ void * QT_INTERLOCKED_FUNCTION( ExchangePointer )(void * QT_INTERLOCKED_VOLATILE *, void *);
+ __int64 QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )(__int64 QT_INTERLOCKED_VOLATILE *, __int64);
# endif
}
@@ -156,7 +161,7 @@ extern "C" {
# pragma intrinsic (_InterlockedCompareExchange)
# pragma intrinsic (_InterlockedExchangeAdd)
-# ifndef _M_IX86
+# if !defined(Q_OS_WINCE) && !defined(_M_IX86)
# pragma intrinsic (_InterlockedCompareExchangePointer)
# pragma intrinsic (_InterlockedExchangePointer)
# pragma intrinsic (_InterlockedExchangeAdd64)
@@ -168,26 +173,26 @@ extern "C" {
// Interlocked* replacement macros
#define QT_INTERLOCKED_INCREMENT(value) \
- QT_INTERLOCKED_FUNCTION(InterlockedIncrement)( \
+ QT_INTERLOCKED_FUNCTION( Increment )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ) )
#define QT_INTERLOCKED_DECREMENT(value) \
- QT_INTERLOCKED_FUNCTION(InterlockedDecrement)( \
+ QT_INTERLOCKED_FUNCTION( Decrement )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ) )
#define QT_INTERLOCKED_COMPARE_EXCHANGE(value, newValue, expectedValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \
+ QT_INTERLOCKED_FUNCTION( CompareExchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
newValue, \
expectedValue )
#define QT_INTERLOCKED_EXCHANGE(value, newValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \
+ QT_INTERLOCKED_FUNCTION( Exchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
newValue )
#define QT_INTERLOCKED_EXCHANGE_ADD(value, valueToAdd) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \
+ QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ), \
valueToAdd )
@@ -195,36 +200,36 @@ extern "C" {
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
reinterpret_cast<void *>( \
- QT_INTERLOCKED_FUNCTION(InterlockedCompareExchange)( \
+ QT_INTERLOCKED_FUNCTION( CompareExchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
(long)( newValue ), \
(long)( expectedValue ) ))
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchange)( \
+ QT_INTERLOCKED_FUNCTION( Exchange )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
(quintptr)( newValue ) )
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd)( \
+ QT_INTERLOCKED_FUNCTION( ExchangeAdd )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
#else // !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86)
# define QT_INTERLOCKED_COMPARE_EXCHANGE_POINTER(value, newValue, expectedValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedCompareExchangePointer)( \
+ QT_INTERLOCKED_FUNCTION( CompareExchangePointer )( \
reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
newValue, \
expectedValue )
# define QT_INTERLOCKED_EXCHANGE_POINTER(value, newValue) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangePointer)( \
+ QT_INTERLOCKED_FUNCTION( ExchangePointer )( \
reinterpret_cast<void * QT_INTERLOCKED_VOLATILE *>( QT_INTERLOCKED_REMOVE_VOLATILE( value ) ), \
newValue )
# define QT_INTERLOCKED_EXCHANGE_ADD_POINTER(value, valueToAdd) \
- QT_INTERLOCKED_FUNCTION(InterlockedExchangeAdd64)( \
+ QT_INTERLOCKED_FUNCTION( ExchangeAdd64 )( \
QT_INTERLOCKED_REMOVE_VOLATILE( value ## _integral ), \
valueToAdd )
diff --git a/src/corelib/arch/x86_64/qatomic_sun.s b/src/corelib/arch/x86_64/qatomic_sun.s
index 4517fe4..37969e6 100644
--- a/src/corelib/arch/x86_64/qatomic_sun.s
+++ b/src/corelib/arch/x86_64/qatomic_sun.s
@@ -1,43 +1,3 @@
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!
-!! Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-!! Contact: Nokia Corporation (qt-info@nokia.com)
-!!
-!! This file is part of the QtGui module of the Qt Toolkit.
-!!
-!! $QT_BEGIN_LICENSE:LGPL$
-!! No Commercial Usage
-!! This file contains pre-release code and may not be distributed.
-!! You may use this file in accordance with the terms and conditions
-!! contained in the Technology Preview License Agreement accompanying
-!! this package.
-!!
-!! GNU Lesser General Public License Usage
-!! Alternatively, this file may be used under the terms of the GNU Lesser
-!! General Public License version 2.1 as published by the Free Software
-!! Foundation and appearing in the file LICENSE.LGPL included in the
-!! packaging of this file. Please review the following information to
-!! ensure the GNU Lesser General Public License version 2.1 requirements
-!! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-!!
-!! In addition, as a special exception, Nokia gives you certain
-!! additional rights. These rights are described in the Nokia Qt LGPL
-!! Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
-!! package.
-!!
-!! If you have questions regarding the use of this file, please contact
-!! Nokia at qt-info@nokia.com.
-!!
-!!
-!!
-!!
-!!
-!!
-!!
-!!
-!! $QT_END_LICENSE$
-!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.code64
.globl q_atomic_increment
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 68246f2..57be50a 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1372,7 +1372,7 @@ inline void qt_noop() {}
#ifdef QT_BOOTSTRAPPED
# define QT_NO_EXCEPTIONS
#endif
-#if defined(Q_CC_GNU) && !defined (__EXCEPTIONS)
+#if !defined(QT_NO_EXCEPTIONS) && defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN)
# define QT_NO_EXCEPTIONS
#endif
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 022211c..50b4af7 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -731,6 +731,8 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
}
QAbstractFileEngine::FileFlags ret = 0;
+ if (type & FlagsMask)
+ ret |= LocalDiskFlag;
bool exists = d->doStat();
if (!exists && !d->isSymlink())
return ret;
@@ -796,7 +798,6 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
}
}
if (type & FlagsMask) {
- ret |= LocalDiskFlag;
if (exists)
ret |= ExistsFlag;
#if defined(Q_OS_SYMBIAN)
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index b7934db..c6ac6d4 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -331,7 +331,7 @@ public:
WinTimerVec timerVec;
WinTimerDict timerDict;
void registerTimer(WinTimerInfo *t);
- void unregisterTimer(WinTimerInfo *t);
+ void unregisterTimer(WinTimerInfo *t, bool closingDown = false);
void sendTimerEvent(int timerId);
// socket notifiers
@@ -557,10 +557,10 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t)
qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer");
}
-void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t)
+void QEventDispatcherWin32Private::unregisterTimer(WinTimerInfo *t, bool closingDown)
{
// mark timer as unused
- if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent)
+ if (!QObjectPrivate::get(t->obj)->inThreadChangeEvent && !closingDown)
QAbstractEventDispatcherPrivate::releaseTimerId(t->timerId);
if (t->interval == 0) {
@@ -1019,8 +1019,10 @@ void QEventDispatcherWin32::closingDown()
unregisterSocketNotifier((*(d->sn_except.begin()))->obj);
// clean up any timers
- while (!d->timerDict.isEmpty())
- unregisterTimer((*(d->timerDict.begin()))->timerId);
+ for (int i = 0; i < d->timerVec.count(); ++i)
+ d->unregisterTimer(d->timerVec.at(i), true);
+ d->timerVec.clear();
+ d->timerDict.clear();
}
bool QEventDispatcherWin32::event(QEvent *e)
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c0c97b8..e93c6ee 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3965,11 +3965,19 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
\relates QObject
This macro registers one or several \l{QFlags}{flags types} to the
- meta-object system.
+ meta-object system. It is typically used in a class definition to declare
+ that values of a given enum can be used as flags and combined using the
+ bitwise OR operator.
- Example:
+ For example, in QLibrary, the \l{QLibrary::LoadHints}{LoadHints} flag is
+ declared in the following way:
+
+ \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 39a
+
+ The declaration of the flags themselves is performed in the public section
+ of the QLibrary class itself, using the \l Q_DECLARE_FLAGS() macro:
- \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 39
+ \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 39b
\note This macro takes care of registering individual flag values
with the meta-object system, so it is unnecessary to use Q_ENUMS()
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index f562fb3..a5cdd45 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -78,13 +78,13 @@
QT_BEGIN_NAMESPACE
/*!
- \class QStateMachine
- \reentrant
+ \class QStateMachine
+ \reentrant
- \brief The QStateMachine class provides a hierarchical finite state machine.
+ \brief The QStateMachine class provides a hierarchical finite state machine.
- \since 4.6
- \ingroup statemachine
+ \since 4.6
+ \ingroup statemachine
QStateMachine is based on the concepts and notation of
\l{Statecharts: A visual formalism for complex
@@ -128,21 +128,7 @@ QT_BEGIN_NAMESPACE
The following snippet shows a state machine that will finish when a button
is clicked:
- \code
- QPushButton button;
-
- QStateMachine machine;
- QState *s1 = new QState();
- s1->assignProperty(&button, "text", "Click me");
-
- QFinalState *s2 = new QFinalState();
- s1->addTransition(&button, SIGNAL(clicked()), s2);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.setInitialState(s1);
- machine.start();
- \endcode
+ \snippet doc/src/snippets/code/src_corelib_statemachine_qstatemachine.cpp simple state machine
This code example uses QState, which inherits QAbstractState. The
QState class provides a state that you can use to set properties
@@ -160,17 +146,7 @@ QT_BEGIN_NAMESPACE
no error state applies to the erroneous state, the machine will stop
executing and an error message will be printed to the console.
- \omit This stuff will be moved elsewhere
-This is
- typically used in conjunction with \l{Signals and Slots}{signals}; the
- signals determine the flow of the state graph, whereas the states' property
- assignments and method invocations are the actions.
-
- The postEvent() function posts an event to the state machine. This is useful
- when you are using custom events to trigger transitions.
- \endomit
-
- \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
+ \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
*/
/*!
@@ -1748,6 +1724,10 @@ bool QStateMachine::isRunning() const
transition to the initial state. When a final top-level state (QFinalState)
is entered, the machine will emit the finished() signal.
+ \note A state machine will not run without a running event loop, such as
+ the main application event loop started with QCoreApplication::exec() or
+ QApplication::exec().
+
\sa started(), finished(), stop(), initialState()
*/
void QStateMachine::start()