diff options
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 4bab0b9f01..4e32f90964 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -95,7 +95,7 @@ #endif #endif // QT_NO_QOBJECT -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) # include <private/qjni_p.h> # include <private/qjnihelpers_p.h> #endif @@ -186,7 +186,7 @@ QString QCoreApplicationPrivate::appVersion() const #ifndef QT_BOOTSTRAPPED # ifdef Q_OS_DARWIN applicationVersion = infoDictionaryStringProperty(QStringLiteral("CFBundleVersion")); -# elif defined(Q_OS_ANDROID) +# elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QJNIObjectPrivate context(QtAndroidPrivate::context()); if (context.isValid()) { QJNIObjectPrivate pm = context.callObjectMethod( @@ -538,29 +538,10 @@ void QCoreApplicationPrivate::cleanupThreadData() void QCoreApplicationPrivate::createEventDispatcher() { Q_Q(QCoreApplication); -#if defined(Q_OS_UNIX) -# if defined(Q_OS_DARWIN) - bool ok = false; - int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok); - if (ok && value > 0) - eventDispatcher = new QEventDispatcherCoreFoundation(q); - else - eventDispatcher = new QEventDispatcherUNIX(q); -# elif !defined(QT_NO_GLIB) - if (qEnvironmentVariableIsEmpty("QT_NO_GLIB") && QEventDispatcherGlib::versionSupported()) - eventDispatcher = new QEventDispatcherGlib(q); - else - eventDispatcher = new QEventDispatcherUNIX(q); -# else - eventDispatcher = new QEventDispatcherUNIX(q); -# endif -#elif defined(Q_OS_WINRT) - eventDispatcher = new QEventDispatcherWinRT(q); -#elif defined(Q_OS_WIN) - eventDispatcher = new QEventDispatcherWin32(q); -#else -# error "QEventDispatcher not yet ported to this platform" -#endif + QThreadData *data = QThreadData::current(); + Q_ASSERT(!data->hasEventDispatcher()); + eventDispatcher = QThreadPrivate::createEventDispatcher(data); + eventDispatcher->setParent(q); } void QCoreApplicationPrivate::eventDispatcherReady() @@ -816,6 +797,14 @@ void QCoreApplicationPrivate::init() if (!coreappdata()->applicationVersionSet) coreappdata()->applicationVersion = appVersion(); +#if defined(Q_OS_ANDROID) + // We've deferred initializing the logging registry due to not being + // able to guarantee that logging happened on the same thread as the + // Qt main thread, but now that the Qt main thread is set up, we can + // enable categorized logging. + QLoggingRegistry::instance()->initializeRules(); +#endif + #if QT_CONFIG(library) // Reset the lib paths, so that they will be recomputed, taking the availability of argv[0] // into account. If necessary, recompute right away and replay the manual changes on top of the @@ -848,8 +837,9 @@ void QCoreApplicationPrivate::init() #ifndef QT_NO_QOBJECT // use the event dispatcher created by the app programmer (if any) - if (!eventDispatcher) - eventDispatcher = threadData->eventDispatcher.load(); + Q_ASSERT(!eventDispatcher); + eventDispatcher = threadData->eventDispatcher.load(); + // otherwise we create one if (!eventDispatcher) createEventDispatcher(); @@ -2266,7 +2256,7 @@ QString QCoreApplication::applicationFilePath() } #endif #if defined( Q_OS_UNIX ) -# if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) +# if defined(Q_OS_LINUX) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)) // Try looking for a /proc/<pid>/exe symlink first which points to // the absolute path of the executable QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid())); |