diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 2 | ||||
-rw-r--r-- | src/corelib/codecs/qtextcodec_p.h | 2 | ||||
-rw-r--r-- | src/corelib/corelib.pro | 6 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 24 | ||||
-rw-r--r-- | src/corelib/global/qsystemdetection.h | 4 | ||||
-rw-r--r-- | src/corelib/io/io.pri | 2 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qtemporarydir.cpp | 14 | ||||
-rw-r--r-- | src/corelib/kernel/kernel.pri | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 2 |
12 files changed, 52 insertions, 18 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 511817677c..1a5c9f6766 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -89,7 +89,7 @@ #include <stdlib.h> #include <ctype.h> #include <locale.h> -#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF) && !defined(Q_OS_LINUX_ANDROID) +#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF) && !defined(Q_OS_ANDROID) # include <langinfo.h> #endif diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h index 18629f4bf3..0fec1e80c7 100644 --- a/src/corelib/codecs/qtextcodec_p.h +++ b/src/corelib/codecs/qtextcodec_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TEXTCODEC -#if defined(Q_OS_MAC) || defined(Q_OS_IOS) || defined(Q_OS_LINUX_ANDROID) || defined(Q_OS_QNX) +#if defined(Q_OS_MAC) || defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) #define QT_LOCALE_IS_UTF8 #endif diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index cbfb457212..b1f1a60b6c 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -16,6 +16,12 @@ win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x QMAKE_DOCS = $$PWD/doc/qtcore.qdocconf +ANDROID_JAR_DEPENDENCIES = \ + jar/QtAndroid.jar +ANDROID_LIB_DEPENDENCIES = \ + plugins/platforms/android/libqtforandroid.so \ + libs/libgnustl_shared.so + load(qt_module) include(animation/animation.pri) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 7204efc752..6a127e1786 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -57,6 +57,10 @@ #include <slog2.h> #endif +#ifdef Q_OS_ANDROID +#include <android/log.h> +#endif + #include <stdio.h> QT_BEGIN_NAMESPACE @@ -835,6 +839,24 @@ Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler); static QtMsgHandler msgHandler = 0; // pointer to debug handler (without context) static QtMessageHandler messageHandler = 0; // pointer to debug handler (with context) +#ifdef Q_OS_ANDROID +static void android_default_message_handler(QtMsgType type, + const QMessageLogContext &context, + const QString &message) +{ + android_LogPriority priority; + switch (type) { + case QtDebugMsg: priority = ANDROID_LOG_DEBUG; break; + case QtWarningMsg: priority = ANDROID_LOG_WARN; break; + case QtCriticalMsg: priority = ANDROID_LOG_ERROR; break; + case QtFatalMsg: priority = ANDROID_LOG_FATAL; break; + }; + + __android_log_print(priority, "Qt", "%s:%d (%s): %s", qPrintable(context.file), context.line, + qPrintable(context.function), qPrintable(message)); +} +#endif //Q_OS_ANDROID + /*! \internal */ @@ -855,6 +877,8 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con #if defined(QT_USE_SLOG2) slog2_default_handler(type, logMessage.toLocal8Bit().constData()); +#elif defined(Q_OS_ANDROID) + android_default_message_handler(type, context, logMessage); #else fprintf(stderr, "%s", logMessage.toLocal8Bit().constData()); fflush(stderr); diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 6062dc7b7b..0caac3d797 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -80,6 +80,7 @@ LYNX - LynxOS BSD4 - Any BSD 4.4 system UNIX - Any UNIX BSD/SYSV system + ANDROID - Android platform */ #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) @@ -90,6 +91,9 @@ # else # define Q_OS_DARWIN32 # endif +#elif defined(ANDROID) +# define Q_OS_ANDROID +# define Q_OS_LINUX #elif defined(__CYGWIN__) # define Q_OS_CYGWIN #elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index d4ed8e5362..a52386def1 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -133,7 +133,7 @@ win32 { SOURCES += io/qstandardpaths_unix.cpp } - linux-*|if(qnx:contains(QT_CONFIG, inotify)) { + linux|if(qnx:contains(QT_CONFIG, inotify)) { SOURCES += io/qfilesystemwatcher_inotify.cpp HEADERS += io/qfilesystemwatcher_inotify_p.h } diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 9970530827..4bfb03a41e 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -169,7 +169,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, if (entry.isEmpty() || entry.isRoot()) return entry; -#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX) && _POSIX_VERSION < 200809L +#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) && _POSIX_VERSION < 200809L // realpath(X,0) is not supported Q_UNUSED(data); return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath())); diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 6782fcb986..755c31f371 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -52,7 +52,7 @@ #endif #include <stdlib.h> // mkdtemp -#if defined(Q_OS_QNX) || defined(Q_OS_WIN) +#if defined(Q_OS_QNX) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID) #include <private/qfilesystemengine_p.h> #endif @@ -94,9 +94,9 @@ static QString defaultTemplateName() return QDir::tempPath() + QLatin1Char('/') + baseName + QLatin1String("-XXXXXX"); } -#if defined(Q_OS_QNX ) || defined(Q_OS_WIN) -static char *mkdtemp(char *templateName) +static char *q_mkdtemp(char *templateName) { +#if defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID) static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; const size_t length = strlen(templateName); @@ -137,17 +137,17 @@ static char *mkdtemp(char *templateName) } } return 0; -} -#elif defined(Q_OS_LINUX_ANDROID) -extern char *mkdtemp(char *); +#else + return mkdtemp(templateName); #endif +} void QTemporaryDirPrivate::create(const QString &templateName) { QByteArray buffer = QFile::encodeName(templateName); if (!buffer.endsWith("XXXXXX")) buffer += "XXXXXX"; - if (mkdtemp(buffer.data())) { // modifies buffer + if (q_mkdtemp(buffer.data())) { // modifies buffer success = true; path = QFile::decodeName(buffer.constData()); } diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index d2de873cef..d5a6fa6122 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -129,7 +129,7 @@ unix|integrity { contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri) - !linux-android-* { + !android { SOURCES += kernel/qsharedmemory_unix.cpp \ kernel/qsystemsemaphore_unix.cpp } else { diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index dd9856adf5..9f1e6c8aa1 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -69,7 +69,7 @@ namespace QSharedMemoryPrivate #include "qsystemsemaphore.h" #include "private/qobject_p.h" -#if !defined(Q_OS_WIN) && !defined(Q_OS_LINUX_ANDROID) +#if !defined(Q_OS_WIN) && !defined(Q_OS_ANDROID) # include <sys/sem.h> #endif diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index f7397dd8d4..8104cc8938 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -287,7 +287,7 @@ static void setCurrentThreadName(pthread_t threadId, const char *name) void *QThreadPrivate::start(void *arg) { -#if !defined(Q_OS_LINUX_ANDROID) +#if !defined(Q_OS_ANDROID) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); #endif pthread_cleanup_push(QThreadPrivate::finish, arg); @@ -326,7 +326,7 @@ void *QThreadPrivate::start(void *arg) #endif emit thr->started(QThread::QPrivateSignal()); -#if !defined(Q_OS_LINUX_ANDROID) +#if !defined(Q_OS_ANDROID) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_testcancel(); #endif @@ -631,7 +631,7 @@ void QThread::start(Priority priority) void QThread::terminate() { -#if !defined(Q_OS_LINUX_ANDROID) +#if !defined(Q_OS_ANDROID) Q_D(QThread); QMutexLocker locker(&d->mutex); @@ -673,7 +673,7 @@ void QThread::setTerminationEnabled(bool enabled) "Current thread was not started with QThread."); Q_UNUSED(thr) -#if defined(Q_OS_LINUX_ANDROID) +#if defined(Q_OS_ANDROID) Q_UNUSED(enabled); #else pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL); diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index d152e6795e..ac49bdcdf6 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -49,7 +49,7 @@ #include <string> -#if defined(Q_OS_LINUX_ANDROID) +#if defined(Q_OS_ANDROID) // std::wstring is disabled on android's glibc, as bionic lacks certain features // that libstdc++ checks for (like mbcslen). namespace std |