From 9d4d1814eb7e130cd3ef75393a7957216dc14d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 26 Oct 2009 12:27:20 +0100 Subject: Fix THREAD and TOOLBAR Reviewed-by: tom Squash me with Fix THREAD and TOOLBAR a6e785b4ff9ec9cd48 --- src/corelib/global/qconfig-local.h | 4 +-- src/corelib/global/qfeatures.h | 29 ++++++++++-------- src/corelib/global/qfeatures.txt | 15 ++++++--- src/corelib/thread/qmutexpool.cpp | 20 ++++++------ src/corelib/thread/qmutexpool_p.h | 17 +++++++++-- src/corelib/thread/qthread.cpp | 24 +++++++++------ src/corelib/thread/qthread_p.h | 62 ++++++++++++++++++-------------------- src/gui/dialogs/qfscompleter_p.h | 4 +-- 8 files changed, 101 insertions(+), 74 deletions(-) diff --git a/src/corelib/global/qconfig-local.h b/src/corelib/global/qconfig-local.h index 90db873..b9a5090 100644 --- a/src/corelib/global/qconfig-local.h +++ b/src/corelib/global/qconfig-local.h @@ -1,3 +1,3 @@ -#ifndef QT_NO_SCROLLAREA -# define QT_NO_SCROLLAREA +#ifndef QT_NO_TOOLBAR +# define QT_NO_TOOLBAR #endif diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index e4fd67a..455fead 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -301,11 +301,6 @@ // //#define QT_NO_XMLSTREAM -// 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 @@ -496,6 +491,11 @@ #define QT_NO_XMLSTREAMWRITER #endif +// Animation +#if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES) || defined(QT_NO_THREAD)) +#define QT_NO_ANIMATION +#endif + // Context menu #if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU)) #define QT_NO_CONTEXTMENU @@ -686,11 +686,6 @@ #define QT_NO_TEXTEDIT #endif -// QDirModel -#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS)) -#define QT_NO_DIRMODEL -#endif - // QErrorMessage #if !defined(QT_NO_ERRORMESSAGE) && (defined(QT_NO_TEXTEDIT)) #define QT_NO_ERRORMESSAGE @@ -806,6 +801,11 @@ #define QT_NO_DOCKWIDGET #endif +// QDirModel +#if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_FILESYSTEMMODEL)) +#define QT_NO_DIRMODEL +#endif + // QUndoView #if !defined(QT_NO_UNDOVIEW) && (defined(QT_NO_UNDOSTACK) || defined(QT_NO_LISTVIEW)) #define QT_NO_UNDOVIEW @@ -816,6 +816,11 @@ #define QT_NO_GRAPHICSSVGITEM #endif +// QCompleter +#if !defined(QT_NO_FSCOMPLETER) && (defined(QT_NO_FILESYSTEMMODEL) || defined(QT_NO_COMPLETER)) +#define QT_NO_FSCOMPLETER +#endif + // QComboBox #if !defined(QT_NO_COMBOBOX) && (defined(QT_NO_LINEEDIT) || defined(QT_NO_STANDARDITEMMODEL) || defined(QT_NO_LISTVIEW)) #define QT_NO_COMBOBOX @@ -867,12 +872,12 @@ #endif // QFileDialog -#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET) || defined(QT_NO_FILESYSTEMMODEL)) +#if !defined(QT_NO_FILEDIALOG) && (defined(QT_NO_DIRMODEL) || defined(QT_NO_TREEVIEW) || defined(QT_NO_COMBOBOX) || defined(QT_NO_TOOLBUTTON) || defined(QT_NO_BUTTONGROUP) || defined(QT_NO_TOOLTIP) || defined(QT_NO_SPLITTER) || defined(QT_NO_STACKEDWIDGET)) #define QT_NO_FILEDIALOG #endif // QPrintPreviewDialog -#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG)) +#if !defined(QT_NO_PRINTPREVIEWDIALOG) && (defined(QT_NO_PRINTPREVIEWWIDGET) || defined(QT_NO_PRINTDIALOG) || defined(QT_NO_TOOLBAR)) #define QT_NO_PRINTPREVIEWDIALOG #endif diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 0bee94a..f2b5c20 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -604,7 +604,7 @@ SeeAlso: ??? Feature: FILEDIALOG Description: Supports a dialog widget for selecting files or directories. Section: Dialogs -Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET FILESYSTEMMODEL +Requires: DIRMODEL TREEVIEW COMBOBOX TOOLBUTTON BUTTONGROUP TOOLTIP SPLITTER STACKEDWIDGET Name: QFileDialog SeeAlso: ??? @@ -625,7 +625,7 @@ SeeAlso: ??? Feature: PRINTPREVIEWDIALOG Description: Provides a dialog for previewing and configuring page layouts for printer output. Section: Dialogs -Requires: PRINTPREVIEWWIDGET PRINTDIALOG +Requires: PRINTPREVIEWWIDGET PRINTDIALOG TOOLBAR Name: QPrintPreviewDialog SeeAlso: ??? @@ -677,7 +677,7 @@ SeeAlso: ??? Feature: DIRMODEL Description: Supports a data model for the local filesystem. Section: ItemViews -Requires: ITEMVIEWS +Requires: ITEMVIEWS FILESYSTEMMODEL Name: QDirModel SeeAlso: ??? @@ -1107,6 +1107,13 @@ Requires: PROXYMODEL Name: QCompleter SeeAlso: ??? +Feature: FSCOMPLETER +Description: Provides completions based on an item model. +Section: Utilities +Requires: FILESYSTEMMODEL COMPLETER +Name: QCompleter +SeeAlso: ??? + Feature: DESKTOPSERVICES Description: Provides methods for accessing common desktop services. Section: Utilities @@ -1159,7 +1166,7 @@ SeeAlso: ??? Feature: ANIMATION Description: Provides a framework for animations. Section: Utilities -Requires: PROPERTIES +Requires: PROPERTIES THREAD Name: Animation SeeAlso: ??? diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index c5c1882..9f37239 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -42,7 +42,6 @@ #include "qatomic.h" #include "qmutexpool_p.h" -#ifndef QT_NO_THREAD QT_BEGIN_NAMESPACE @@ -50,6 +49,7 @@ QT_BEGIN_NAMESPACE // use QMutexpool::instance() in new clode. Q_CORE_EXPORT QMutexPool *qt_global_mutexpool = 0; Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive)) +#ifndef QT_NO_THREAD /*! \class QMutexPool @@ -114,15 +114,6 @@ QMutexPool::~QMutexPool() mutexes[index] = 0; } } - -/*! - Returns the global QMutexPool instance. -*/ -QMutexPool *QMutexPool::instance() -{ - return globalMutexPool(); -} - /*! Returns a QMutex from the pool. QMutexPool uses the value \a address to determine which mutex is returned from the pool. @@ -152,7 +143,14 @@ QMutex *QMutexPool::globalInstanceGet(const void *address) return 0; return globalInstance->get(address); } +#endif // QT_NO_THREAD +/*! + Returns the global QMutexPool instance. +*/ +QMutexPool *QMutexPool::instance() +{ + return globalMutexPool(); +} QT_END_NAMESPACE -#endif // QT_NO_THREAD diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 3e1bad0..c26711b 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -57,9 +57,9 @@ #include "QtCore/qmutex.h" #include "QtCore/qvarlengtharray.h" -#ifndef QT_NO_THREAD QT_BEGIN_NAMESPACE +#ifndef QT_NO_THREAD class Q_CORE_EXPORT QMutexPool { @@ -75,11 +75,24 @@ private: QVarLengthArray, 131> mutexes; QMutex::RecursionMode recursionMode; }; +#else //QT_NO_THREAD +Q_GLOBAL_STATIC(QMutex, globalMutex) +class Q_CORE_EXPORT QMutexPool +{ +public: + explicit QMutexPool(QMutex::RecursionMode recursionMode = QMutex::NonRecursive, int size = 131){} + ~QMutexPool(){} + + QMutex *get(const void *address){return globalMutex();} + static QMutexPool *instance(); + static QMutex *globalInstanceGet(const void *address){return globalMutex();} +}; + +#endif // QT_NO_THREAD extern Q_CORE_EXPORT QMutexPool *qt_global_mutexpool; QT_END_NAMESPACE -#endif // QT_NO_THREAD #endif // QMUTEXPOOL_P_H diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index ac191fe..cf57d33 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -727,6 +727,16 @@ QThread *QThread::currentThread() return QThreadData::current()->thread; } +/*! \internal + */ +QThread::QThread(QThreadPrivate &dd, QObject *parent) + : QObject(dd, parent) +{ + Q_D(QThread); + // fprintf(stderr, "QThreadData %p taken from private data for thread %p\n", d->data, this); + d->data->thread = this; +} + QThreadData* QThreadData::current() { static QThreadData *data = 0; // reinterpret_cast(pthread_getspecific(current_thread_data_key)); @@ -738,17 +748,13 @@ QThreadData* QThreadData::current() } return data; } - -/*! \internal - */ -QThread::QThread(QThreadPrivate &dd, QObject *parent) - : QObject(dd, parent) +#endif // QT_NO_THREAD +QThreadData* QThreadData::get2(QThread *thread) { - Q_D(QThread); - // fprintf(stderr, "QThreadData %p taken from private data for thread %p\n", d->data, this); - d->data->thread = this; + Q_ASSERT_X(thread != 0, "QThread", "internal error"); + return thread->d_func()->data; } -#endif // QT_NO_THREAD + QT_END_NAMESPACE diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index af68434..8c3acdb 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -111,6 +111,36 @@ public: { } }; +class QThreadData +{ + QAtomicInt _ref; + +public: + QThreadData(int initialRefCount = 1); + ~QThreadData(); + + static QThreadData *current(); + static QThreadData *get2(QThread *thread); + + void ref(); + void deref(); + + QThread *thread; + bool quitNow; + int loopLevel; + QAbstractEventDispatcher *eventDispatcher; + QStack eventLoops; + QPostEventList postEventList; + bool canWait; + QMap tls; + + QMutex mutex; + +# ifdef Q_OS_SYMBIAN + RThread symbian_thread_handle; +# endif +}; + #ifndef QT_NO_THREAD class QThreadPrivate : public QObjectPrivate { @@ -179,38 +209,6 @@ public: #endif // QT_NO_THREAD -class QThreadData -{ - QAtomicInt _ref; - -public: - QThreadData(int initialRefCount = 1); - ~QThreadData(); - - static QThreadData *current(); - static QThreadData *get2(QThread *thread) - { Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; } - - - void ref(); - void deref(); - - QThread *thread; - bool quitNow; - int loopLevel; - QAbstractEventDispatcher *eventDispatcher; - QStack eventLoops; - QPostEventList postEventList; - bool canWait; - QMap tls; - - QMutex mutex; - -# ifdef Q_OS_SYMBIAN - RThread symbian_thread_handle; -# endif -}; - // thread wrapper for the main() thread class QAdoptedThread : public QThread { diff --git a/src/gui/dialogs/qfscompleter_p.h b/src/gui/dialogs/qfscompleter_p.h index cb1b427..1edab2d 100644 --- a/src/gui/dialogs/qfscompleter_p.h +++ b/src/gui/dialogs/qfscompleter_p.h @@ -56,7 +56,7 @@ #include "qcompleter.h" #include QT_BEGIN_NAMESPACE -#ifndef QT_NO_COMPLETER +#ifndef QT_NO_FSCOMPLETER /*! QCompleter that can deal with QFileSystemModel @@ -76,7 +76,7 @@ public: QAbstractProxyModel *proxyModel; QFileSystemModel *sourceModel; }; -#endif // QT_NO_COMPLETER +#endif // QT_NO_FSCOMPLETER QT_END_NAMESPACE #endif // QFSCOMPLETOR_P_H -- cgit v0.12