diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/Qt5CoreConfigExtras.cmake.in | 4 | ||||
-rw-r--r-- | src/corelib/global/qconfig-nacl.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qfeatures.h | 5 | ||||
-rw-r--r-- | src/corelib/global/qfeatures.txt | 20 | ||||
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 15 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 65 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.h | 1 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_blackberry.cpp | 37 | ||||
-rw-r--r-- | src/corelib/thread/qmutex.cpp | 12 | ||||
-rw-r--r-- | src/corelib/thread/qthread.cpp | 14 |
11 files changed, 124 insertions, 55 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index e5f7e14d82..0df27039d0 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -44,9 +44,9 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc) set(Qt5Core_RCC_EXECUTABLE Qt5::rcc) !!IF isEmpty(CMAKE_DATA_DIR_IS_ABSOLUTE) -list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/default\") +list(APPEND Qt5Core_INCLUDE_DIRS \"${_qt5_corelib_install_prefix}/mkspecs/$${CMAKE_MKSPEC}\") !!ELSE -list(APPEND Qt5Core_INCLUDE_DIRS \"$${CMAKE_DATA_DIR}mkspecs/default\") +list(APPEND Qt5Core_INCLUDE_DIRS \"$${CMAKE_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\") !!ENDIF !!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS) diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h index d62b12fba5..d5172aac29 100644 --- a/src/corelib/global/qconfig-nacl.h +++ b/src/corelib/global/qconfig-nacl.h @@ -39,6 +39,10 @@ ** ****************************************************************************/ +#if 0 +#pragma qt_sync_stop_processing +#endif + #define QT_FONTS_ARE_RESOURCES /* Data structures */ diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 160063fa67..90ef47cf5b 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -306,6 +306,11 @@ #define QT_NO_NETWORKDISKCACHE #endif +// QLocalServer +#if !defined(QT_NO_LOCALSERVER) && (defined(QT_NO_TEMPORARYFILE)) +#define QT_NO_LOCALSERVER +#endif + // QProgressDialog #if !defined(QT_NO_PROGRESSDIALOG) && (defined(QT_NO_PROGRESSBAR)) #define QT_NO_PROGRESSDIALOG diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 1a721e78b0..3b3af8a3fc 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -727,20 +727,6 @@ Requires: Name: QWindowsStyle SeeAlso: ??? -Feature: STYLE_MOTIF -Description: Supports a Motif look and feel. -Section: Styles -Requires: -Name: QMotifStyle -SeeAlso: ??? - -Feature: STYLE_CDE -Description: Supports a CDE look and feel. -Section: Styles -Requires: STYLE_MOTIF -Name: QCDEStyle -SeeAlso: ??? - Feature: STYLE_PLASTIQUE Description: Supports a widget style similar to the Plastik style available in KDE. Section: Styles @@ -1025,6 +1011,12 @@ Requires: LIBRARY NETWORKINTERFACE PROPERTIES Name: Bearer Management SeeAlso: ??? +Feature: LOCALSERVER +Description: Supports a local socket based server +Section: Networking +Requires: TEMPORARYFILE +Name: QLocalServer +SeeAlso: ??? # Utilities diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 1ef7af586f..0a928e4603 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -177,7 +177,7 @@ static QProcessManager *processManager() QMutexLocker locker(&processManagerGlobalMutex); if (!processManagerInstance) - QProcessPrivate::initializeProcessManager(); + new QProcessManager; Q_ASSERT(processManagerInstance); return processManagerInstance; @@ -185,9 +185,6 @@ static QProcessManager *processManager() QProcessManager::QProcessManager() { - // can only be called from main thread - Q_ASSERT(!qApp || qApp->thread() == QThread::currentThread()); - #if defined (QPROCESS_DEBUG) qDebug() << "QProcessManager::QProcessManager()"; #endif @@ -1434,15 +1431,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a void QProcessPrivate::initializeProcessManager() { - if (qApp && qApp->thread() != QThread::currentThread()) { - // The process manager must be initialized in the main thread - // Note: The call below will re-enter this function, but in the right thread, - // so the else statement below will be executed. - QMetaObject::invokeMethod(qApp, "_q_initializeProcessManager", Qt::BlockingQueuedConnection); - } else { - static QProcessManager processManager; - Q_UNUSED(processManager); - } + (void) processManager(); } QT_END_NAMESPACE diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index fd423d4479..df0ffce12d 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -264,6 +264,35 @@ struct QCoreApplicationData { data->deref(); // deletes the data and the adopted thread } } + +#ifdef Q_OS_BLACKBERRY + //The QCoreApplicationData struct is only populated on demand, because it is rarely needed and would + //affect startup time + void loadManifest() { + static bool manifestLoadAttempt = false; + if (manifestLoadAttempt) + return; + + manifestLoadAttempt = true; + + QFile metafile(QStringLiteral("app/META-INF/MANIFEST.MF")); + if (!metafile.open(QIODevice::ReadOnly)) { + qWarning() << Q_FUNC_INFO << "Could not open application metafile for reading"; + } else { + while (!metafile.atEnd() && (application.isEmpty() || applicationVersion.isEmpty() || orgName.isEmpty())) { + QByteArray line = metafile.readLine(); + if (line.startsWith("Application-Name:")) + application = QString::fromUtf8(line.mid(18).trimmed()); + else if (line.startsWith("Application-Version:")) + applicationVersion = QString::fromUtf8(line.mid(21).trimmed()); + else if (line.startsWith("Package-Author:")) + orgName = QString::fromUtf8(line.mid(16).trimmed()); + } + metafile.close(); + } + } +#endif + QString orgName, orgDomain, application; QString applicationVersion; @@ -363,16 +392,6 @@ void QCoreApplicationPrivate::createEventDispatcher() #endif } -void QCoreApplicationPrivate::_q_initializeProcessManager() -{ -#ifndef QT_NO_PROCESS -# ifdef Q_OS_UNIX - QProcessPrivate::initializeProcessManager(); -# endif -#endif -} - - QThread *QCoreApplicationPrivate::theMainThread = 0; QThread *QCoreApplicationPrivate::mainThread() { @@ -596,6 +615,12 @@ void QCoreApplication::init() d->appendApplicationPathToLibraryPaths(); #endif +#if defined(Q_OS_UNIX) && !(defined(QT_NO_PROCESS)) + // Make sure the process manager thread object is created in the main + // thread. + QProcessPrivate::initializeProcessManager(); +#endif + #ifdef QT_EVAL extern void qt_core_eval_init(uint); qt_core_eval_init(d->application_type); @@ -1765,6 +1790,15 @@ QString QCoreApplication::applicationFilePath() #if defined(Q_OS_WIN) d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath(); return d->cachedApplicationFilePath; +#elif defined(Q_OS_BLACKBERRY) + QDir dir(QStringLiteral("./app/native/")); + QStringList executables = dir.entryList(QDir::Executable | QDir::Files); + if (!executables.empty()) { + //We assume that there is only one executable in the folder + return dir.absoluteFilePath(executables.first()); + } else { + return QString(); + } #elif defined(Q_OS_MAC) QString qAppFileName_str = qAppFileName(); if(!qAppFileName_str.isEmpty()) { @@ -1930,6 +1964,9 @@ void QCoreApplication::setOrganizationName(const QString &orgName) QString QCoreApplication::organizationName() { +#ifdef Q_OS_BLACKBERRY + coreappdata()->loadManifest(); +#endif return coreappdata()->orgName; } @@ -1977,6 +2014,9 @@ void QCoreApplication::setApplicationName(const QString &application) QString QCoreApplication::applicationName() { +#ifdef Q_OS_BLACKBERRY + coreappdata()->loadManifest(); +#endif QString appname = coreappdata() ? coreappdata()->application : QString(); if (appname.isEmpty() && QCoreApplication::self) appname = QCoreApplication::self->d_func()->appName(); @@ -2003,6 +2043,9 @@ void QCoreApplication::setApplicationVersion(const QString &version) QString QCoreApplication::applicationVersion() { +#ifdef Q_OS_BLACKBERRY + coreappdata()->loadManifest(); +#endif return coreappdata()->applicationVersion; } @@ -2317,5 +2360,3 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc */ QT_END_NAMESPACE - -#include "moc_qcoreapplication.cpp" diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 388877cbec..622139e6f8 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -178,7 +178,6 @@ protected: QCoreApplication(QCoreApplicationPrivate &p); private: - Q_PRIVATE_SLOT(d_func(), void _q_initializeProcessManager()) static bool sendSpontaneousEvent(QObject *receiver, QEvent *event); bool notifyInternal(QObject *receiver, QEvent *event); diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 393ae1c55a..321f6905a4 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -76,8 +76,6 @@ public: bool sendThroughObjectEventFilters(QObject *, QEvent *); bool notify_helper(QObject *, QEvent *); - void _q_initializeProcessManager(); - QString appName() const; virtual void createEventDispatcher(); static void removePostedEvent(QEvent *); diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp index a553999121..33ca1023dd 100644 --- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp +++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp @@ -295,14 +295,35 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef if (timeout) timeout_bps = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000); + bool hasProcessedEventsOnce = false; + bps_event_t *event = 0; + // This loop exists such that we can drain the bps event queue of all native events // more efficiently than if we were to return control to Qt after each event. This // is important for handling touch events which can come in rapidly. forever { + Q_ASSERT(!hasProcessedEventsOnce || event); + + // Only emit the awake() and aboutToBlock() signals in the second iteration. For the first + // iteration, the UNIX event dispatcher will have taken care of that already. + if (hasProcessedEventsOnce) + emit awake(); + + // Filtering the native event should happen between the awake() and aboutToBlock() signal + // emissions. The calls awake() - filterNativeEvent() - aboutToBlock() - bps_get_event() + // need not to be interrupted by a break or return statement. + // + // Because of this, the native event is actually processed one loop iteration + // after it was retrieved with bps_get_event(). + if (event) + filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0); + + if (hasProcessedEventsOnce) + emit aboutToBlock(); + // Wait for event or file to be ready - bps_event_t *event = NULL; + event = 0; const int result = bps_get_event(&event, timeout_bps); - if (result != BPS_SUCCESS) qWarning("QEventDispatcherBlackberry::select: bps_get_event() failed"); @@ -314,14 +335,16 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef if (!event || bps_event_get_domain(event) == bpsIOReadyDomain) break; - // Any other events must be bps native events so we pass all such received - // events through the native event filter chain - filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0); - // Update the timeout. If this fails we have exceeded our alloted time or the system // clock has changed time and we cannot calculate a new timeout so we bail out. - if (!updateTimeout(&timeout_bps, startTime)) + if (!updateTimeout(&timeout_bps, startTime)) { + + // No more loop iteration, so we need to filter the event here. + filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0); break; + } + + hasProcessedEventsOnce = true; } // the number of bits set in the file sets diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index ee1037d4f4..3815ce16a7 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -162,8 +162,9 @@ public: If \a mode is QMutex::Recursive, a thread can lock the same mutex multiple times and the mutex won't be unlocked until a - corresponding number of unlock() calls have been made. The - default is QMutex::NonRecursive. + corresponding number of unlock() calls have been made. Otherwise + a thread may only lock a mutex once. The default is + QMutex::NonRecursive. \sa lock(), unlock() */ @@ -371,6 +372,13 @@ bool QBasicMutex::isRecursive() \sa unlock() */ +/*! + \fn QMutex *QMutexLocker::mutex() + + Returns the mutex on which the QMutexLocker is operating. + +*/ + #ifndef QT_LINUX_FUTEX //linux implementation is in qmutex_linux.cpp /* diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 5949f9aefe..72bae48eba 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -323,7 +323,8 @@ QThreadPrivate::~QThreadPrivate() /*! \fn void QThread::started() - This signal is emitted when the thread starts executing. + This signal is emitted from the associated thread when it starts executing, + before the run() function is called. \sa finished(), terminated() */ @@ -331,7 +332,14 @@ QThreadPrivate::~QThreadPrivate() /*! \fn void QThread::finished() - This signal is emitted when the thread has finished executing. + This signal is emitted from the associated thread right before it finishes executing. + + When this signal is emitted, the event loop has already stopped running. + No more events will be processed in the thread, except for deferred deletion events. + This signal can be connected to QObject::deleteLater(), to free objects in that thread. + + \note If the associated thread was terminated using terminate(), it is undefined from + which thread this signal is emitted. \sa started(), terminated() */ @@ -341,6 +349,8 @@ QThreadPrivate::~QThreadPrivate() This signal is emitted when the thread is terminated. + It is undefined from which thread this signal is emitted. + \sa started(), finished() */ |