diff options
75 files changed, 2986 insertions, 118 deletions
@@ -249,3 +249,13 @@ src/network/lib src/xml/lib/ .pc/ + +# INTEGRITY generated files +*.gpj +*.int +*.ael +*.dla +*.dnm +*.dep +*.map +work @@ -728,6 +728,11 @@ if [ -f "$relpath/src/gui/embedded/qscreenqnx_qws.cpp" ]; then CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} qnx" CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} qnx" fi +if [ -f "$relpath/src/gui/embedded/qscreenintegrityfb_qws.cpp" ]; then + CFG_KBD_AVAILABLE="${CFG_KBD_AVAILABLE} integrity" + CFG_MOUSE_AVAILABLE="${CFG_MOUSE_AVAILABLE} integrity" + CFG_GFX_AVAILABLE="${CFG_GFX_AVAILABLE} integrityfb" +fi CFG_ARCH= CFG_HOST_ARCH= diff --git a/doc/src/platforms/platform-notes-rtos.qdoc b/doc/src/platforms/platform-notes-rtos.qdoc index 776f510..be63063 100644 --- a/doc/src/platforms/platform-notes-rtos.qdoc +++ b/doc/src/platforms/platform-notes-rtos.qdoc @@ -245,3 +245,112 @@ some regressions were spotted in QDateTime computation around year 0 and year 1970, which have been tracked back to faulty time zone data on some QNX versions. */ + +/*! + \page platform-notes-integrity.html + \title Platform Notes - INTEGRITY + \contentspage Platform Notes + \target INTEGRITY + + \note INTEGRITY is a community supported platform. See the + \l{Supported Platforms} page for more information. + + This page contains information about the Qt for INTEGRITY port. More + information about the combinations of platforms and compilers supported + by Qt can be found on the \l{Supported Platforms} page. + + Note that Qt for INTEGRITY is currently based on \l{Qt for Embedded Linux}, + which contains its own windowing system. + + Qt for INTEGRITY contains experimental screen and input drivers based on the + gh_FB Framebuffer API for graphics, a Connection-based mouse and keyboard + support. For information about these drivers, please refer to Green Hills + Software standard support. + + \tableofcontents + + \section1 Supported Versions + + Qt has been tested on INTEGRITY 10 on various PowerPC, ARM and x86 targets. + On some platforms a native graphics FrameBuffer driver is available and has + then been used for testing. On all other platforms, the default FrameBuffer + VNC driver is used. + + \section1 Limitations + + Some of Qt's functionality is currently not available on INTEGRITY: + + \table + \header \o Function \o Notes + \row \o QProcess + \o Not implemented. Volunteers welcome. + \row \o QSharedMemory + \o Not available - INTEGRITY doesn't support SYSV style shared memory. + \row \o QSystemSemaphore + \o Not available - INTEGRITY doesn't support SYSV style system semaphores. + \row \o QWS Multi Process + \o QT_NO_QWS_MULTIPROCESS is always on due to missing shared memory support. + \row \o Phonon + \o There is no standard audio backend. + \row \o Qt3Support + \o The Qt3Support library is not available on INTEGRITY. + \row \o QtScript + \o Not available - INTEGRITY's mmap() doesn't support allocating memory. + \endtable + + \section1 Build Instructions + + Qt for INTEGRITY can be built on either a Linux or Windows (with cygwin) host. + In both cases, a standard installation of INTEGRITY is required, with the + addition of the FrameBuffer API. + + Example configure line for cross-compiling Qt for INTEGRITY for an + ARM INTEGRITY target: + + \code + ./configure --hostprefix=$PWD -embedded integrity -xplatform unsupported/qws/integrity-arm-cxarm -static -qt-kbd-integrity -qt-mouse-integrity -no-mouse-linuxtp -no-mouse-pc -no-kbd-tty -qt-gfx-integrityfb -no-qt3support -no-gfx-linuxfb -no-glib -no-openssl -no-largefile -little-endian -arch integrity -prefix / -opensource -no-feature-QWS_MULTIPROCESS -no-feature-SHAREDMEMORY -no-feature-PROCESS -no-feature-SYSTEMSEMAPHORE -no-feature-PRINTER -no-feature-QWS_QPF2 -no-scripttools + \endcode + + \list + \o \c{--hostprefix=$PWD} - specifies the current directory as the base source for Qt + \o \c{-arch integrity} - sets the architecture to INTEGRITY (for atomic operations) + \o \c{-embedded integrity} - builds the embedded version of Qt and sets the architecture to INTEGRITY + \o \c{-xplatform unsupported/qws/integrity-arm-cxarm} - selects the arm-cxarm mkspec for INTEGRITY + \o \c{-static} - specifies a static build of Qt + \o \c{-no-gfx-linuxfb}, \c{-no-mouse-linuxtp}, \c{-no-mouse-pc} and \c{-no-kbd-tty} are Linux specific and won't work on INTEGRITY + \o \c{-no-qt3support} - required since the Qt3 support classes are not supported on INTEGRITY + \o \c{-no-exceptions} - reduces the size of the library by disabling exception support + \o \c{-no-openssl} - disable support for OpenSSL + \o \c{-no-glib} - disable support for unavailable Glib + \o \c{-no-largefile} - disable support for large (> 2TB) files + \o \c{-no-scripttools} - disable support for QtScript tools + \o \c{-qt-gfx-integrity} - enables the experimental gh_FB based display driver + \o \c{-qt-mouse-integrity} - enables the experimental Connection-based mouse driver + \o \c{-qt-kbd-integrity} - enables the experimental Connection-based keyboard driver + \endlist + + The above script will generate MULTI .gpj Project files, not Makefiles. The + main benefit of using these project files is automatic dependency checking, + but this also provides an organization known to INTEGRITY customers. + For Qt libraries, the top-level file is projects.gpj. + + \section1 General Notes + + \list + \o Before you run the above configure line, you may want to modify the values + of INTEGRITY_DIR and INTEGRITY_BSP in unsupported/qws/integrity-arm-cxarm/qmake.conf. + If you do not do this, you will have to modify the resulting generated projects.gpj + + \o GIF support is currently not enabled. + + \o Default .int files are generated. You may want to modify the amount of heap assigned + to each example by modifying the HeapSize declaration in the specific example .int file. + + \o Some of the tools, examples and demos do not compile due to dependencies on QProcess + or other classes that are not available on INTEGRITY. + + \endlist + + \section1 Platform Regressions + +*/ diff --git a/examples/itemviews/chart/chart.pro b/examples/itemviews/chart/chart.pro index 53601f4..12f08b9 100644 --- a/examples/itemviews/chart/chart.pro +++ b/examples/itemviews/chart/chart.pro @@ -4,7 +4,7 @@ RESOURCES = chart.qrc SOURCES = main.cpp \ mainwindow.cpp \ pieview.cpp -unix:!mac:!symbian:!vxworks:LIBS+= -lm +unix:!mac:!symbian:!vxworks:!integrity:LIBS+= -lm TARGET.EPOCHEAPSIZE = 0x200000 0x800000 diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro index 1f42b41..d096fa6 100644 --- a/examples/painting/painterpaths/painterpaths.pro +++ b/examples/painting/painterpaths/painterpaths.pro @@ -3,7 +3,7 @@ HEADERS = renderarea.h \ SOURCES = main.cpp \ renderarea.cpp \ window.cpp -unix:!mac:!symbian:!vxworks:LIBS += -lm +unix:!mac:!symbian:!vxworks:!integrity:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/painting/painterpaths diff --git a/examples/threads/mandelbrot/mandelbrot.pro b/examples/threads/mandelbrot/mandelbrot.pro index ecbec56..2db886b 100644 --- a/examples/threads/mandelbrot/mandelbrot.pro +++ b/examples/threads/mandelbrot/mandelbrot.pro @@ -4,7 +4,7 @@ SOURCES = main.cpp \ mandelbrotwidget.cpp \ renderthread.cpp -unix:!mac:!symbian:!vxworks:LIBS += -lm +unix:!mac:!symbian:!vxworks:!integrity:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot diff --git a/mkspecs/unsupported/integrity-ghs/qmake.conf b/mkspecs/unsupported/integrity-ghs/qmake.conf new file mode 100644 index 0000000..822d6bb --- /dev/null +++ b/mkspecs/unsupported/integrity-ghs/qmake.conf @@ -0,0 +1,72 @@ +# +# qmake configuration for integrity-ghs +# + +MAKEFILE_GENERATOR = GBUILD +#MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release integrity unix +QT += core gui network + +QMAKE_CFLAGS = -bsp $$INTEGRITY_BSP -os_dir $__OS_DIR +QMAKE_CFLAGS += --diag_suppress=1,228,236,381,611,997 +QMAKE_CFLAGS_WARN_ON = +QMAKE_CFLAGS_WARN_OFF = -w +QMAKE_CFLAGS_RELEASE = -g -Ospeed -Olink --signed_fields --no_commons +QMAKE_CFLAGS_DEBUG = -g --no_commons --signed_fields +QMAKE_CFLAGS_SHLIB = +QMAKE_CFLAGS_THREAD = -D_REENTRANT + +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS --no_implicit_include --link_once_templates +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD + +QMAKE_INCDIR = +QMAKE_LIBDIR = +QMAKE_INCDIR_X11 = +QMAKE_LIBDIR_X11 = +QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] +QMAKE_INCDIR_OPENGL = +QMAKE_LIBDIR_OPENGL = +QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include +QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib + +QMAKE_LFLAGS = -lposix -livfs -lnet -lsocket -lfbdev -ldl +QMAKE_LFLAGS_RELEASE = -g -Ospeed -Olink --no_commons -non_shared --link_once_templates +QMAKE_LFLAGS_DEBUG = -g --no_commons +QMAKE_LFLAGS_SHLIB = +QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME = +QMAKE_LFLAGS_THREAD = +QMAKE_LFLAGS_RPATH = + +QMAKE_LIBS = +QMAKE_LIBS_DYNLOAD = -ldl +QMAKE_LIBS_X11 = +QMAKE_LIBS_X11SM = +QMAKE_LIBS_QTOPIA = +QMAKE_LIBS_THREAD = + +QMAKE_MOC = $$[QT_INSTALL_BINS]/moc +QMAKE_UIC = $$[QT_INSTALL_BINS]/uic + +QMAKE_AR = ar cqs +QMAKE_RANLIB = + +QMAKE_TAR = tar -cf +QMAKE_GZIP = gzip -9f + +QMAKE_COPY = cp -f +QMAKE_MOVE = mv -f +QMAKE_DEL_FILE = rm -f +QMAKE_DEL_DIR = rmdir +QMAKE_CHK_DIR_EXISTS = test -d +QMAKE_MKDIR = mkdir -p +load(qt_config) + diff --git a/mkspecs/unsupported/integrity-ghs/qplatformdefs.h b/mkspecs/unsupported/integrity-ghs/qplatformdefs.h new file mode 100644 index 0000000..adfb374 --- /dev/null +++ b/mkspecs/unsupported/integrity-ghs/qplatformdefs.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include <unistd.h> + +// We are hot - unistd.h should have turned on the specific APIs we requested + +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#include <dlfcn.h> +#include <limits.h> + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/time.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_STATBUF struct stat64 +#define QT_STATBUF4TSTAT struct stat64 +#define QT_STAT ::stat64 +#define QT_FSTAT ::fstat64 +#define QT_LSTAT ::lstat64 +#define QT_OPEN ::open64 +#define QT_TRUNCATE ::truncate64 +#define QT_FTRUNCATE ::ftruncate64 +#define QT_LSEEK ::lseek64 +#else +#define QT_STATBUF struct stat +#define QT_STATBUF4TSTAT struct stat +#define QT_STAT ::stat +#define QT_FSTAT ::fstat +#define QT_LSTAT ::lstat +#define QT_OPEN ::open +#define QT_TRUNCATE ::truncate +#define QT_FTRUNCATE ::ftruncate +#define QT_LSEEK ::lseek +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_FOPEN ::fopen64 +#define QT_FSEEK ::fseeko64 +#define QT_FTELL ::ftello64 +#define QT_FGETPOS ::fgetpos64 +#define QT_FSETPOS ::fsetpos64 +#define QT_FPOS_T fpos64_t +#define QT_OFF_T off64_t +#else +#define QT_FOPEN ::fopen +#define QT_FSEEK ::fseek +#define QT_FTELL ::ftell +#define QT_FGETPOS ::fgetpos +#define QT_FSETPOS ::fsetpos +#define QT_FPOS_T fpos_t +#define QT_OFF_T long +#endif + +#define QT_STAT_REG S_IFREG +#define QT_STAT_DIR S_IFDIR +#define QT_STAT_MASK S_IFMT +#define QT_STAT_LNK S_IFLNK +#define QT_SOCKET_CONNECT ::connect +#define QT_SOCKET_BIND ::bind +#define QT_FILENO fileno +#ifndef QT_CLOSE +#define QT_CLOSE ::close +#endif +#ifndef QT_READ +#define QT_READ ::read +#endif +#ifndef QT_WRITE +#define QT_WRITE ::write +#endif +#define QT_ACCESS ::access +#define QT_GETCWD ::getcwd +#define QT_CHDIR ::chdir +#define QT_MKDIR ::mkdir +#define QT_RMDIR ::rmdir +#define QT_OPEN_RDONLY O_RDONLY +#define QT_OPEN_WRONLY O_WRONLY +#define QT_OPEN_RDWR O_RDWR +#define QT_OPEN_CREAT O_CREAT +#define QT_OPEN_TRUNC O_TRUNC +#define QT_OPEN_APPEND O_APPEND + +#define QT_SIGNAL_RETTYPE void +#define QT_SIGNAL_ARGS int +#define QT_SIGNAL_IGNORE SIG_IGN + +#define QT_MMAP ::mmap + +// Directory iteration +#define QT_DIR DIR + +#define QT_OPENDIR ::opendir +#define QT_CLOSEDIR ::closedir + + +#if defined(QT_LARGEFILE_SUPPORT) \ + && defined(QT_USE_XOPEN_LFS_EXTENSIONS) \ + && !defined(QT_NO_READDIR64) +# define QT_DIRENT struct dirent64 +# define QT_READDIR ::readdir64 +# define QT_READDIR_R ::readdir64_r +#else +# define QT_DIRENT struct dirent +# define QT_READDIR ::readdir +# define QT_READDIR_R ::readdir_r +#endif + +#define QT_SOCKLEN_T socklen_t + +#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf +#endif + +#ifndef MAXNAMLEN +# define MAXNAMLEN NAME_MAX +#endif + +#ifndef PATH_MAX +# define PATH_MAX MAXPATHLEN +#endif + +#ifndef NSIG +# define NSIG _SIGMAX +#endif + +#ifndef MAP_ANON +# define MAP_ANON 0 +#endif + +typedef void (*sighandler_t)(int); + +#ifndef QT_NO_MMAP +# define QT_NO_MMAP +#endif + +#ifndef QT_NO_SHAREDMEMORY +# define QT_NO_SHAREDMEMORY +#endif + +#ifndef QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SYSTEMSEMAPHORE +#endif + diff --git a/mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf b/mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf new file mode 100644 index 0000000..acaf3c2 --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-arm-cxarm/qmake.conf @@ -0,0 +1,12 @@ +# +# qmake configuration for integrity-ghs +# + +INTEGRITY_DIR = /enter/your/path/to/INTEGRITY +INTEGRITY_BSP = enter_your_bsp_name_here +QMAKE_CC = ccintarm +QMAKE_CXX = cxintarm +QMAKE_LINK = cxintarm +QMAKE_LINK_SHLIB = cxintarm +include(../../integrity-ghs/qmake.conf) + diff --git a/mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h b/mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h new file mode 100644 index 0000000..e19f8dd --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-arm-cxarm/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec 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$ +** +****************************************************************************/ + +#include "../../integrity-ghs/qplatformdefs.h" diff --git a/mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf new file mode 100644 index 0000000..829e6d3 --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qmake.conf @@ -0,0 +1,12 @@ +# +# qmake configuration for integrity-ghs +# + +INTEGRITY_DIR = /enter/your/path/to/INTEGRITY +INTEGRITY_BSP = enter_your_bsp_name_here +QMAKE_CC = ccintppc +QMAKE_CXX = cxintppc +QMAKE_LINK = cxintppc +QMAKE_LINK_SHLIB = cxintppc +include(../../integrity-ghs/qmake.conf) + diff --git a/mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h new file mode 100644 index 0000000..e19f8dd --- /dev/null +++ b/mkspecs/unsupported/qws/integrity-ppc-cxppc/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec 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$ +** +****************************************************************************/ + +#include "../../integrity-ghs/qplatformdefs.h" diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index a24076e..fd502e0 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -11,7 +11,7 @@ OBJS=project.o property.o main.o makefile.o unixmake2.o unixmake.o \ meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o \ symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o \ - symbiancommon.o registry.o epocroot.o + symbiancommon.o registry.o epocroot.o gbuild.o #qt code QOBJS=qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ @@ -38,6 +38,7 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp \ generators/symbian/symmake_abld.cpp generators/symbian/symmake_sbsv2.cpp \ generaters/symbian/symbiancommon.cpp \ + generators/integrity/gbuild.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstring.cpp $(SOURCE_PATH)/src/corelib/io/qfile.cpp \ $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \ @@ -68,7 +69,8 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp generators/makefile.cpp ge $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp \ $(QTSRCS) -CPPFLAGS = -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian \ +CPPFLAGS = -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 \ + -Igenerators/mac -Igenerators/symbian -Igenerators/integrity \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global -I$(BUILD_PATH)/src/corelib/xml \ -I$(SOURCE_PATH)/tools/shared \ @@ -318,6 +320,9 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp +gbuild.o: generators/integrity/gbuild.cpp + $(CXX) -c -o $@ $(CXXFLAGS) generators/integrity/gbuild.cpp + projectgenerator.o: generators/projectgenerator.cpp $(CXX) -c -o $@ $(CXXFLAGS) generators/projectgenerator.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 4d29537..0ab2932 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -31,7 +31,7 @@ CFLAGS_EXTRA = /MP CFLAGS_BARE = -c -Fo./ \ -W3 -nologo -O2 \ $(CFLAGS_EXTRA) \ - -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian \ + -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian -Igenerators\integrity \ -I$(BUILD_PATH)\include -I$(BUILD_PATH)\include\QtCore \ -I$(SOURCE_PATH)\include -I$(SOURCE_PATH)\include\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ @@ -62,7 +62,8 @@ OBJS = project.obj main.obj makefile.obj unixmake.obj unixmake2.obj mingw makefiledeps.obj metamakefile.obj xmloutput.obj pbuilder_pbx.obj \ borland_bmake.obj msvc_nmake.obj msvc_vcproj.obj msvc_vcxproj.obj \ msvc_objectmodel.obj msbuild_objectmodel.obj symmake.obj initprojectdeploy_symbian.obj \ - symmake_abld.obj symmake_sbsv2.obj symbiancommon.obj registry.obj epocroot.obj + symmake_abld.obj symmake_sbsv2.obj symbiancommon.obj registry.obj epocroot.obj \ + gbuild.obj !IFDEF QMAKE_OPENSOURCE_EDITION CFLAGS = $(CFLAGS) -DQMAKE_OPENSOURCE_EDITION @@ -169,6 +170,9 @@ qmake_pch.obj: {$(SOURCE_PATH)\qmake\generators\symbian}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< +{$(SOURCE_PATH)\qmake\generators\integrity}.cpp{}.obj:: + $(CXX) $(CXXFLAGS) $< + {$(SOURCE_PATH)\qmake\generators\unix}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++ index 59ac8c2..0707a3a 100644 --- a/qmake/Makefile.win32-g++ +++ b/qmake/Makefile.win32-g++ @@ -15,7 +15,7 @@ CXX = g++ CFLAGS = -c -o$@ -O \ -I. -Igenerators -Igenerators/unix \ -Igenerators/win32 -Igenerators/mac \ - -Igenerators/symbian \ + -Igenerators/symbian -Igenerators/integrity \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ @@ -39,7 +39,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_vcproj.o msvc_vcxproj.o \ msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o \ - symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o + symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o ifdef QMAKE_OPENSOURCE_EDITION CFLAGS += -DQMAKE_OPENSOURCE_EDITION @@ -311,6 +311,9 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp +gbuild.o: $(SOURCE_PATH)/qmake/generators/integrity/gbuild.cpp + $(CXX) $(CXXFLAGS) generators/integrity/gbuild.cpp + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh index a84b3f6..c3537e3 100644 --- a/qmake/Makefile.win32-g++-sh +++ b/qmake/Makefile.win32-g++-sh @@ -15,7 +15,7 @@ CXX = g++ CFLAGS = -c -o$@ -O \ -I. -Igenerators -Igenerators/unix \ -Igenerators/win32 -Igenerators/mac \ - -Igenerators/symbian \ + -Igenerators/symbian -Igenerators/integrity \ -I$(BUILD_PATH)/include -I$(BUILD_PATH)/include/QtCore \ -I$(SOURCE_PATH)/include -I$(SOURCE_PATH)/include/QtCore \ -I$(BUILD_PATH)/src/corelib/global \ @@ -39,7 +39,7 @@ OBJS = project.o main.o makefile.o unixmake.o unixmake2.o mingw_make.o \ makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o \ borland_bmake.o msvc_nmake.o msvc_vcproj.o msvc_vcxproj.o \ msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o \ - symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o + symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o ifdef QMAKE_OPENSOURCE_EDITION CFLAGS += -DQMAKE_OPENSOURCE_EDITION @@ -310,6 +310,10 @@ registry.o: $(SOURCE_PATH)/tools/shared/windows/registry.cpp epocroot.o: $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp $(CXX) $(CXXFLAGS) $(SOURCE_PATH)/tools/shared/symbian/epocroot.cpp +gbuild.o: $(SOURCE_PATH)/qmake/generators/integrity/gbuild.cpp + $(CXX) $(CXXFLAGS) generators/integrity/gbuild.cpp + + project.o: $(SOURCE_PATH)/qmake/project.cpp $(SOURCE_PATH)/qmake/project.h $(SOURCE_PATH)/qmake/option.h $(CXX) $(CXXFLAGS) project.cpp diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp new file mode 100644 index 0000000..17bd8f0 --- /dev/null +++ b/qmake/generators/integrity/gbuild.cpp @@ -0,0 +1,442 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#include "gbuild.h" +#include "option.h" +#include "meta.h" +#include <qdir.h> +#include <qregexp.h> +#include <qcryptographichash.h> +#include <qdebug.h> +#include <stdlib.h> +#include <time.h> +#ifdef Q_OS_UNIX +# include <sys/types.h> +# include <sys/stat.h> +#endif + +QT_BEGIN_NAMESPACE + +unsigned int dllbase = 0x01000000; +#define DLLOFFSET 0x600000 + +GBuildMakefileGenerator::GBuildMakefileGenerator() : MakefileGenerator() +{ + nativebins << "moc" << "rcc" << "uic" << "bootstrap"; +} + +bool +GBuildMakefileGenerator::write() +{ + QStringList tmp; + QString filename(Option::output.fileName()); + QString pathtoremove(qmake_getpwd()); + QString relpath(pathtoremove); + QString strtarget(project->first("TARGET")); + bool isnativebin = nativebins.contains(strtarget); + relpath.replace(Option::output_dir, ""); + + /* correct output for non-prl, non-recursive case */ + QString outname(qmake_getpwd()); + outname += QDir::separator(); + outname += fileInfo(Option::output.fileName()).baseName(); + outname += projectSuffix(); + Option::output.close(); + Option::output.setFileName(outname); + MakefileGenerator::openOutput(Option::output, QString()); + + if (strtarget != fileInfo(project->projectFile()).baseName()) { + QString gpjname(strtarget); + QString outputName(qmake_getpwd()); + outputName += QDir::separator(); + outputName += fileInfo(project->projectFile()).baseName(); + outputName += projectSuffix(); + QFile f(outputName); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream t(&f); + t << "#!gbuild\n"; + t << "[Project]\n"; + t << gpjname << projectSuffix() << "\n"; + if ((project->first("TEMPLATE") == "lib") + && project->isActiveConfig("shared")) + t << gpjname << "_shared" << projectSuffix() << "\n"; + t.flush(); + gpjname += projectSuffix(); + Option::output.close(); + Option::output.setFileName(gpjname); + MakefileGenerator::openOutput(Option::output, QString()); + } + + if ((project->first("TEMPLATE") == "app") + && (!isnativebin)) { + QTextStream t(&Option::output); + QString intname(strtarget); + intname += ".int"; + /* this is for bulding an INTEGRITY application. + * generate the .int integrate file and the .gpj INTEGRITY Application + * project file, then go on with regular files */ + t << "#!gbuild" << "\n"; + t << "[INTEGRITY Application]" << "\n"; + t << "\t:binDirRelative=.\n"; + t << "\t-o " << strtarget << "\n"; + t << intname << "\n"; + t << strtarget << "_app" << projectSuffix() << "\n"; + t.flush(); + + /* generate integrate file */ + QFile f(intname); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream ti(&f); + ti << "# This is a file automatically generated by qmake" << "\n"; + ti << "# Modifications will be lost next time you run qmake" << "\n"; + ti << "Kernel" << "\n"; + ti << "\tFilename\tDynamicDownload" << "\n"; + ti << "EndKernel" << "\n" << "\n"; + ti << "AddressSpace" << "\n"; + ti << "\tName\t" << strtarget << "\n"; + ti << "\tFilename\t" << strtarget << "_app" << "\n"; + ti << "\tMemoryPoolSize\t0x100000" << "\n"; + ti << "\tLanguage\tC++" << "\n"; + /* FIXME : heap size is huge to be big enough for every example + * it should probably be tailored for each example, btu there is no + * good way to guess that */ + ti << "\tHeapSize\t0x00D00000" << "\n"; + ti << "\tTask\tInitial" << "\n"; + ti << "\t\tStackSize\t0x30000" << "\n"; + ti << "\tEndTask" << "\n"; + ti << "EndAddressSpace" << "\n"; + ti.flush(); + + /* change current project file to <projectname>_app.gpj and continue + * generation */ + filename.insert(filename.lastIndexOf("."), "_app"); + Option::output.close(); + Option::output.setFileName(filename); + MakefileGenerator::openOutput(Option::output, QString()); + } else if ((project->first("TEMPLATE") == "lib") + && project->isActiveConfig("shared")) { + QString gpjname(strtarget); + gpjname += "_shared"; + gpjname += projectSuffix(); + QFile f(gpjname); + f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream t(&f); + t << "#!gbuild\n" + "[Program]\n" + "\t-A libINTEGRITY.so\n" + "\t-A libc.so\n" + "\t-A libscxx.so\n" + "\t-A libQtCore.so\n" + "\t-e __ghsbegin_text\n" + "\t-startfile=-\n" + "\t:syslibraries=-\n" + "\t-Onolink\n"; + t << "\t-o lib" << strtarget << ".so\n"; + t << "\t-l" << strtarget << "\n"; + t << "\t-extractall=-l" << strtarget << "\n"; + t << "\t:outputDir=work/" << filename.section(QDir::separator(), 0, -1).remove(".gpj") << "\n"; + t << strtarget << "_shared.ld\n"; + t << "$(__OS_DIR)/intlib/sharedobjbssinit.c\n"; + t.flush(); + + QFile fl(strtarget + "_shared.ld"); + fl.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + QTextStream tl(&fl); + tl << "CONSTANTS {\n" + " __INTEGRITY_MinPageAlign = 16K\n" + " __INTEGRITY_MaxPageAlign = 16K\n" + " __INTEGRITY_LibCBaseAddress = \n"; + tl << dllbase << "\n"; + tl << "}\n" + "-sec\n" + "{\n" + " .picbase __INTEGRITY_LibCBaseAddress :\n" + " .text :\n" + " .syscall :\n" + " .intercall :\n" + " .interfunc :\n" + " .secinfo :\n" + " .rodata align(16) :\n" + " .fixaddr :\n" + " .fixtype :\n" + " .rombeg :\n" + " .textchecksum :\n" + " // The above sections may be large. Leave a bigger gap for large pages.\n" + " .pidbase align(__INTEGRITY_MaxPageAlign) :\n" + " .sdabase :\n" + " .data :\n" + " .toc :\n" + " .opd :\n" + " .datachecksum :\n" + " .bss align(__INTEGRITY_MinPageAlign) :\n" + " .heap :\n" + "}\n"; + tl.flush(); + dllbase += DLLOFFSET; + } + + warn_msg(WarnParser, Option::output.fileName().toAscii()); + QTextStream t(&Option::output); + QString primaryTarget(project->values("QMAKE_CXX").at(0)); + + pathtoremove += QDir::separator(); + filename.remove(qmake_getpwd()); + + //HEADER + t << "#!gbuild" << "\n"; + + /* find the architecture out of the compiler name */ + if (filename.endsWith("projects.gpj")) { + primaryTarget.remove(0, 5); + t << "macro QT_BUILD_DIR=%expand_path(.)\n"; + t << "macro __OS_DIR=" << project->values("INTEGRITY_DIR").first() << "\n"; + t << "primaryTarget=" << primaryTarget << "_integrity.tgt" << "\n"; + t << "customization=util/integrity/qt.bod\n"; + } + /* project type */ + if (project->first("TEMPLATE") == "app") { + t << "[Program]" << "\n"; + if (isnativebin) { + t << "\t:binDir=bin\n"; + t << "\t-o " << strtarget << "\n"; + } else { + t << "\t:binDirRelative=.\n"; + t << "\t-o " << strtarget << "_app\n"; + } + } else if (project->first("TEMPLATE") == "lib") { + t << "[Library]" << "\n"; + t << "\t:binDir=lib" << "\n"; + t << "\t-o lib" << strtarget << ".a" << "\n"; + } else if (project->first("TEMPLATE") == "subdirs") + t << "[Project]" << "\n"; + else + t << project->first("TEMPLATE") << "\n"; + + /* compilations options */ + t << "\t:sourceDir=." << "\n"; + + t << "\t:outputDir=work" << relpath << "\n"; + if (filename.endsWith("projects.gpj")) { + t << "\t:sourceDir=work\n"; + t << "\t-Iwork\n"; + t << "\t-Llib\n"; + t << "\t"; + QStringList &l = project->values("QMAKE_CXXFLAGS"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).startsWith("-")) + t << "\n" << "\t" << (*it); + else + t << " " << (*it); + } + t << "\n"; + } + t << "\n"; + + t << varGlue("DEFINES", "\t-D", "\n\t-D", "\n"); + + t << "\t-I.\n\t-I" << specdir() << "\n"; + t << varGlue("INCLUDEPATH", "\t-I", "\n\t-I", "\n"); + t << "\t--cxx_include_directory .\n\t--cxx_include_directory " << specdir() << "\n"; + t << varGlue("INCLUDEPATH", "\t--cxx_include_directory ", "\n\t--cxx_include_directory ", "\n"); + + if (project->first("TEMPLATE") == "app") { + /* include linker flags if it's an application */ + QString src[] = { "QMAKE_LFLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", "LIBS", QString() }; + for (int i = 0; !src[i].isNull(); i++) { + /* skip target libraries for native tools */ + if (isnativebin && (i == 0)) + continue; + t << "\t"; + QStringList &l = project->values(src[i]); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).startsWith("-")) + t << "\n" << "\t" << (*it); + else + t << " " << (*it); + } + t << "\n"; + } + } + + /* first subdirectories/subprojects */ + { + QStringList &l = project->values("SUBDIRS"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + QString gpjname((*it)); + /* avoid native tools */ + if (nativebins.contains(gpjname.section("_", -1))) + continue; + if (!project->first((*it) + ".subdir").isEmpty()) + gpjname = project->first((*it) + ".subdir"); + else + gpjname.replace("_", QDir::separator()); + gpjname += QDir::separator() + gpjname.section(QDir::separator(), -1); + gpjname += projectSuffix(); + /* make relative */ + if (!project->values("QT_SOURCE_TREE").isEmpty()) { + gpjname.replace(project->values("QT_SOURCE_TREE").first() + QDir::separator(), ""); + } + t << gpjname << "\n"; + } + } + + { + QStringList &l = project->values("RESOURCES"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + QString tmpstr((*it).replace(pathtoremove, "")); + t << tmpstr << "\t[Qt Resource]\n"; + tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1); + tmpstr.remove(".qrc"); + t << "\t-name " << tmpstr << "\n"; + tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "qrc_"); + tmpstr.append(".cpp"); + t << "\t-o work/" << tmpstr << "\n"; + } + } + { + QStringList &l = project->values("FORMS"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + QString tmpstr((*it).replace(pathtoremove, "")); + t << tmpstr << "\t[Qt Dialog]\n"; + tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1); + tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_"); + tmpstr.remove(".ui"); + tmpstr.append(".h"); + t << "\t-o work/" << tmpstr << "\n"; + } + } + + /* source files for this project */ + QString src[] = { "HEADERS", "SOURCES", QString() }; + for (int i = 0; !src[i].isNull(); i++) { + QStringList &l = project->values(src[i]); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + if ((*it).isEmpty()) + continue; + /* native tools aren't preprocessed */ + if (!isnativebin) + t << writeOne((*it), pathtoremove); + else + t << (*it).remove(pathtoremove) << "\n"; + } + } + t << "\n"; + + { + QStringList &l = project->values("GENERATED_SOURCES"); + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + t << "work/" << (*it).section(QDir::separator(), -1) << "\n"; + } + } + + return true; +} + +QString GBuildMakefileGenerator::writeOne(QString filename, QString pathtoremove) +{ + QString s(""); + s += filename.remove(pathtoremove); + if (filename.endsWith(Option::h_ext.first())) { + QString corename(filename.section(QDir::separator(), -1)); + corename.remove(Option::h_ext.first()); + corename.append(Option::cpp_ext.first()); + corename.prepend(Option::h_moc_mod); + s += "\t[MOC/Qt Header]\n"; + s += "\t-o "; + s += "work/"; + s += corename; + s += "\n"; + } else if (filename.section(QDir::separator(), -1).startsWith("qrc_")) { + QString tmpstr(filename.section("/", -1).section(".", 0, -1).remove("qrc_").remove(".cpp")); + s += "\n\t:depends="; + s += tmpstr; + s += ".qrc"; + s += "\n"; + } else if (filename.endsWith(Option::cpp_ext.first())) { + QString tmpstr(filename.section("/", -1)); +// QString moctool(project->values("QMAKE_MOC").first()); + QString filepath(pathtoremove); + if (!project->values("QT_SOURCE_TREE").isEmpty()) { + filepath.remove(project->values("QT_SOURCE_TREE").first()); + filepath.remove(0, 1); + } +// if (!project->values("QT_BUILD_TREE").isEmpty()) { +// moctool.remove(project->values("QT_BUILD_TREE").first()); +// moctool.remove(0, 1); +// } + s += "\n\t:preexecShellSafe='${QT_BUILD_DIR}/bin/moc "; +// s += moctool; +// s += " "; + s += varGlue("DEFINES", "-D", " -D", " "); + s += varGlue("INCLUDEPATH", "-I", " -I", " "); + s += filepath; + s += filename; + s += " -o "; + tmpstr.replace(Option::cpp_ext.first(), Option::cpp_moc_ext); + s += "work/"; + s += tmpstr; + s += "\n"; + } else + s += "\n"; + return s; +} + +bool +GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const +{ + debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); + QFileInfo fi(file); + if (fi.filePath().isEmpty()) + file.setFileName(qmake_getpwd() + QDir::separator() + file.fileName()); + if (!file.fileName().endsWith(projectSuffix())) { + QString outputName(file.fileName()); + outputName += QDir::separator(); + outputName += fileInfo(project->projectFile()).baseName(); + outputName += projectSuffix(); + warn_msg(WarnParser, outputName.toAscii()); + file.setFileName(outputName); + } + debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); + bool ret = MakefileGenerator::openOutput(file, QString()); + return ret; +} + +QT_END_NAMESPACE diff --git a/qmake/generators/integrity/gbuild.h b/qmake/generators/integrity/gbuild.h new file mode 100644 index 0000000..6b5b1a0 --- /dev/null +++ b/qmake/generators/integrity/gbuild.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef GBUILD_H +#define GBUILD_H + +#include "makefile.h" + +QT_BEGIN_NAMESPACE + +class GBuildMakefileGenerator : public MakefileGenerator +{ + virtual bool write(); + + QString projectSuffix() const { return QString(".gpj"); }; + QString writeOne(QString filename, QString pathtoremove = ""); + +public: + GBuildMakefileGenerator(); + ~GBuildMakefileGenerator(); + + virtual bool supportsMetaBuild() { return false; } + virtual bool openOutput(QFile &, const QString &) const; +protected: + bool doPrecompiledHeaders() const { return false; } + virtual bool doDepends() const { return true; } + QStringList nativebins; + +}; + +inline GBuildMakefileGenerator::~GBuildMakefileGenerator() +{ } + +QT_END_NAMESPACE + +#endif // GBUILD_H diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index ae48ddd..a3fba6a 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -138,12 +138,12 @@ BuildsMetaMakefileGenerator::init() Build *build = new Build; build->name = name; build->makefile = createMakefileGenerator(project, false); - if (build->makefile){ + if (build->makefile){ makefiles += build; - }else { - delete build; - return false; - } + }else { + delete build; + return false; + } } return true; } @@ -179,7 +179,7 @@ BuildsMetaMakefileGenerator::write(const QString &oldpwd) using_stdout = true; } else { if(Option::output.fileName().isEmpty() && - Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE) + Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE) Option::output.setFileName(project->first("QMAKE_MAKEFILE")); Option::output_dir = oldpwd; QString build_name = build->name; @@ -306,7 +306,7 @@ SubdirsMetaMakefileGenerator::init() && project->isRecursive()); if(recurse) { QString old_output_dir = Option::output_dir; - QString old_output = Option::output.fileName(); + QString old_output = Option::output.fileName(); QString oldpwd = qmake_getpwd(); QString thispwd = oldpwd; if(!thispwd.endsWith('/')) @@ -387,7 +387,7 @@ SubdirsMetaMakefileGenerator::init() self->input_dir = qmake_getpwd(); self->output_dir = Option::output_dir; if(!recurse || (!Option::output.fileName().endsWith(Option::dir_sep) && !QFileInfo(Option::output).isDir())) - self->output_file = Option::output.fileName(); + self->output_file = Option::output.fileName(); self->makefile = new BuildsMetaMakefileGenerator(project, name, false); self->makefile->init(); subs.append(self); @@ -420,10 +420,10 @@ SubdirsMetaMakefileGenerator::write(const QString &oldpwd) writepwd = oldpwd; if(!(ret = subs.at(i)->makefile->write(writepwd))) break; - //restore because I'm paranoid + //restore because I'm paranoid qmake_setpwd(pwd); - Option::output.setFileName(output_name); - Option::output_dir = output_dir; + Option::output.setFileName(output_name); + Option::output_dir = output_dir; } return ret; } @@ -448,6 +448,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "symmake_abld.h" #include "symmake_sbsv2.h" #include "symbian_makefile.h" +#include "gbuild.h" QT_END_INCLUDE_NAMESPACE MakefileGenerator * @@ -491,6 +492,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) mkfile = new SymbianMakefileTemplate<UnixMakefileGenerator>; } else if(gen == "SYMBIAN_MINGW") { mkfile = new SymbianMakefileTemplate<MingwMakefileGenerator>; + } else if(gen == "GBUILD") { + mkfile = new GBuildMakefileGenerator; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); } @@ -556,6 +559,9 @@ MetaMakefileGenerator::modesForGenerator(const QString &gen, *host_mode = Option::HOST_WIN_MODE; #endif *target_mode = Option::TARG_SYMBIAN_MODE; + } else if (gen == "GBUILD") { + *host_mode = Option::HOST_UNIX_MODE; + *target_mode = Option::TARG_INTEGRITY_MODE; } else { fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData()); return false; diff --git a/qmake/option.cpp b/qmake/option.cpp index fcbf5fa..1354281 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -260,6 +260,8 @@ Option::parseCommandLine(int argc, char **argv, int skip) Option::host_mode = HOST_WIN_MODE; Option::target_mode = TARG_WIN_MODE; Option::target_mode_overridden = true; + } else if(opt == "integrity") { + Option::target_mode = TARG_INTEGRITY_MODE; } else if(opt == "d") { Option::debug_level++; } else if(opt == "version" || opt == "v" || opt == "-version") { diff --git a/qmake/option.h b/qmake/option.h index 23be12f..e3ddc9a 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -156,7 +156,7 @@ struct Option enum HOST_MODE { HOST_UNKNOWN_MODE, HOST_UNIX_MODE, HOST_WIN_MODE, HOST_MACX_MODE }; static HOST_MODE host_mode; enum TARG_MODE { TARG_UNKNOWN_MODE, TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, - TARG_SYMBIAN_MODE }; + TARG_SYMBIAN_MODE, TARG_INTEGRITY_MODE }; static TARG_MODE target_mode; static bool target_mode_overridden; static QString user_template, user_template_prefix; diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index 971069f..cd23e5e 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -12,6 +12,8 @@ symbian:HEADERS += arch/qatomic_symbian.h \ vxworks:HEADERS += arch/qatomic_vxworks.h +integrity:HEADERS += arch/qatomic_integrity.h + !wince*:!win32:!mac:!symbian:HEADERS += arch/qatomic_alpha.h \ arch/qatomic_avr32.h \ arch/qatomic_ia64.h \ diff --git a/src/corelib/arch/integrity/arch.pri b/src/corelib/arch/integrity/arch.pri new file mode 100644 index 0000000..2c4196e --- /dev/null +++ b/src/corelib/arch/integrity/arch.pri @@ -0,0 +1,3 @@ +# +# INTEGRITY RTOS architecture +# diff --git a/src/corelib/arch/qatomic_arch.h b/src/corelib/arch/qatomic_arch.h index f32aec7..3da833a 100644 --- a/src/corelib/arch/qatomic_arch.h +++ b/src/corelib/arch/qatomic_arch.h @@ -46,7 +46,9 @@ QT_BEGIN_HEADER #include "QtCore/qglobal.h" -#if defined(QT_ARCH_VXWORKS) +#if defined(QT_ARCH_INTEGRITY) +# include "QtCore/qatomic_integrity.h" +#elif defined(QT_ARCH_VXWORKS) # include "QtCore/qatomic_vxworks.h" #elif defined(QT_ARCH_ALPHA) # include "QtCore/qatomic_alpha.h" diff --git a/src/corelib/arch/qatomic_integrity.h b/src/corelib/arch/qatomic_integrity.h new file mode 100644 index 0000000..6563903 --- /dev/null +++ b/src/corelib/arch/qatomic_integrity.h @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef QATOMIC_INTEGRITY_H +#define QATOMIC_INTEGRITY_H + +#include <INTEGRITY.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#define qt_i2addr(a) reinterpret_cast<Address *>(const_cast<int *>(a)) +#define qt_p2addr(a) reinterpret_cast<Address *>(const_cast<void *>(a)) +#define qt_addr(a) reinterpret_cast<Address>(a) + + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return true; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return true; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() +{ return true; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() +{ return true; } +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() +{ return true; } + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ + int oldval; + AtomicModify(qt_i2addr(&_q_value), qt_i2addr(&oldval), 0, 1); + return _q_value != -1; +} + +inline bool QBasicAtomicInt::deref() +{ + int oldval; + AtomicModify(qt_i2addr(&_q_value), qt_i2addr(&oldval), 0, -1U); + return _q_value != 0; +} + +// Test and set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + return TestAndSet(qt_i2addr(&_q_value), expectedValue, newValue) == Success; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + int old_val; + do { + old_val = _q_value; + } while (TestAndSet(qt_i2addr(&_q_value), old_val, newValue) != Success); + return old_val; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + int old_val; + do { + old_val = _q_value; + } while (TestAndSet(qt_i2addr(&_q_value), old_val, old_val + valueToAdd) != Success); + return old_val; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) +{ + return TestAndSet((Address*)&_q_value, qt_addr(expectedValue), qt_addr(newValue)) == Success; +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) +{ + Address old_val; + do { + old_val = *reinterpret_cast<Address *>(const_cast<T *>(newValue)); + } while (TestAndSet(reinterpret_cast<Address *>(const_cast<T **>(&_q_value)), old_val, qt_addr(newValue)) != Success); + return reinterpret_cast<T *>(old_val); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + AtomicModify(qt_p2addr(&_q_value), qt_addr(_q_value), qt_addr(_q_value) + valueToAdd * sizeof(T)); + return _q_value; +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template <typename T> +Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QATOMIC_INTEGRITY_H + diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 93ed5ed..3c3d39e 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -64,7 +64,7 @@ #ifndef QT_NO_CODECS # include "qtsciicodec_p.h" # include "qisciicodec_p.h" -#ifndef Q_OS_SYMBIAN +#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY) # if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) // no iconv(3) support, must build all codecs into the library # include "../../plugins/codecs/cn/qgb18030codec.h" @@ -772,7 +772,7 @@ static void setup() # endif // Q_WS_X11 -#ifndef Q_OS_SYMBIAN +#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY) # if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) // no asian codecs when bootstrapping, sorry (void)new QGb18030Codec; @@ -805,7 +805,7 @@ static void setup() (void)new QLatin1Codec; (void)new QUtf8Codec; -#ifndef Q_OS_SYMBIAN +#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY) #if defined(Q_OS_UNIX) && !defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) // QIconvCodec depends on the UTF-16 codec, so it needs to be created last (void) new QIconvCodec(); diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index fb39ee5..134ef2f 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1738,7 +1738,7 @@ QSysInfo::WinVersion QSysInfo::windowsVersion() if (winver) return winver; winver = QSysInfo::WV_NT; - OSVERSIONINFOW osver; + OSVERSIONINFO osver; osver.dwOSVersionInfoSize = sizeof(osver); GetVersionEx(&osver); #ifdef Q_OS_WINCE diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 67ccf4d..1879537 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -369,7 +369,20 @@ namespace QT_NAMESPACE {} */ #if defined(__ghs) -# define Q_OUTOFLINE_TEMPLATE inline +# define Q_OUTOFLINE_TEMPLATE inline + +/* the following are necessary because the GHS C++ name mangling relies on __*/ +# define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \ + static const int AFUNC ## _init_variable_ = AFUNC(); +# define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC) +# define Q_DESTRUCTOR_FUNCTION0(AFUNC) \ + class AFUNC ## _dest_class_ { \ + public: \ + inline AFUNC ## _dest_class_() { } \ + inline ~ AFUNC ## _dest_class_() { AFUNC(); } \ + } AFUNC ## _dest_instance_; +# define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) + #endif /* Symantec C++ is now Digital Mars */ @@ -1445,7 +1458,7 @@ class QDataStream; # define Q_AUTOTEST_EXPORT #endif -inline void qt_noop() {} +inline void qt_noop(void) {} /* These wrap try/catch so we can switch off exceptions later. diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 4d4ae21..2b61192 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -113,3 +113,7 @@ win32 { LIBS += -lplatformenv } } +integrity { + SOURCES += io/qfsfileengine_unix.cpp \ + io/qfsfileengine_iterator_unix.cpp +} diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 62e7c9f..6c03b32 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1029,7 +1029,11 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla if (openMode & QIODevice::ReadOnly) access |= PROT_READ; if (openMode & QIODevice::WriteOnly) access |= PROT_WRITE; +#if defined(Q_OS_INTEGRITY) + int pageSize = sysconf(_SC_PAGESIZE); +#else int pageSize = getpagesize(); +#endif int extra = offset % pageSize; if (quint64(size + extra) > quint64((size_t)-1)) { @@ -1079,6 +1083,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla bool QFSFileEnginePrivate::unmap(uchar *ptr) { +#if !defined(Q_OS_INTEGRITY) Q_Q(QFSFileEngine); if (!maps.contains(ptr)) { q->setError(QFile::PermissionsError, qt_error_string(EACCES)); @@ -1093,6 +1098,9 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr) } maps.remove(ptr); return true; +#else + return false; +#endif } QT_END_NAMESPACE diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 2a9d8ee..0435256 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -928,7 +928,7 @@ public: } }; -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && ! defined (Q_OS_NACL) +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined (Q_OS_NACL) && !defined(Q_OS_INTEGRITY) #define QT_USE_MMAP #endif diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 93818d1..c3a6721 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -139,3 +139,19 @@ vxworks { kernel/qfunctions_vxworks.h } + +integrity { + SOURCES += \ + kernel/qcore_unix.cpp \ + kernel/qcrashhandler.cpp \ + kernel/qsharedmemory_unix.cpp \ + kernel/qsystemsemaphore_unix.cpp \ + kernel/qeventdispatcher_unix.cpp + HEADERS += \ + kernel/qcore_unix_p.h \ + kernel/qcrashhandler_p.h \ + kernel/qeventdispatcher_unix_p.h + + contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri) +} + diff --git a/src/corelib/kernel/qcrashhandler.cpp b/src/corelib/kernel/qcrashhandler.cpp index 59f3796..fbdbac0 100644 --- a/src/corelib/kernel/qcrashhandler.cpp +++ b/src/corelib/kernel/qcrashhandler.cpp @@ -339,6 +339,9 @@ static void print_backtrace(FILE *outb) "EOF\n", globalProgName, (int)getpid())) return; +#elif defined(Q_OS_INTEGRITY) + /* abort */ + CheckSuccess(Failure); #else /* All other platforms */ /* * TODO: SCO/UnixWare 7 must be something like (not tested) diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 25c02c4..dceb51d 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -116,7 +116,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() // do nothing. #elif defined(Q_OS_INTEGRITY) // INTEGRITY doesn't like a "select" on pipes, so use socketpair instead - if (socketpair(AF_INET, SOCK_STREAM, PF_INET, thread_pipe) == -1) { + if (socketpair(AF_INET, SOCK_STREAM, 0, thread_pipe) == -1) { perror("QEventDispatcherUNIXPrivate(): Unable to create socket pair"); pipefail = true; } else { @@ -343,7 +343,7 @@ timeval QTimerInfoList::updateCurrentTime() return (currentTime = qt_gettime()); } -#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC)) || defined(QT_BOOTSTRAPPED) +#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED) template <> timeval qAbs(const timeval &t) diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index d72c1ab..daa5dc6 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -56,7 +56,7 @@ #include "qhash.h" #include "qtranslator_p.h" -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY) #define QT_USE_MMAP #include "private/qcore_unix_p.h" #endif diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri index 50b005d..eb7a7f7 100644 --- a/src/corelib/plugin/plugin.pri +++ b/src/corelib/plugin/plugin.pri @@ -28,4 +28,8 @@ unix { SOURCES += plugin/qlibrary_unix.cpp } +integrity { + SOURCES += plugin/qlibrary_unix.cpp +} + LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri index 03f661d..90583bb 100644 --- a/src/corelib/thread/thread.pri +++ b/src/corelib/thread/thread.pri @@ -31,3 +31,7 @@ unix:SOURCES += thread/qmutex_unix.cpp \ win32:SOURCES += thread/qmutex_win.cpp \ thread/qthread_win.cpp \ thread/qwaitcondition_win.cpp + +integrity:SOURCES += thread/qmutex_unix.cpp \ + thread/qthread_unix.cpp \ + thread/qwaitcondition_unix.cpp diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 9d564a1..fb1b466 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -88,6 +88,7 @@ symbian:SOURCES+=tools/qlocale_symbian.cpp else:symbian:SOURCES += tools/qelapsedtimer_symbian.cpp else:unix:SOURCES += tools/qelapsedtimer_unix.cpp else:win32:SOURCES += tools/qelapsedtimer_win.cpp +else:integrity:SOURCES += tools/qelapsedtimer_unix.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp contains(QT_CONFIG, zlib):include($$PWD/../../3rdparty/zlib.pri) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 0554897..f57f842 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -608,7 +608,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, out->types << ref; } - Object *root = unit->parser().tree(); + QDeclarativeParser::Object *root = unit->parser().tree(); Q_ASSERT(root); this->engine = engine; @@ -637,7 +637,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, return !isError(); } -void QDeclarativeCompiler::compileTree(Object *tree) +void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree) { compileState.root = tree; componentStat.lineNumber = tree->location.start.line; @@ -715,14 +715,14 @@ void QDeclarativeCompiler::compileTree(Object *tree) enginePrivate->registerCompositeType(output); } -static bool ValuePtrLessThan(const Value *t1, const Value *t2) +static bool ValuePtrLessThan(const QDeclarativeParser::Value *t1, const QDeclarativeParser::Value *t2) { return t1->location.start.line < t2->location.start.line || (t1->location.start.line == t2->location.start.line && t1->location.start.column < t2->location.start.column); } -bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) +bool QDeclarativeCompiler::buildObject(QDeclarativeParser::Object *obj, const BindingContext &ctxt) { componentStat.objects++; @@ -799,7 +799,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) defaultProperty->values = obj->defaultProperty->values; defaultProperty->values += explicitProperty->values; - foreach(Value *value, defaultProperty->values) + foreach(QDeclarativeParser::Value *value, defaultProperty->values) value->addref(); qSort(defaultProperty->values.begin(), defaultProperty->values.end(), ValuePtrLessThan); @@ -1262,7 +1262,7 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, if (!obj->dynamicSlots.isEmpty()) COMPILE_EXCEPTION(obj, tr("Component objects cannot declare new functions.")); - Object *root = 0; + QDeclarativeParser::Object *root = 0; if (obj->defaultProperty && obj->defaultProperty->values.count()) root = obj->defaultProperty->values.first()->object; @@ -1302,7 +1302,7 @@ bool QDeclarativeCompiler::buildComponentFromRoot(QDeclarativeParser::Object *ob // Build a sub-object. A sub-object is one that was not created directly by // QML - such as a grouped property object, or an attached object. Sub-object's // can't have an id, involve a custom parser, have attached properties etc. -bool QDeclarativeCompiler::buildSubObject(Object *obj, const BindingContext &ctxt) +bool QDeclarativeCompiler::buildSubObject(QDeclarativeParser::Object *obj, const BindingContext &ctxt) { Q_ASSERT(obj->metatype); Q_ASSERT(!obj->defaultProperty); @@ -1615,7 +1615,7 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop, output->bytecode << fetch; for (int ii = 0; ii < prop->values.count(); ++ii) { - Value *v = prop->values.at(ii); + QDeclarativeParser::Value *v = prop->values.at(ii); if (v->type == Value::CreatedObject) { @@ -1903,7 +1903,7 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, if (prop->values.count() > 1) { COMPILE_EXCEPTION(prop, tr("Single property assignment expected")); } else if (prop->values.count()) { - Value *value = prop->values.at(0); + QDeclarativeParser::Value *value = prop->values.at(0); if (value->object) { COMPILE_EXCEPTION(prop, tr("Unexpected object assignment")); @@ -1932,7 +1932,7 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, } for (int ii = 0; ii < prop->onValues.count(); ++ii) { - Value *v = prop->onValues.at(ii); + QDeclarativeParser::Value *v = prop->onValues.at(ii); Q_ASSERT(v->object); COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, baseObj, v, ctxt)); @@ -1962,7 +1962,7 @@ bool QDeclarativeCompiler::buildListProperty(QDeclarativeParser::Property *prop, bool assignedBinding = false; for (int ii = 0; ii < prop->values.count(); ++ii) { - Value *v = prop->values.at(ii); + QDeclarativeParser::Value *v = prop->values.at(ii); if (v->object) { v->type = Value::CreatedObject; COMPILE_CHECK(buildObject(v->object, ctxt)); @@ -2017,7 +2017,7 @@ bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property COMPILE_EXCEPTION(prop->values.at(0), tr( "Cannot assign multiple values to a singular property") ); for (int ii = 0; ii < prop->values.count(); ++ii) { - Value *v = prop->values.at(ii); + QDeclarativeParser::Value *v = prop->values.at(ii); if (v->object) { COMPILE_CHECK(buildPropertyObjectAssignment(prop, obj, v, ctxt)); @@ -2030,7 +2030,7 @@ bool QDeclarativeCompiler::buildPropertyAssignment(QDeclarativeParser::Property } for (int ii = 0; ii < prop->onValues.count(); ++ii) { - Value *v = prop->onValues.at(ii); + QDeclarativeParser::Value *v = prop->onValues.at(ii); Q_ASSERT(v->object); COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, obj, v, ctxt)); @@ -2385,7 +2385,7 @@ bool QDeclarativeCompiler::mergeDynamicMetaProperties(QDeclarativeParser::Object COMPILE_EXCEPTION(property, tr("Invalid property nesting")); for (int ii = 0; ii < p.defaultValue->values.count(); ++ii) { - Value *v = p.defaultValue->values.at(ii); + QDeclarativeParser::Value *v = p.defaultValue->values.at(ii); v->addref(); property->values.append(v); } @@ -2678,7 +2678,7 @@ static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node) bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, QByteArray &data, - Object *obj, + QDeclarativeParser::Object *obj, const Object::DynamicProperty &prop) { if (!prop.defaultValue) @@ -2701,7 +2701,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, if (!compileState.ids.contains(alias.at(0))) COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias reference. Unable to find id \"%1\"").arg(alias.at(0))); - Object *idObject = compileState.ids[alias.at(0)]; + QDeclarativeParser::Object *idObject = compileState.ids[alias.at(0)]; QByteArray typeName; @@ -2884,7 +2884,7 @@ bool QDeclarativeCompiler::completeComponentBuild() componentStat.ids = compileState.ids.count(); for (int ii = 0; ii < compileState.aliasingObjects.count(); ++ii) { - Object *aliasObject = compileState.aliasingObjects.at(ii); + QDeclarativeParser::Object *aliasObject = compileState.aliasingObjects.at(ii); COMPILE_CHECK(buildDynamicMeta(aliasObject, ResolveAliases)); } diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 8dd6824..856108c 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -131,7 +131,7 @@ QDeclarativeCustomParserNodePrivate::fromProperty(QDeclarativeParser::Property * prop.d->values << QVariant::fromValue(props.at(ii)); } else { for(int ii = 0; ii < p->values.count(); ++ii) { - Value *v = p->values.at(ii); + QDeclarativeParser::Value *v = p->values.at(ii); v->type = QDeclarativeParser::Value::Literal; if(v->object) { diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index 35bb0f1..d5b9424 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -225,9 +225,9 @@ QDeclarativeParser::Property::~Property() if (value) value->release(); } -Object *QDeclarativeParser::Property::getValue(const LocationSpan &l) +QDeclarativeParser::Object *QDeclarativeParser::Property::getValue(const LocationSpan &l) { - if (!value) { value = new Object; value->location = l; } + if (!value) { value = new QDeclarativeParser::Object; value->location = l; } return value; } diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 996920a..e8f6b0d 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -65,16 +65,16 @@ class ProcessAST: protected AST::Visitor { struct State { State() : object(0), property(0) {} - State(Object *o) : object(o), property(0) {} - State(Object *o, Property *p) : object(o), property(p) {} + State(QDeclarativeParser::Object *o) : object(o), property(0) {} + State(QDeclarativeParser::Object *o, Property *p) : object(o), property(p) {} - Object *object; + QDeclarativeParser::Object *object; Property *property; }; struct StateStack : public QStack<State> { - void pushObject(Object *obj) + void pushObject(QDeclarativeParser::Object *obj) { push(State(obj)); } @@ -105,7 +105,7 @@ public: protected: - Object *defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment, + QDeclarativeParser::Object *defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment, const QString &objectType, AST::SourceLocation typeLocation, LocationSpan location, @@ -134,7 +134,7 @@ protected: QString asString(AST::UiQualifiedId *node) const; const State state() const; - Object *currentObject() const; + QDeclarativeParser::Object *currentObject() const; Property *currentProperty() const; QString qualifiedNameId() const; @@ -200,7 +200,7 @@ const ProcessAST::State ProcessAST::state() const return _stateStack.back(); } -Object *ProcessAST::currentObject() const +QDeclarativeParser::Object *ProcessAST::currentObject() const { return state().object; } @@ -229,7 +229,7 @@ QString ProcessAST::asString(AST::UiQualifiedId *node) const return s; } -Object * +QDeclarativeParser::Object * ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, bool onAssignment, const QString &objectType, @@ -286,7 +286,7 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, if (lastTypeDot >= 0) resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/')); - Object *obj = new Object; + QDeclarativeParser::Object *obj = new QDeclarativeParser::Object; QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType); obj->type = typeRef->id; @@ -302,7 +302,7 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, if (propertyCount) { Property *prop = currentProperty(); - Value *v = new Value; + QDeclarativeParser::Value *v = new QDeclarativeParser::Value; v->object = obj; v->location = obj->location; if (onAssignment) @@ -319,7 +319,7 @@ ProcessAST::defineObjectBinding(AST::UiQualifiedId *propertyName, _parser->setTree(obj); } else { const State state = _stateStack.top(); - Value *v = new Value; + QDeclarativeParser::Value *v = new QDeclarativeParser::Value; v->object = obj; v->location = obj->location; if (state.property) { @@ -594,7 +594,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.defaultValue->location = location(node->expression->firstSourceLocation(), node->expression->lastSourceLocation()); - Value *value = new Value; + QDeclarativeParser::Value *value = new QDeclarativeParser::Value; value->location = location(node->expression->firstSourceLocation(), node->expression->lastSourceLocation()); value->value = getVariant(node->expression); @@ -698,7 +698,7 @@ bool ProcessAST::visit(AST::UiScriptBinding *node) prop->location.range.length = prop->location.range.offset + prop->location.range.length - node->qualifiedId->identifierToken.offset; prop->location.range.offset = node->qualifiedId->identifierToken.offset; - Value *v = new Value; + QDeclarativeParser::Value *v = new QDeclarativeParser::Value; v->value = primitive; v->location = location(node->statement->firstSourceLocation(), node->statement->lastSourceLocation()); @@ -870,7 +870,7 @@ QList<QDeclarativeScriptParser::TypeReference*> QDeclarativeScriptParser::refere return _refTypes; } -Object *QDeclarativeScriptParser::tree() const +QDeclarativeParser::Object *QDeclarativeScriptParser::tree() const { return root; } @@ -1193,7 +1193,7 @@ QDeclarativeScriptParser::TypeReference *QDeclarativeScriptParser::findOrCreateT return type; } -void QDeclarativeScriptParser::setTree(Object *tree) +void QDeclarativeScriptParser::setTree(QDeclarativeParser::Object *tree) { Q_ASSERT(! root); diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 12e77b1..b36b21e 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -78,11 +78,11 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) #endif m_resolveSymlinks(false), m_iconProvider(&defaultProvider) { -#ifndef Q_OS_WIN +#ifdef Q_OS_WIN + m_resolveSymlinks = true; +#elif !defined(Q_OS_INTEGRITY) userId = getuid(); groupId = getgid(); -#else - m_resolveSymlinks = true; #endif #ifndef QT_NO_FILESYSTEMWATCHER watcher = new QFileSystemWatcher(this); diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri index eb13d8d..31f0bc6 100644 --- a/src/gui/embedded/embedded.pri +++ b/src/gui/embedded/embedded.pri @@ -120,6 +120,12 @@ embedded { LIBS += -lgf } + contains( gfx-drivers, integrityfb ) { + HEADERS += embedded/qscreenintegrityfb_qws.h + SOURCES += embedded/qscreenintegrityfb_qws.cpp + LIBS += -lfbdev + } + contains( gfx-drivers, qvfb ) { HEADERS += embedded/qscreenvfb_qws.h SOURCES += embedded/qscreenvfb_qws.cpp @@ -174,6 +180,11 @@ embedded { SOURCES += embedded/qkbdqnx_qws.cpp } + contains( kbd-drivers, integrity ) { + HEADERS += embedded/qkbdintegrity_qws.h + SOURCES += embedded/qkbdintegrity_qws.cpp + } + # # Mouse drivers # @@ -207,4 +218,9 @@ embedded { HEADERS += embedded/qmouseqnx_qws.h SOURCES += embedded/qmouseqnx_qws.cpp } + + contains( mouse-drivers, integrity ) { + HEADERS += embedded/qmouseintegrity_qws.h + SOURCES += embedded/qmouseintegrity_qws.cpp + } } diff --git a/src/gui/embedded/qkbddriverfactory_qws.cpp b/src/gui/embedded/qkbddriverfactory_qws.cpp index 661b073..45825e5 100644 --- a/src/gui/embedded/qkbddriverfactory_qws.cpp +++ b/src/gui/embedded/qkbddriverfactory_qws.cpp @@ -49,6 +49,7 @@ #include "qkbdum_qws.h" #include "qkbdvfb_qws.h" #include "qkbdqnx_qws.h" +#include "qkbdintegrity_qws.h" #include <stdlib.h> #include "private/qfactoryloader_p.h" #include "qkbddriverplugin_qws.h" @@ -106,6 +107,10 @@ QWSKeyboardHandler *QKbdDriverFactory::create(const QString& key, const QString& if (driver == QLatin1String("qnx") || driver.isEmpty()) return new QWSQnxKeyboardHandler(device); #endif +#if defined(Q_OS_INTEGRITY) + if (driver == QLatin1String("integrity") || driver.isEmpty()) + return new QWSIntKeyboardHandler(device); +#endif #ifndef QT_NO_QWS_KEYBOARD # ifndef QT_NO_QWS_KBD_TTY if (driver == QLatin1String("tty") || driver.isEmpty()) @@ -151,6 +156,9 @@ QStringList QKbdDriverFactory::keys() #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX) list << QLatin1String("QNX"); #endif +#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_KBD_INTEGRITY) + list << QLatin1String("INTEGRITY"); +#endif #ifndef QT_NO_QWS_KBD_TTY list << QLatin1String("TTY"); #endif diff --git a/src/gui/embedded/qkbdintegrity_qws.cpp b/src/gui/embedded/qkbdintegrity_qws.cpp new file mode 100644 index 0000000..b2df422 --- /dev/null +++ b/src/gui/embedded/qkbdintegrity_qws.cpp @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_INTEGRITY) + +#include "qkbdintegrity_qws.h" +#include <qwindowsystem_qws.h> +#include <qapplication.h> +#include <qtimer.h> +#include <qthread.h> + +#include <INTEGRITY.h> + + +//=========================================================================== + +QT_BEGIN_NAMESPACE + +// +// INTEGRITY keyboard +// + +class QIntKeyboardListenThread; + +class QWSIntKbPrivate : public QObject +{ + Q_OBJECT + friend class QIntKeyboardListenThread; +public: + QWSIntKbPrivate(QWSKeyboardHandler *, const QString &device); + ~QWSIntKbPrivate(); + void dataReady(int amount) { emit kbdDataAvailable(amount); } + uint8_t scancodebuf[32 /* USB_SCANCODE_BUF_LEN */ ]; + uint8_t rxpost; + uint8_t rxack; + +Q_SIGNALS: + void kbdDataAvailable(int amount); + +private Q_SLOTS: + void readKeyboardData(int amount); + +private: + QWSKeyboardHandler *handler; + QIntKeyboardListenThread *kbdthread; +}; +class QIntKeyboardListenThread : public QThread +{ +protected: + QWSIntKbPrivate *imp; + bool loop; +public: + QIntKeyboardListenThread(QWSIntKbPrivate *im) : QThread(), imp(im) {}; + ~QIntKeyboardListenThread() {}; + void run(); + void stoploop() { loop = false; }; +}; + + +QWSIntKeyboardHandler::QWSIntKeyboardHandler(const QString &device) + : QWSKeyboardHandler(device) +{ + d = new QWSIntKbPrivate(this, device); +} + +QWSIntKeyboardHandler::~QWSIntKeyboardHandler() +{ + delete d; +} + +//void QWSIntKeyboardHandler::processKeyEvent(int keycode, bool isPress, +// bool autoRepeat) +//{ +// QWSKeyboardHandler::processKeyEvent(keycode, isPress, autoRepeat); +//} + +void QIntKeyboardListenThread::run(void) +{ + Error E; + Buffer b; + Connection kbdc; + bool waitforresource = true; + do { + E = RequestResource((Object*)&kbdc, + "USBKeyboardClient", "!systempassword"); + if (E == Success) { + loop = false; + } else { + E = RequestResource((Object*)&kbdc, + "KeyboardClient", "!systempassword"); + if (E == Success) { + waitforresource = false; + } + } + if (waitforresource) + ::sleep(1); + } while (loop && waitforresource); + if (!loop) + return; + b.BufferType = DataBuffer | LastBuffer; + b.Length = sizeof(imp->scancodebuf); + b.TheAddress = (Address)imp->scancodebuf; + do { + b.Transferred = 0; + b.TheAddress = (Address)imp->scancodebuf + imp->rxpost; + CheckSuccess(SynchronousReceive(kbdc, &b)); + imp->rxpost += b.Transferred; + if (imp->rxpost >= 32 /* USB_SCANCODE_BUF_LEN */) + imp->rxpost = 0; + if (imp->rxpost == (imp->rxack + b.Transferred) % 32 /* USB_SCANCODE_BUF_LEN */) { + imp->kbdDataAvailable(b.Transferred); + } + } while (loop); +} + +void QWSIntKbPrivate::readKeyboardData(int amount) +{ + uint16_t keycode; + do { + if (scancodebuf[rxack] == 0xe0) { + keycode = scancodebuf[rxack] << 8; + rxack++; + if (rxack >= 32 /* USB_SCANCODE_BUF_LEN */) + rxack = 0; + } else { + keycode = 0; + } + + handler->processKeycode(keycode + (scancodebuf[rxack] & 0x7f), + (scancodebuf[rxack] & 0x80) == 0, + scancodebuf[rxack] == 2); + rxack++; + if (rxack >= 32 /* USB_SCANCODE_BUF_LEN */) + rxack = 0; + } while (rxack != rxpost); +} + +QWSIntKbPrivate::QWSIntKbPrivate(QWSKeyboardHandler *h, const QString &device) : handler(h) +{ + connect(this, SIGNAL(kbdDataAvailable(int)), this, SLOT(readKeyboardData(int))); + this->handler = handler; + rxack = rxpost = 0; + kbdthread = new QIntKeyboardListenThread(this); + kbdthread->start(); +} + +QWSIntKbPrivate::~QWSIntKbPrivate() +{ + kbdthread->stoploop(); + kbdthread->wait(); + delete kbdthread; +} + + +QT_END_NAMESPACE + +#include "qkbdintegrity_qws.moc" + +#endif // QT_NO_QWS_KEYBOARD || QT_NO_QWS_KBD_TTY diff --git a/src/gui/embedded/qkbdintegrity_qws.h b/src/gui/embedded/qkbdintegrity_qws.h new file mode 100644 index 0000000..f9ae4e3 --- /dev/null +++ b/src/gui/embedded/qkbdintegrity_qws.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef QKBDINTEGRITY_QWS_H +#define QKBDINTEGRITY_QWS_H + +#include <QtGui/qkbd_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_KEYBOARD + +#ifndef QT_NO_QWS_KBD_INTEGRITY + +class QSocketNotifier; +class QWSIntKbPrivate; + +class QWSIntKeyboardHandler : public QWSKeyboardHandler +{ +public: + explicit QWSIntKeyboardHandler(const QString&); + virtual ~QWSIntKeyboardHandler(); + +//protected: +// virtual void processKeyEvent(int keycode, bool isPress, bool autoRepeat); + +private: + QWSIntKbPrivate *d; +}; + +#endif // QT_NO_QWS_KBD_INTEGRITY + +#endif // QT_NO_QWS_KEYBOARD + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QKBDINTEGRITY_QWS_H diff --git a/src/gui/embedded/qmousedriverfactory_qws.cpp b/src/gui/embedded/qmousedriverfactory_qws.cpp index 81e6552..f67284d 100644 --- a/src/gui/embedded/qmousedriverfactory_qws.cpp +++ b/src/gui/embedded/qmousedriverfactory_qws.cpp @@ -48,6 +48,7 @@ #include "qmousevfb_qws.h" #include "qmousetslib_qws.h" #include "qmouseqnx_qws.h" +#include "qmouseintegrity_qws.h" #include <stdlib.h> #include "private/qfactoryloader_p.h" #include "qmousedriverplugin_qws.h" @@ -107,6 +108,10 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString & if (driver == QLatin1String("qnx") || driver.isEmpty()) return new QQnxMouseHandler(key, device); #endif +#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_MOUSE_INTEGRITY) + if (driver == QLatin1String("integrity") || driver.isEmpty()) + return new QIntMouseHandler(key, device); +#endif #ifndef QT_NO_QWS_MOUSE_LINUXTP if (driver == QLatin1String("linuxtp") || driver.isEmpty()) return new QWSLinuxTPMouseHandler(key, device); @@ -157,6 +162,9 @@ QStringList QMouseDriverFactory::keys() #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX) list << QLatin1String("QNX"); #endif +#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_MOUSE_INTEGRITY) + list << QLatin1String("INTEGRITY"); +#endif #ifndef QT_NO_QWS_MOUSE_LINUXTP list << QLatin1String("LinuxTP"); #endif diff --git a/src/gui/embedded/qmouseintegrity_qws.cpp b/src/gui/embedded/qmouseintegrity_qws.cpp new file mode 100644 index 0000000..78a8c1b --- /dev/null +++ b/src/gui/embedded/qmouseintegrity_qws.cpp @@ -0,0 +1,271 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef QT_NO_QWS_MOUSE_INTEGRITY + +#include "qmouseintegrity_qws.h" +#include <qwindowsystem_qws.h> +#include <qapplication.h> +#include <qtimer.h> +#include <qthread.h> + +#include <INTEGRITY.h> + + +typedef Address MOUSEHandler; +typedef struct MOUSEMessageStruct +{ + Value x; + Value y; + Value z; + Value buttons; +} MOUSEMessage; + +static Error MOUSE_Init(MOUSEHandler *handler, Boolean *isabsolute); +static Error MOUSE_SynchronousGetPosition(MOUSEHandler handler, MOUSEMessage *msg, + Boolean absolute); +static Error MOUSE_ShouldFilter(MOUSEHandler handler, Boolean *filter); + +QT_BEGIN_NAMESPACE + +class QIntMouseListenThread; + +class QIntMousePrivate : public QObject +{ + Q_OBJECT + friend class QIntMouseListenTaskThread; +Q_SIGNALS: + void mouseDataAvailable(int x, int y, int buttons); +public: + QIntMousePrivate(QIntMouseHandler *handler); + ~QIntMousePrivate(); + void dataReady(int x, int y, int buttons) { emit mouseDataAvailable(x, y, buttons); } + bool calibrated; + bool waitforread; + bool suspended; + QIntMouseListenThread *mousethread; + +private: + QIntMouseHandler *handler; +}; + +class QIntMouseListenThread : public QThread +{ +protected: + QIntMousePrivate *imp; + bool loop; +public: + QIntMouseListenThread(QIntMousePrivate *im) : QThread(), imp(im) {}; + ~QIntMouseListenThread() {}; + void run(); + void stoploop() { loop = false; }; +}; + + +QIntMouseHandler::QIntMouseHandler(const QString &driver, const QString &device) + : QObject(), QWSCalibratedMouseHandler(driver, device) +{ + QPoint test(1,1); + d = new QIntMousePrivate(this); + connect(d, SIGNAL(mouseDataAvailable(int, int, int)), this, SLOT(readMouseData(int, int, int))); + + d->calibrated = (test != transform(test)); + + d->mousethread->start(); +} + +QIntMouseHandler::~QIntMouseHandler() +{ + disconnect(d, SIGNAL(mouseDataAvailable(int, int, int)), this, SLOT(readMouseData(int, int, int))); + delete d; +} + +void QIntMouseHandler::resume() +{ + d->suspended = true; +} + +void QIntMouseHandler::suspend() +{ + d->suspended = false; +} + +void QIntMouseHandler::readMouseData(int x, int y, int buttons) +{ + d->waitforread = false; + if (d->suspended) + return; + if (d->calibrated) { + sendFiltered(QPoint(x, y), buttons); + } else { + QPoint pos; + pos = transform(QPoint(x, y)); + limitToScreen(pos); + mouseChanged(pos, buttons, 0); + } +} + +void QIntMouseHandler::clearCalibration() +{ + QWSCalibratedMouseHandler::clearCalibration(); +} + +void QIntMouseHandler::calibrate(const QWSPointerCalibrationData *data) +{ + QWSCalibratedMouseHandler::calibrate(data); +} + +void QIntMouseListenThread::run(void) +{ + MOUSEHandler handler; + MOUSEMessage msg; + Boolean filter; + Boolean isabsolute; + loop = true; + CheckSuccess(MOUSE_Init(&handler, &isabsolute)); + CheckSuccess(MOUSE_ShouldFilter(handler, &filter)); + if (!filter) + imp->calibrated = false; + imp->waitforread = false; + do { + MOUSE_SynchronousGetPosition(handler, &msg, isabsolute); + imp->dataReady(msg.x, msg.y, msg.buttons); + } while (loop); + QThread::exit(0); +} + +QIntMousePrivate::QIntMousePrivate(QIntMouseHandler *handler) + : QObject() +{ + this->handler = handler; + suspended = false; + mousethread = new QIntMouseListenThread(this); +} + +QIntMousePrivate::~QIntMousePrivate() +{ + mousethread->stoploop(); + mousethread->wait(); + delete mousethread; +} + +QT_END_NAMESPACE + +#include "qmouseintegrity_qws.moc" + +typedef struct USBMouseStruct +{ + Connection mouseconn; + Buffer mousemsg[2]; + Value x; + Value y; +} USBMouse; + +USBMouse mousedev; + +Error MOUSE_Init(MOUSEHandler *handler, Boolean *isabsolute) +{ + Error E; + bool loop = true; + memset((void*)&mousedev, 0, sizeof(USBMouse)); + mousedev.mousemsg[0].BufferType = DataImmediate; + mousedev.mousemsg[1].BufferType = DataImmediate | LastBuffer; + do { + E = RequestResource((Object*)&mousedev.mouseconn, + "MouseClient", "!systempassword"); + if (E == Success) { + *isabsolute = true; + loop = false; + } else { + E = RequestResource((Object*)&mousedev.mouseconn, + "USBMouseClient", "!systempassword"); + if (E == Success) { + *isabsolute = false; + loop = false; + } + } + if (loop) + sleep(1); + } while (loop); + *handler = (MOUSEHandler)&mousedev; + return Success; +} + +Error MOUSE_SynchronousGetPosition(MOUSEHandler handler, MOUSEMessage *msg, + Boolean isabsolute) +{ + signed long x; + signed long y; + USBMouse *mdev = (USBMouse *)handler; + mdev->mousemsg[0].Transferred = 0; + mdev->mousemsg[1].Transferred = 0; + SynchronousReceive(mdev->mouseconn, mdev->mousemsg); + if (isabsolute) { + x = (signed long)mdev->mousemsg[0].Length; + y = (signed long)mdev->mousemsg[1].TheAddress; + } else { + x = mdev->x + (signed long)mdev->mousemsg[0].Length; + y = mdev->y + (signed long)mdev->mousemsg[1].TheAddress; + } + if (x < 0) + mdev->x = 0; + else + mdev->x = x; + if (y < 0) + mdev->y = 0; + else + mdev->y = y; + msg->x = mdev->x; + msg->y = mdev->y; + msg->buttons = mdev->mousemsg[0].TheAddress; + return Success; +} + +Error MOUSE_ShouldFilter(MOUSEHandler handler, Boolean *filter) +{ + if (filter == NULL) + return Failure; + *filter = false; + return Success; +} + +#endif // QT_NO_QWS_MOUSE_INTEGRITY + diff --git a/src/gui/embedded/qmouseintegrity_qws.h b/src/gui/embedded/qmouseintegrity_qws.h new file mode 100644 index 0000000..46d27a3 --- /dev/null +++ b/src/gui/embedded/qmouseintegrity_qws.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef QMOUSEINTEGRITY_QWS_H +#define QMOUSEINTEGRITY_QWS_H + +#include <QtGui/qmouse_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_MOUSE_INTEGRITY + +class QSocketNotifier; +class QIntMousePrivate; + +class QIntMouseHandler : public QObject, public QWSCalibratedMouseHandler { + Q_OBJECT +public: + QIntMouseHandler(const QString &driver = QString(), + const QString &device = QString()); + ~QIntMouseHandler(); + + void resume(); + void suspend(); + + void calibrate(const QWSPointerCalibrationData *data); + void clearCalibration(); + +private: + QIntMousePrivate *d; +private Q_SLOTS: + void readMouseData(int x, int y, int buttons); +}; +#endif // QT_NO_QWS_MOUSE_INTEGRITY + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMOUSEINTEGRITY_QWS_H diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h index d237dd8..17ffbbb 100644 --- a/src/gui/embedded/qscreen_qws.h +++ b/src/gui/embedded/qscreen_qws.h @@ -193,7 +193,7 @@ class Q_GUI_EXPORT QScreen { public: enum ClassId { LinuxFBClass, TransformedClass, VNCClass, MultiClass, VFbClass, DirectFBClass, SvgalibClass, ProxyClass, - GLClass, CustomClass = 1024 }; + GLClass, IntfbClass, CustomClass = 1024 }; QScreen(int display_id, ClassId classId); explicit QScreen(int display_id); @@ -358,6 +358,7 @@ private: friend class QLinuxFbScreen; friend class QVFbScreen; friend class QProxyScreen; + friend class QIntfbScreen; #endif friend void qt_solidFill_setup(QScreen*, const QColor&, const QRegion&); friend void qt_blit_setup(QScreen *screen, const QImage &image, diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp index c0ae214..ea194e5 100644 --- a/src/gui/embedded/qscreendriverfactory_qws.cpp +++ b/src/gui/embedded/qscreendriverfactory_qws.cpp @@ -48,6 +48,7 @@ #include "qscreenvfb_qws.h" #include "qscreenmulti_qws_p.h" #include "qscreenqnx_qws.h" +#include "qscreenintegrityfb_qws.h" #include <stdlib.h> #include "private/qfactoryloader_p.h" #include "qscreendriverplugin_qws.h" @@ -112,6 +113,10 @@ QScreen *QScreenDriverFactory::create(const QString& key, int displayId) if (driver == QLatin1String("qnx") || driver.isEmpty()) return new QQnxScreen(displayId); #endif +#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY) + if (driver == QLatin1String("integrityfb") || driver.isEmpty()) + return new QIntfbScreen(displayId); +#endif #ifndef QT_NO_QWS_QVFB if (driver == QLatin1String("qvfb") || driver.isEmpty()) return new QVFbScreen(displayId); @@ -159,6 +164,9 @@ QStringList QScreenDriverFactory::keys() #if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX) list << QLatin1String("QNX"); #endif +#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY) + list << QLatin1String("INTEGRITYFB"); +#endif #ifndef QT_NO_QWS_QVFB list << QLatin1String("QVFb"); #endif diff --git a/src/gui/embedded/qscreenintegrityfb_qws.cpp b/src/gui/embedded/qscreenintegrityfb_qws.cpp new file mode 100644 index 0000000..7b24490 --- /dev/null +++ b/src/gui/embedded/qscreenintegrityfb_qws.cpp @@ -0,0 +1,405 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef QT_NO_QWS_INTEGRITYFB + +#include <qscreenintegrityfb_qws.h> +#include <qwindowsystem_qws.h> +#include <qsocketnotifier.h> +#include <qapplication.h> +#include <qscreen_qws.h> +#include "qmouseintegrity_qws.h" +#include "qkbdintegrity_qws.h" +#include <qmousedriverfactory_qws.h> +#include <qkbddriverfactory_qws.h> +#include <qdebug.h> + +#include <INTEGRITY.h> +#include <device/fbdriver.h> + +QT_BEGIN_NAMESPACE + +class QIntfbScreenPrivate +{ +public: + QIntfbScreenPrivate(); + ~QIntfbScreenPrivate(); + + FBHandle handle; + struct FBInfoStruct fbinfo; + + QWSMouseHandler *mouse; +#ifndef QT_NO_QWS_KEYBOARD + QWSKeyboardHandler *keyboard; +#endif +}; + +QIntfbScreenPrivate::QIntfbScreenPrivate() + : mouse(0) + +{ +#ifndef QT_NO_QWS_KEYBOARD + keyboard = 0; +#endif +} + +QIntfbScreenPrivate::~QIntfbScreenPrivate() +{ + delete mouse; +#ifndef QT_NO_QWS_KEYBOARD + delete keyboard; +#endif +} + +/*! + \internal + + \class QIntfbScreen + \ingroup qws + + \brief The QIntfbScreen class implements a screen driver for the + INTEGRITY framebuffer drivers. + + Note that this class is only available in \l{Qt for INTEGRITY}. + Custom screen drivers can be added by subclassing the + QScreenDriverPlugin class, using the QScreenDriverFactory class to + dynamically load the driver into the application, but there should + only be one screen object per application. + + \sa QScreen, QScreenDriverPlugin, {Running Applications} +*/ + +/*! + \fn bool QIntfbScreen::connect(const QString & displaySpec) + \reimp +*/ + +/*! + \fn void QIntfbScreen::disconnect() + \reimp +*/ + +/*! + \fn bool QIntfbScreen::initDevice() + \reimp +*/ + +/*! + \fn void QIntfbScreen::restore() + \reimp +*/ + +/*! + \fn void QIntfbScreen::save() + \reimp +*/ + +/*! + \fn void QIntfbScreen::setDirty(const QRect & r) + \reimp +*/ + +/*! + \fn void QIntfbScreen::setMode(int nw, int nh, int nd) + \reimp +*/ + +/*! + \fn void QIntfbScreen::shutdownDevice() + \reimp +*/ + +/*! + \fn QIntfbScreen::QIntfbScreen(int displayId) + + Constructs a QVNCScreen object. The \a displayId argument + identifies the Qt for Embedded Linux server to connect to. +*/ +QIntfbScreen::QIntfbScreen(int display_id) + : QScreen(display_id, IntfbClass), d_ptr(new QIntfbScreenPrivate) +{ + d_ptr->handle = 0; + data = 0; +} + +/*! + Destroys this QIntfbScreen object. +*/ +QIntfbScreen::~QIntfbScreen() +{ + delete d_ptr; +} + +static QIntfbScreen *connected = 0; + +bool QIntfbScreen::connect(const QString &displaySpec) +{ + FBDriver *fbdev; + + CheckSuccess(gh_FB_get_driver(0, &fbdev)); + CheckSuccess(gh_FB_init_device(fbdev, 0, &d_ptr->handle)); + CheckSuccess(gh_FB_get_info(d_ptr->handle, &d_ptr->fbinfo)); + + data = (uchar *)d_ptr->fbinfo.start; + + d = d_ptr->fbinfo.bitsperpixel; + switch (d) { + case 1: + setPixelFormat(QImage::Format_Mono); + break; + case 8: + setPixelFormat(QImage::Format_Indexed8); + break; + case 12: + setPixelFormat(QImage::Format_RGB444); + break; + case 15: + setPixelFormat(QImage::Format_RGB555); + break; + case 16: + setPixelFormat(QImage::Format_RGB16); + break; + case 18: + setPixelFormat(QImage::Format_RGB666); + break; + case 24: + setPixelFormat(QImage::Format_RGB888); +#ifdef QT_QWS_DEPTH_GENERIC +#if Q_BYTE_ORDER != Q_BIG_ENDIAN + qt_set_generic_blit(this, 24, + d_ptr->fbinfo.redbits, + d_ptr->fbinfo.greenbits, + d_ptr->fbinfo.bluebits, + d_ptr->fbinfo.alphabits, + d_ptr->fbinfo.redoffset, + d_ptr->fbinfo.greenoffset, + d_ptr->fbinfo.blueoffset, + d_ptr->fbinfo.alphaoffset); +#else + qt_set_generic_blit(this, 24, + d_ptr->fbinfo.redbits, + d_ptr->fbinfo.greenbits, + d_ptr->fbinfo.bluebits, + d_ptr->fbinfo.alphabits, + 16 - d_ptr->fbinfo.redoffset, + 16 - d_ptr->fbinfo.greenoffset, + 16 - d_ptr->fbinfo.blueoffset, + d_ptr->fbinfo.alphaoffset); +#endif +#endif + break; + case 32: + setPixelFormat(QImage::Format_ARGB32_Premultiplied); +#ifdef QT_QWS_DEPTH_GENERIC +#if Q_BYTE_ORDER != Q_BIG_ENDIAN + qt_set_generic_blit(this, 32, + d_ptr->fbinfo.redbits, + d_ptr->fbinfo.greenbits, + d_ptr->fbinfo.bluebits, + d_ptr->fbinfo.alphabits, + d_ptr->fbinfo.redoffset, + d_ptr->fbinfo.greenoffset, + d_ptr->fbinfo.blueoffset, + d_ptr->fbinfo.alphaoffset); +#else + qt_set_generic_blit(this, 32, + d_ptr->fbinfo.redbits, + d_ptr->fbinfo.greenbits, + d_ptr->fbinfo.bluebits, + d_ptr->fbinfo.alphabits, + 24 - d_ptr->fbinfo.redoffset, + 24 - d_ptr->fbinfo.greenoffset, + 24 - d_ptr->fbinfo.blueoffset, + d_ptr->fbinfo.alphaoffset ? 24 - d_ptr->fbinfo.alphaoffset : 0); +#endif +#endif + break; + } + + dw = w = d_ptr->fbinfo.width; + dh = h = d_ptr->fbinfo.height; + + /* assumes no padding */ + lstep = w * ((d + 7) >> 3); + + mapsize = size = h * lstep; + + /* default values */ + int dpi = 72; + physWidth = qRound(dw * 25.4 / dpi); + physHeight = qRound(dh * 25.4 / dpi); + + qDebug("Connected to INTEGRITYfb server: %d x %d x %d %dx%dmm (%dx%ddpi)", + w, h, d, physWidth, physHeight, qRound(dw*25.4/physWidth), qRound(dh*25.4/physHeight) ); + + + QWSServer::setDefaultMouse("integrity"); + QWSServer::setDefaultKeyboard("integrity"); + + connected = this; + + return true; +} + +void QIntfbScreen::disconnect() +{ + connected = 0; +} + +bool QIntfbScreen::initDevice() +{ + + CheckSuccess(gh_FB_set_info(d_ptr->handle, &d_ptr->fbinfo, false)); + CheckSuccess(gh_FB_get_info(d_ptr->handle, &d_ptr->fbinfo)); + data = (uchar *)d_ptr->fbinfo.start; + d = d_ptr->fbinfo.bitsperpixel; + dw = w = d_ptr->fbinfo.width; + dh = h = d_ptr->fbinfo.height; + mapsize = d_ptr->fbinfo.length; + /* assumes no padding */ + lstep = w * ((d + 7) >> 3); + + mapsize = size = h * lstep; + + data = (uchar *)d_ptr->fbinfo.start; + + d = d_ptr->fbinfo.bitsperpixel; + switch (d) { + case 1: + setPixelFormat(QImage::Format_Mono); + break; + case 8: + setPixelFormat(QImage::Format_Indexed8); + break; + case 12: + setPixelFormat(QImage::Format_RGB444); + break; + case 15: + setPixelFormat(QImage::Format_RGB555); + break; + case 16: + setPixelFormat(QImage::Format_RGB16); + break; + case 18: + setPixelFormat(QImage::Format_RGB666); + break; + case 24: + setPixelFormat(QImage::Format_RGB888); + break; + case 32: + setPixelFormat(QImage::Format_ARGB32_Premultiplied); + break; + } +#ifdef QT_QWS_DEPTH_GENERIC +#if defined(__BIG_ENDIAN__) + qt_set_generic_blit(this, d, + d_ptr->fbinfo.redbits, + d_ptr->fbinfo.greenbits, + d_ptr->fbinfo.bluebits, + d_ptr->fbinfo.alphabits, + 24 - d_ptr->fbinfo.redoffset, + 24 - d_ptr->fbinfo.greenoffset, + 24 - d_ptr->fbinfo.blueoffset, + d_ptr->fbinfo.alphaoffset ? 24 - d_ptr->fbinfo.alphaoffset : 0); +#else + qt_set_generic_blit(this, d, + d_ptr->fbinfo.redbits, + d_ptr->fbinfo.greenbits, + d_ptr->fbinfo.bluebits, + d_ptr->fbinfo.alphabits, + d_ptr->fbinfo.redoffset, + d_ptr->fbinfo.greenoffset, + d_ptr->fbinfo.blueoffset, + d_ptr->fbinfo.alphaoffset); +#endif +#endif + +#ifndef QT_NO_QWS_CURSOR + QScreenCursor::initSoftwareCursor(); +#endif + return true; +} + +void QIntfbScreen::shutdownDevice() +{ + gh_FB_close(d_ptr->handle); +} + +void QIntfbScreen::setMode(int ,int ,int) +{ +} + +// save the state of the graphics card +// This is needed so that e.g. we can restore the palette when switching +// between linux virtual consoles. +void QIntfbScreen::save() +{ + // nothing to do. +} + +// restore the state of the graphics card. +void QIntfbScreen::restore() +{ +} +void QIntfbScreen::setDirty(const QRect& rect) +{ + FBRect fbrect; + fbrect.dx = rect.x(); + fbrect.dy = rect.y(); + fbrect.width = rect.width(); + fbrect.height = rect.height(); + gh_FB_expose(d_ptr->handle, &fbrect); +} + +void QIntfbScreen::setBrightness(int b) +{ + if (connected) { + } +} + +void QIntfbScreen::blank(bool on) +{ +} + +#endif // QT_NO_QWS_INTEGRITYFB + +QT_END_NAMESPACE + diff --git a/src/gui/embedded/qscreenintegrityfb_qws.h b/src/gui/embedded/qscreenintegrityfb_qws.h new file mode 100644 index 0000000..06b3967 --- /dev/null +++ b/src/gui/embedded/qscreenintegrityfb_qws.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** 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$ +** +****************************************************************************/ + +#ifndef QSCREENINTEGRITYFB_QWS_H +#define QSCREENINTEGRITYFB_QWS_H + +#include <QtGui/qscreen_qws.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_QWS_INTEGRITYFB + +class QIntfbScreenPrivate; + +class Q_GUI_EXPORT QIntfbScreen : public QScreen +{ +public: + explicit QIntfbScreen(int display_id); + virtual ~QIntfbScreen(); + virtual bool initDevice(); + virtual bool connect(const QString &displaySpec); + virtual void disconnect(); + virtual void shutdownDevice(); + virtual void save(); + virtual void restore(); + virtual void setMode(int nw,int nh,int nd); + virtual void setDirty(const QRect& r); + virtual void blank(bool); + static void setBrightness(int b); + +private: + QIntfbScreenPrivate *d_ptr; +}; + +#endif // QT_NO_QWS_INTEGRITYFB + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREENINTEGRITYFB_QWS_H diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index f0801e3..642d3e6 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -204,6 +204,11 @@ QString qws_dataDir() result = QT_VFB_DATADIR(qws_display_id); QByteArray dataDir = result.toLocal8Bit(); +#if defined(Q_OS_INTEGRITY) + /* ensure filesystem is ready before starting requests */ + WaitForFileSystemInitialization(); +#endif + if (QT_MKDIR(dataDir, 0700)) { if (errno != EEXIST) { qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData()); diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index e2b21c3..47387ab 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -209,8 +209,9 @@ private: { #ifdef Q_WS_QWS return tlw->frameGeometry(); -#endif +#else return tlw->data->crect; +#endif } inline void appendDirtyOnScreenWidget(QWidget *widget) diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index dc90003..10674f8 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -309,7 +309,7 @@ template <typename T> void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl, const uchar *src = srcPixels + y * sbpl; const uchar *srcEnd = src + srcOffset; while (src < srcEnd) { -#if defined(QT_ARCH_ARMV5) || defined(QT_ARCH_POWERPC) || defined(QT_ARCH_SH) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) || (defined(QT_ARCH_SPARC) && defined(Q_CC_GNU)) +#if defined(QT_ARCH_ARMV5) || defined(QT_ARCH_POWERPC) || defined(QT_ARCH_SH) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) || (defined(QT_ARCH_SPARC) && defined(Q_CC_GNU)) || (defined(QT_ARCH_INTEGRITY) && !defined(_X86_)) // non-16-bit aligned memory access is not possible on PowerPC, // ARM <v6 (QT_ARCH_ARMV5) & SH & AVR32 & SPARC w/GCC quint16 spix = (quint16(src[2])<<8) + src[1]; diff --git a/src/gui/styles/qstylesheetstyle_default.cpp b/src/gui/styles/qstylesheetstyle_default.cpp index 002dcff..76ffac8 100644 --- a/src/gui/styles/qstylesheetstyle_default.cpp +++ b/src/gui/styles/qstylesheetstyle_default.cpp @@ -151,7 +151,7 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const BasicSelector bSelector; Selector selector; Declaration decl; - Value value; + QCss::Value value; Pseudo pseudo; AttributeSelector attr; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 54ca7cc..052dc72 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -649,7 +649,7 @@ bool ValueExtractor::extractOutline(int *borders, QBrush *colors, BorderStyle *s return hit; } -static Qt::Alignment parseAlignment(const Value *values, int count) +static Qt::Alignment parseAlignment(const QCss::Value *values, int count) { Qt::Alignment a[2] = { 0, 0 }; for (int i = 0; i < qMin(2, count); i++) { @@ -672,7 +672,7 @@ static Qt::Alignment parseAlignment(const Value *values, int count) return a[0] | a[1]; } -static ColorData parseColorValue(Value v) +static ColorData parseColorValue(QCss::Value v) { if (v.type == Value::Identifier || v.type == Value::String) { v.variant.convert(QVariant::Color); @@ -706,7 +706,7 @@ static ColorData parseColorValue(Value v) if (!p.testExpr()) return ColorData(); - QVector<Value> colorDigits; + QVector<QCss::Value> colorDigits; if (!p.parseExpr(&colorDigits)) return ColorData(); @@ -738,7 +738,7 @@ static QColor colorFromData(const ColorData& c, const QPalette &pal) return QColor(); } -static BrushData parseBrushValue(const Value &v, const QPalette &pal) +static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal) { ColorData c = parseColorValue(v); if (c.type == ColorData::Color) { @@ -780,7 +780,7 @@ static BrushData parseBrushValue(const Value &v, const QPalette &pal) return BrushData(); parser.skipSpace(); if (attr.compare(QLatin1String("stop"), Qt::CaseInsensitive) == 0) { - Value stop, color; + QCss::Value stop, color; parser.next(); if (!parser.parseTerm(&stop)) return BrushData(); parser.skipSpace(); @@ -792,7 +792,7 @@ static BrushData parseBrushValue(const Value &v, const QPalette &pal) stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal))); } else { parser.next(); - Value value; + QCss::Value value; (void)parser.parseTerm(&value); if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) { spread = spreads.indexOf(value.variant.toString()); @@ -856,7 +856,7 @@ static QBrush brushFromData(const BrushData& c, const QPalette &pal) } } -static BorderStyle parseStyleValue(Value v) +static BorderStyle parseStyleValue(QCss::Value v) { if (v.type == Value::KnownIdentifier) { switch (v.variant.toInt()) { @@ -941,7 +941,7 @@ void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::Bord decl.d->parsed = QVariant::fromValue<BorderData>(data); } -static void parseShorthandBackgroundProperty(const QVector<Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal) +static void parseShorthandBackgroundProperty(const QVector<QCss::Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal) { *brush = BrushData(); *image = QString(); @@ -949,7 +949,7 @@ static void parseShorthandBackgroundProperty(const QVector<Value> &values, Brush *alignment = Qt::AlignTop | Qt::AlignLeft; for (int i = 0; i < values.count(); ++i) { - const Value &v = values.at(i); + const QCss::Value &v = values.at(i); if (v.type == Value::Uri) { *image = v.variant.toString(); continue; @@ -996,7 +996,7 @@ bool ValueExtractor::extractBackground(QBrush *brush, QString *image, Repeat *re const Declaration &decl = declarations.at(i); if (decl.d->values.isEmpty()) continue; - const Value &val = decl.d->values.at(0); + const QCss::Value &val = decl.d->values.at(0); switch (decl.d->propertyId) { case BackgroundColor: *brush = decl.brushValue(); @@ -1050,7 +1050,7 @@ bool ValueExtractor::extractBackground(QBrush *brush, QString *image, Repeat *re return hit; } -static bool setFontSizeFromValue(Value value, QFont *font, int *fontSizeAdjustment) +static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAdjustment) { if (value.type == Value::KnownIdentifier) { bool valid = true; @@ -1087,7 +1087,7 @@ static bool setFontSizeFromValue(Value value, QFont *font, int *fontSizeAdjustme return valid; } -static bool setFontStyleFromValue(const Value &value, QFont *font) +static bool setFontStyleFromValue(const QCss::Value &value, QFont *font) { if (value.type != Value::KnownIdentifier) return false ; @@ -1100,7 +1100,7 @@ static bool setFontStyleFromValue(const Value &value, QFont *font) return false; } -static bool setFontWeightFromValue(const Value &value, QFont *font) +static bool setFontWeightFromValue(const QCss::Value &value, QFont *font) { if (value.type == Value::KnownIdentifier) { switch (value.variant.toInt()) { @@ -1121,12 +1121,12 @@ static bool setFontWeightFromValue(const Value &value, QFont *font) * and set it the \a font * \returns true if a family was extracted. */ -static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font, int start = 0) +static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *font, int start = 0) { QString family; bool shouldAddSpace = false; for (int i = start; i < values.count(); ++i) { - const Value &v = values.at(i); + const QCss::Value &v = values.at(i); if (v.type == Value::TermOperatorComma) { family += QLatin1Char(','); shouldAddSpace = false; @@ -1146,7 +1146,7 @@ static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font, i return true; } -static void setTextDecorationFromValues(const QVector<Value> &values, QFont *font) +static void setTextDecorationFromValues(const QVector<QCss::Value> &values, QFont *font) { for (int i = 0; i < values.count(); ++i) { if (values.at(i).type != Value::KnownIdentifier) @@ -1165,7 +1165,7 @@ static void setTextDecorationFromValues(const QVector<Value> &values, QFont *fon } } -static void parseShorthandFontProperty(const QVector<Value> &values, QFont *font, int *fontSizeAdjustment) +static void parseShorthandFontProperty(const QVector<QCss::Value> &values, QFont *font, int *fontSizeAdjustment) { font->setStyle(QFont::StyleNormal); font->setWeight(QFont::Normal); @@ -1190,7 +1190,7 @@ static void parseShorthandFontProperty(const QVector<Value> &values, QFont *font } } -static void setFontVariantFromValue(const Value &value, QFont *font) +static void setFontVariantFromValue(const QCss::Value &value, QFont *font) { if (value.type == Value::KnownIdentifier) { switch (value.variant.toInt()) { @@ -1201,7 +1201,7 @@ static void setFontVariantFromValue(const Value &value, QFont *font) } } -static void setTextTransformFromValue(const Value &value, QFont *font) +static void setTextTransformFromValue(const QCss::Value &value, QFont *font) { if (value.type == Value::KnownIdentifier) { switch (value.variant.toInt()) { @@ -1226,7 +1226,7 @@ bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment) const Declaration &decl = declarations.at(i); if (decl.d->values.isEmpty()) continue; - const Value &val = decl.d->values.at(0); + const QCss::Value &val = decl.d->values.at(0); switch (decl.d->propertyId) { case FontSize: setFontSizeFromValue(val, font, fontSizeAdjustment); break; case FontStyle: setFontStyleFromValue(val, font); break; @@ -1411,7 +1411,7 @@ bool Declaration::realValue(qreal *real, const char *unit) const return ok; } -static bool intValueHelper(const Value &v, int *i, const char *unit) +static bool intValueHelper(const QCss::Value &v, int *i, const char *unit) { if (unit && v.type != Value::Length) return false; @@ -1460,7 +1460,7 @@ QRect Declaration::rectValue() const if (d->parsed.isValid()) return qvariant_cast<QRect>(d->parsed); - const Value &v = d->values.at(0); + const QCss::Value &v = d->values.at(0); if (v.type != Value::Function) return QRect(); QStringList func = v.variant.toStringList(); diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 79c46b3..86bafc9 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -71,6 +71,9 @@ #if defined(Q_OS_VXWORKS) && defined(NONE) # undef NONE #endif +#if defined(Q_OS_INTEGRITY) +# undef Value +#endif QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 4802b94..b71c4a7 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -288,13 +288,16 @@ private: #else void readNode(QIODevice& f) { - uchar rw = f.getch(); - uchar cl = f.getch(); + char rw; + char cl; + f.getChar(&rw); + f.getChar(&cl); min = (rw << 8) | cl; - rw = f.getch(); - cl = f.getch(); + f.getChar(&rw); + f.getChar(&cl); max = (rw << 8) | cl; - int flags = f.getch(); + char flags; + f.getChar(&flags); if ( flags & 1 ) less = new QPFGlyphTree; else @@ -332,7 +335,7 @@ private: int n = max-min+1; for (int i=0; i<n; i++) { glyph[i].metrics = new QPFGlyphMetrics; - f.readBlock((char*)glyph[i].metrics, sizeof(QPFGlyphMetrics)); + f.read((char*)glyph[i].metrics, sizeof(QPFGlyphMetrics)); } if ( less ) less->readMetrics(f); @@ -365,7 +368,7 @@ private: //############### s = qt_screen->mapToDevice( s ); uint datasize = glyph[i].metrics->linestep * s.height(); glyph[i].data = new uchar[datasize]; // ### deleted? - f.readBlock((char*)glyph[i].data, datasize); + f.read((char*)glyph[i].data, datasize); } if ( less ) less->readData(f); @@ -385,6 +388,32 @@ public: size_t mmapLength; }; +#if defined(Q_OS_INTEGRITY) +static void *qt_mmap(void *start, size_t length, int /*prot*/, int /*flags*/, int fd, off_t offset) +{ + // INTEGRITY cannot mmap local files - load it into a local buffer + if (::lseek(fd, offset, SEEK_SET) == -1) { +# if defined(DEBUG_FONTENGINE) + perror("lseek failed"); +# endif + } + void *buf = malloc(length); + if (::read(fd, buf, length) != (ssize_t)length) { +# if defined(DEBUG_FONTENGINE) + perror("read failed"); +# endif + } + + return buf; +} +#else +static inline void *qt_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) +{ + return mmap(start, length, prot, flags, fd, offset); +} +#endif + + QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) { @@ -395,16 +424,18 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) QT_STATBUF st; if ( QT_FSTAT( f, &st ) ) qFatal("Failed to stat %s",QFile::encodeName(fn).data()); - uchar* data = (uchar*)mmap( 0, // any address + uchar* data = (uchar*)qt_mmap( 0, // any address st.st_size, // whole file PROT_READ, // read-only memory -#if !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) +#if defined(Q_OS_INTEGRITY) + 0, +#elif !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_VXWORKS) MAP_FILE | MAP_PRIVATE, // swap-backed map from file #else MAP_PRIVATE, #endif f, 0 ); // from offset 0 of f -#if defined(Q_OS_QNX4) && !defined(MAP_FAILED) +#if !defined(MAP_FAILED) && (defined(Q_OS_QNX4) || defined(Q_OS_INTEGRITY)) #define MAP_FAILED ((void *)-1) #endif if ( !data || data == (uchar*)MAP_FAILED ) diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index d35f0ce..2040b01 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -404,7 +404,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) // ### verify that QFile uses the fd size and not the file name qint64 size = file->size() - file->pos(); const uchar *p = 0; -#ifndef Q_OS_WINCE +#if !defined(Q_OS_WINCE) && !defined(Q_OS_INTEGRITY) p = file->map(file->pos(), size); #endif if (p) { diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 66e87c9..bd3e6ec 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -23,6 +23,7 @@ SOURCES += kernel/qauthenticator.cpp \ symbian: SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_symbian.cpp unix:!symbian:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp win32:SOURCES += kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp +integrity:SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp mac:LIBS_PRIVATE += -framework SystemConfiguration -framework CoreFoundation mac:SOURCES += kernel/qnetworkproxy_mac.cpp diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 8fa4b92..9a2b0ba 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -346,7 +346,7 @@ QLocalSocket::QLocalSocket(QObject * parent) QLocalSocket::~QLocalSocket() { close(); -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP) Q_D(QLocalSocket); d->unixSocket.setParent(0); #endif diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index 2bafe13..3ccc8e0 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -43,3 +43,13 @@ wince*: { DEFINES += QT_LOCALSOCKET_TCP } + +integrity: { + SOURCES -= socket/qlocalsocket_unix.cpp \ + socket/qlocalserver_unix.cpp + SOURCES += socket/qlocalsocket_tcp.cpp \ + socket/qlocalserver_tcp.cpp \ + socket/qnativesocketengine_unix.cpp + + DEFINES += QT_LOCALSOCKET_TCP +} diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp index 31af9a0..c0e2656 100644 --- a/src/script/api/qscriptprogram.cpp +++ b/src/script/api/qscriptprogram.cpp @@ -27,6 +27,7 @@ #include "qscriptengine.h" #include "qscriptengine_p.h" +#include "SamplingTool.h" #include "Executable.h" QT_BEGIN_NAMESPACE diff --git a/src/script/script.pro b/src/script/script.pro index 162eb9c..ce5c778 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -101,5 +101,9 @@ symbian { QMAKE_CXXFLAGS.ARMCC += -OTime -O3 } +integrity { + CFLAGS += --diag_remark=236,82 +} + # WebKit doesn't compile in C++0x mode *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 22d59f9..287d8e6 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1659,6 +1659,14 @@ private: void FatalSignalHandler::signal(int signum) { qFatal("Received signal %d", signum); +#if defined(Q_OS_INTEGRITY) + { + struct sigaction act; + memset(&act, 0, sizeof(struct sigaction)); + act.sa_handler = SIG_DFL; + sigaction(signum, &act, NULL); + } +#endif } FatalSignalHandler::FatalSignalHandler() @@ -1673,8 +1681,9 @@ FatalSignalHandler::FatalSignalHandler() act.sa_handler = FatalSignalHandler::signal; // Remove the handler after it is invoked. +#if !defined(Q_OS_INTEGRITY) act.sa_flags = SA_RESETHAND; - +#endif // Block all fatal signals in our signal handler so we don't try to close // the testlog twice. sigemptyset(&act.sa_mask); diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 1ecb7e5..ecff105 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -111,6 +111,7 @@ void error(const char *msg = "Invalid argument") " -i do not generate an #include statement\n" " -p<path> path prefix for included file\n" " -f[<file>] force #include, optional file name\n" + " -nn do not display notes\n" " -nw do not display warnings\n" " @<file> read additional options from file\n" " -v display version of moc\n"); @@ -333,9 +334,12 @@ int runMoc(int _argc, char **_argv) case 'n': // don't display warnings if (ignoreConflictingOptions) break; - if (opt != "nw") + if (opt == "nw") + moc.displayWarnings = moc.displayNotes = false; + else if (opt == "nn") + moc.displayNotes = false; + else error(); - moc.displayWarnings = false; break; case 'h': // help if (more && opt != "help") @@ -425,7 +429,7 @@ int runMoc(int _argc, char **_argv) fprintf(out, "%s\n", composePreprocessorOutput(moc.symbols).constData()); } else { if (moc.classList.isEmpty()) - moc.warning("No relevant classes found. No output generated."); + moc.note("No relevant classes found. No output generated."); else moc.generate(out); } diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index 1fa1401..b6f0837 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -78,4 +78,10 @@ void Parser::warning(const char *msg) { currentFilenames.top().constData(), qMax(0, index > 0 ? symbol().lineNum : 0), msg); } +void Parser::note(const char *msg) { + if (displayNotes && msg) + fprintf(stderr, ErrorFormatString "Note: %s\n", + currentFilenames.top().constData(), qMax(0, index > 0 ? symbol().lineNum : 0), msg); +} + QT_END_NAMESPACE diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h index 8356449..a874248 100644 --- a/src/tools/moc/parser.h +++ b/src/tools/moc/parser.h @@ -50,10 +50,11 @@ QT_BEGIN_NAMESPACE class Parser { public: - Parser():index(0), displayWarnings(true){} + Parser():index(0), displayWarnings(true), displayNotes(true) {} Symbols symbols; int index; bool displayWarnings; + bool displayNotes; QStack<QByteArray> currentFilenames; @@ -73,6 +74,7 @@ public: void error(int rollback); void error(const char *msg = 0); void warning(const char * = 0); + void note(const char * = 0); }; diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 20fade1..56a3107 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -494,6 +494,10 @@ private slots: void QTBUG12260_defaultTemplate(); void notifyError(); void revisions(); + void warnings_data(); + void warnings(); + + signals: void sigWithUnsignedArg(unsigned foo); void sigWithSignedArg(signed foo); @@ -1498,8 +1502,126 @@ void tst_Moc::revisions() revisions_T<VersionTestNotify>(); } -QTEST_APPLESS_MAIN(tst_Moc) -#include "tst_moc.moc" +void tst_Moc::warnings_data() +{ + QTest::addColumn<QByteArray>("input"); + QTest::addColumn<QStringList>("args"); + QTest::addColumn<int>("exitCode"); + QTest::addColumn<QString>("expectedStdOut"); + QTest::addColumn<QString>("expectedStdErr"); + + // empty input should result in "no relevant classes" note + QTest::newRow("No relevant classes") + << QByteArray(" ") + << QStringList() + << 0 + << QString() + << QString("standard input:0: Note: No relevant classes found. No output generated."); + + // passing "-nn" should suppress "no relevant classes" note + QTest::newRow("-nn") + << QByteArray(" ") + << (QStringList() << "-nn") + << 0 + << QString() + << QString(); + + // passing "-nw" should also suppress "no relevant classes" note + QTest::newRow("-nw") + << QByteArray(" ") + << (QStringList() << "-nw") + << 0 + << QString() + << QString(); + + // This should output a warning + QTest::newRow("Invalid property warning") + << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };") + << QStringList() + << 0 + << QString("IGNORE_ALL_STDOUT") + << QString("standard input:1: Warning: Property declaration x has no READ accessor function. The property will be invalid."); + + // Passing "-nn" should NOT suppress the warning + QTest::newRow("Invalid property warning") + << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };") + << (QStringList() << "-nn") + << 0 + << QString("IGNORE_ALL_STDOUT") + << QString("standard input:1: Warning: Property declaration x has no READ accessor function. The property will be invalid."); + + // Passing "-nw" should suppress the warning + QTest::newRow("Invalid property warning") + << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };") + << (QStringList() << "-nw") + << 0 + << QString("IGNORE_ALL_STDOUT") + << QString(); + + // This should output an error + QTest::newRow("Does not inherit QObject") + << QByteArray("class X { Q_OBJECT };") + << QStringList() + << 1 + << QString() + << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); + + // "-nn" should not suppress the error + QTest::newRow("Does not inherit QObject with -nn") + << QByteArray("class X { Q_OBJECT };") + << (QStringList() << "-nn") + << 1 + << QString() + << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); + + // "-nw" should not suppress the error + QTest::newRow("Does not inherit QObject with -nn") + << QByteArray("class X { Q_OBJECT };") + << (QStringList() << "-nw") + << 1 + << QString() + << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject"); +} + +void tst_Moc::warnings() +{ +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled", SkipAll); +#endif + QFETCH(QByteArray, input); + QFETCH(QStringList, args); + QFETCH(int, exitCode); + QFETCH(QString, expectedStdOut); + QFETCH(QString, expectedStdErr); + +#ifdef Q_CC_MSVC + // for some reasons, moc compiled with MSVC uses a different output format + QRegExp lineNumberRe(":(\\d+):"); + lineNumberRe.setMinimal(true); + expectedStdErr.replace(lineNumberRe, "(\\1):"); +#endif + QProcess proc; + proc.start("moc", args); + QVERIFY(proc.waitForStarted()); + + QCOMPARE(proc.write(input), qint64(input.size())); + + proc.closeWriteChannel(); + + QVERIFY(proc.waitForFinished()); + + QCOMPARE(proc.exitCode(), exitCode); + QCOMPARE(proc.exitStatus(), QProcess::NormalExit); + + // magic value "IGNORE_ALL_STDOUT" ignores stdout + if (expectedStdOut != "IGNORE_ALL_STDOUT") + QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardOutput()).trimmed(), expectedStdOut); + QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed(), expectedStdErr); + + } + +QTEST_APPLESS_MAIN(tst_Moc) +#include "tst_moc.moc" diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp index c05bbac..7840974 100644 --- a/tests/auto/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/qclipboard/tst_qclipboard.cpp @@ -205,7 +205,7 @@ void tst_QClipboard::testSignals() void tst_QClipboard::copy_exit_paste() { #ifndef QT_NO_PROCESS -#if defined Q_WS_X11 || defined Q_WS_QWS +#if defined Q_WS_X11 || defined Q_WS_QWS || defined (Q_WS_QPA) QSKIP("This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits ", SkipAll); // ### It's still possible to test copy/paste - just keep the apps running #elif defined (Q_OS_SYMBIAN) && defined (Q_CC_NOKIAX86) diff --git a/tools/designer/src/components/propertyeditor/propertyeditor.cpp b/tools/designer/src/components/propertyeditor/propertyeditor.cpp index 521b5cb..9f298d0 100644 --- a/tools/designer/src/components/propertyeditor/propertyeditor.cpp +++ b/tools/designer/src/components/propertyeditor/propertyeditor.cpp @@ -91,6 +91,7 @@ static const char *ViewKeyC = "View"; static const char *ColorKeyC = "Colored"; static const char *SortedKeyC = "Sorted"; static const char *ExpansionKeyC = "ExpandedItems"; +static const char *SplitterPositionKeyC = "SplitterPosition"; enum SettingsView { TreeView, ButtonView }; @@ -365,10 +366,12 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare m_sorting = settings->value(QLatin1String(SortedKeyC), false).toBool(); m_coloring = settings->value(QLatin1String(ColorKeyC), true).toBool(); const QVariantMap expansionState = settings->value(QLatin1String(ExpansionKeyC), QVariantMap()).toMap(); + const int splitterPosition = settings->value(QLatin1String(SplitterPositionKeyC), 150).toInt(); settings->endGroup(); // Apply settings m_sortingAction->setChecked(m_sorting); m_coloringAction->setChecked(m_coloring); + m_treeBrowser->setSplitterPosition(splitterPosition); #if QT_VERSION >= 0x040500 switch (view) { case TreeView: @@ -415,6 +418,7 @@ void PropertyEditor::saveSettings() const expansionState.insert(it.key(), QVariant(it.value())); } settings->setValue(QLatin1String(ExpansionKeyC), expansionState); + settings->setValue(QLatin1String(SplitterPositionKeyC), m_treeBrowser->splitterPosition()); settings->endGroup(); } diff --git a/util/integrity/qt.bod b/util/integrity/qt.bod new file mode 100644 index 0000000..bdf50ce --- /dev/null +++ b/util/integrity/qt.bod @@ -0,0 +1,111 @@ +CommandOptions { + MOCCommandOptions { + MOCOutput { + { + name="-o" + } + delimiter="Space" + merge="Replace" + #flags={"OUTPUTNAME"} + } + MOCDefines { + { + name="-D" + } + delimiter="Touching" + merge="Concat" + } + MOCIncludes { + { + name="-I" + } + delimiter="Touching" + merge="Concat" + flags={"RELATIVEPATH"} + } + } + UICommandOptions { + UIOutput { + { + name="-o" + } + delimiter="Space" + merge="Replace" + flags={"OUTPUTNAME"} + } + } + RCCCommandOptions { + RCCOutput { + { + name="-o" + } + delimiter="Space" + merge="Replace" + flags={"OUTPUTNAME"} + } + RCCName { + { + name="-name" + } + delimiter="Space" + merge="Replace" + } + } +} + +Commands { + MOCPreprocessor { + name="MOCPreprocessor" + exec="${QT_BUILD_DIR}/bin/moc" + options={ "MOCCommandOptions", "SpecialOptions" } + } + UIPreprocessor { + name="UIPreprocessor" + exec="${QT_BUILD_DIR}/bin/uic" + options={ "UICommandOptions" } + } + RCCPreprocessor { + name="RCCPreprocessor" + exec="${QT_BUILD_DIR}/bin/rcc" + options={ "RCCCommandOptions" } + } +} + +FileTypes { + MocCPP { + name="MOC/Qt Header" + outputExtension="time" + outputType="SourceFile" + command="MOCPreprocessor" + commandLine="${QT_BUILD_DIR}/bin/moc -nn $OPTIONS $INPUTFILE" + progress="MOCing" + extraFiles="$(OUTPUTDIR)/moc_$(OUTPUTNAMEBASE).cpp" + #postExecSafe={"${GHS_TOOLS_DIR}/filechanged work/$(OUTPUTNAME)"} + color="#0020a0" + grepable=true + } + RCC { + name="Qt Resource" + outputExtension="time" + #extensions={"qrc"} + outputType="SourceFile" + command="RCCPreprocessor" + commandLine="${QT_BUILD_DIR}/bin/rcc $OPTIONS $INPUTFILE" + extraFiles="$(OUTPUTDIR)/qrc_$(OUTPUTNAMEBASE).cpp" + progress="Generating Resource source from" + action="Generate Resource source for" + grepable=true + } + UI { + name="Qt Dialog" + outputExtension="time" + #extensions={"ui"} + outputType="SourceFile" + command="UIPreprocessor" + commandLine="${QT_BUILD_DIR}/bin/uic $OPTIONS $INPUTFILE" + extraFiles="$(OUTPUTDIR)/ui_$(OUTPUTNAMEBASE).cpp" + progress="Generating Dialog source from" + action="Generate Dialog source for" + grepable=true + } +} |