diff options
662 files changed, 13775 insertions, 10958 deletions
diff --git a/config.tests/.qmake.conf b/config.tests/.qmake.conf new file mode 100644 index 0000000000..71e6817656 --- /dev/null +++ b/config.tests/.qmake.conf @@ -0,0 +1,6 @@ +mingw { + TMPPATH = $$(INCLUDE) + QMAKE_INCDIR_POST += $$split(TMPPATH, $$QMAKE_DIRLIST_SEP) + TMPPATH = $$(LIB) + QMAKE_LIBDIR_POST += $$split(TMPPATH, $$QMAKE_DIRLIST_SEP) +} diff --git a/config.tests/unix/gstreamer/gstreamer.pro b/config.tests/unix/gstreamer/gstreamer.pro deleted file mode 100644 index 7d4aa8e2e5..0000000000 --- a/config.tests/unix/gstreamer/gstreamer.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = gstreamer.cpp -CONFIG -= qt -LIBS += -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 diff --git a/config.tests/unix/icu/icu.pro b/config.tests/unix/icu/icu.pro index 002c4840d5..2c1b431f92 100644 --- a/config.tests/unix/icu/icu.pro +++ b/config.tests/unix/icu/icu.pro @@ -1,4 +1,16 @@ SOURCES = icu.cpp +CONFIG += console CONFIG -= qt dylib -unix:LIBS += -licuuc -licui18n -win32:LIBS += -licuin +win32 { + CONFIG(static, static|shared) { + CONFIG(debug, debug|release) { + LIBS += -lsicuind -lsicuucd -lsicudtd + } else { + LIBS += -lsicuin -lsicuuc -lsicudt + } + } else { + LIBS += -licuin -licuuc + } +} else { + LIBS += -licui18n -licuuc +} diff --git a/config.tests/unix/makeabs b/config.tests/unix/makeabs index 4df26f769f..d2f65d19e9 100755 --- a/config.tests/unix/makeabs +++ b/config.tests/unix/makeabs @@ -15,13 +15,13 @@ elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then true else RES="$PWD/$FILE" - test -d "$RES" && RES="$RES/" - RES=`echo "$RES" | sed "s,/\(\./\)*,/,g"` - -# note: this will only strip 1 /path/../ from RES, i.e. given /a/b/c/../../../, it returns /a/b/../../ - RES=`echo "$RES" | sed "s,\(/[^/]*/\)\.\./,/,g"` - - RES=`echo "$RES" | sed "s,//,/,g" | sed "s,/$,,"` fi +RES=$RES/ +while true; do + nres=`echo "$RES" | sed "s,/[^/][^/]*/\.\./,/,g; s,/\./,/,g"` + test x"$nres" = x"$RES" && break + RES=$nres +done +RES=`echo "$RES" | sed "s,//,/,g; s,/$,,"` echo $RES #return diff --git a/src/gui/accessible/qaccessible2_p.h b/config.tests/unix/pps/pps.cpp index bb5ddf6edf..3f00509973 100644 --- a/src/gui/accessible/qaccessible2_p.h +++ b/config.tests/unix/pps/pps.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. ** Contact: http://www.qt-project.org/legal ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the config.tests of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -39,7 +39,12 @@ ** ****************************************************************************/ -#ifndef QACCESSIBLE2_H -#define QACCESSIBLE2_H +#include <sys/pps.h> -#endif +int main(int, char **) +{ + pps_decoder_t decoder; + + pps_decoder_initialize(&decoder, NULL); + return 0; +} diff --git a/config.tests/unix/pps/pps.pro b/config.tests/unix/pps/pps.pro new file mode 100644 index 0000000000..21bdeedbfb --- /dev/null +++ b/config.tests/unix/pps/pps.pro @@ -0,0 +1,3 @@ +SOURCES = pps.cpp +CONFIG -= qt +LIBS += -lpps @@ -53,12 +53,38 @@ relpath=`(cd "$relpath"; /bin/pwd)` # the current directory is the "build tree" or "object tree" outpath=`/bin/pwd` -#license file location -LICENSE_FILE="$QT_LICENSE_FILE" -[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license" -if [ -f "$LICENSE_FILE" ]; then - tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp" - diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp" +# where to find which.. +unixtests="$relpath/config.tests/unix" +mactests="$relpath/config.tests/mac" +WHICH="$unixtests/which.test" + +PERL=`$WHICH perl 2>/dev/null` + +# find out which awk we want to use, prefer gawk, then nawk, then regular awk +AWK= +for e in gawk nawk awk; do + if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then + AWK=$e + break + fi +done + +# find a make command +if [ -z "$MAKE" ]; then + MAKE= + for mk in gmake make; do + if "$WHICH" $mk >/dev/null 2>&1; then + MAKE=`"$WHICH" $mk` + break + fi + done + if [ -z "$MAKE" ]; then + echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH." + echo >&2 "Cannot proceed." + exit 1 + fi + # export MAKE, we need it later in the config.tests + export MAKE fi # do this early so we don't store it in config.status @@ -93,6 +119,13 @@ shellEscape() echo "$@" | sed 's/ /\ /g' } +shellQuoteLines() +{ + # The call of the outer echo makes the shell word-split the output of + # the nested pipe, thus effectively converting newlines to spaces. + echo `echo "$1" | sed 's,^[^ ]* .*$,"&",'` +} + # Adds a new qmake variable to the cache # Usage: QMakeVar mode varname contents # where mode is one of: set, add, del @@ -295,7 +328,7 @@ getXQMakeConf() { if [ -z "$xspecvals" ]; then xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" | extractQMakeVariables "!host_build"` - if [ "$BUILD_ON_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi + if [ "$XPLATFORM_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi fi getSingleQMakeVariable "$1" "$xspecvals" } @@ -450,10 +483,8 @@ fi #------------------------------------------------------------------------------- BUILD_ON_MAC=no -PLATFORM_MAC=no if [ -d /System/Library/Frameworks/Carbon.framework ]; then BUILD_ON_MAC=yes - PLATFORM_MAC=maybe fi BUILD_ON_MSYS=no HOST_DIRLIST_SEP=":" @@ -514,315 +545,6 @@ if [ -z "$QT_MAJOR_VERSION" ]; then fi #------------------------------------------------------------------------------- -# check the license -#------------------------------------------------------------------------------- -COMMERCIAL_USER=ask -CFG_DEV=no -CFG_RTOS_ENABLED=yes -EditionString=Commercial - -earlyArgParse() -{ - # parse the arguments, setting things to "yes" or "no" - while [ "$#" -gt 0 ]; do - CURRENT_OPT="$1" - UNKNOWN_ARG=no - case "$1" in - #Autoconf style options - --enable-*) - VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"` - VAL=yes - ;; - --disable-*) - VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"` - VAL=no - ;; - --*=*) - VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"` - VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"` - ;; - --no-*) - VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"` - VAL=no - ;; - -h|help|--help|-help) - if [ "$VAL" = "yes" ]; then - OPT_HELP="$VAL" - COMMERCIAL_USER="no" #doesn't matter we will display the help - else - UNKNOWN_OPT=yes - COMMERCIAL_USER="no" #doesn't matter we will display the help - fi - ;; - --*) - VAR=`echo $1 | sed "s,^--\(.*\),\1,"` - VAL=yes - ;; - -*) - VAR=`echo $1 | sed "s,^-\(.*\),\1,"` - VAL="unknown" - ;; - *) - UNKNOWN_ARG=yes - ;; - esac - if [ "$UNKNOWN_ARG" = "yes" ]; then - shift - continue - fi - shift - - UNKNOWN_OPT=no - case "$VAR" in - developer-build) - CFG_DEV="yes" - ;; - commercial) - COMMERCIAL_USER="yes" - ;; - opensource) - COMMERCIAL_USER="no" - ;; - *) - UNKNOWN_OPT=yes - ;; - esac - done -} - -earlyArgParse "$@" - -if [ "$COMMERCIAL_USER" = "ask" ]; then - while true; do - echo "Which edition of Qt do you want to use ?" - echo - echo "Type 'c' if you want to use the Commercial Edition." - echo "Type 'o' if you want to use the Open Source Edition." - echo - read commercial - echo - if [ "$commercial" = "c" ]; then - COMMERCIAL_USER="yes" - break - elif [ "$commercial" = "o" ]; then - COMMERCIAL_USER="no" - break - fi - done -fi - -if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then - # Commercial preview release - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - Licensee="Preview" - Edition="Preview" - QT_EDITION="QT_EDITION_DESKTOP" - LicenseType="Technology Preview" -elif [ $COMMERCIAL_USER = "yes" ]; then - # one of commercial editions - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - - # read in the license file - if [ -f "$LICENSE_FILE" ]; then - . "$LICENSE_FILE" >/dev/null 2>&1 - if [ -z "$LicenseKeyExt" ]; then - echo - echo "You are using an old license file." - echo - echo "Please install the license file supplied by Digia," - echo "or install the Qt Open Source Edition if you intend to" - echo "develop free software." - exit 1 - fi - if [ -z "$Licensee" ]; then - echo - echo "Invalid license key. Please check the license key." - exit 1 - fi - else - if [ -z "$LicenseKeyExt" ]; then - echo - echo $ECHO_N "Please enter your license key: $ECHO_C" - read LicenseKeyExt - Licensee="Unknown user" - fi - fi - - # Key verification - echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \ - && LicenseValid="yes" \ - || LicenseValid="no" - if [ "$LicenseValid" != "yes" ]; then - echo - echo "Invalid license key. Please check the license key." - exit 1 - fi - ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` - PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -` - LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -` - LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1` - - # determine which edition we are licensed to use - case "$LicenseTypeCode" in - F4M) - LicenseType="Commercial" - case $ProductCode in - F) - Edition="Universal" - QT_EDITION="QT_EDITION_UNIVERSAL" - ;; - B) - Edition="FullFramework" - EditionString="Full Framework" - QT_EDITION="QT_EDITION_DESKTOP" - ;; - L) - Edition="GUIFramework" - EditionString="GUI Framework" - QT_EDITION="QT_EDITION_DESKTOPLIGHT" - ;; - esac - ;; - Z4M|R4M|Q4M) - LicenseType="Evaluation" - QMakeVar add DEFINES QT_EVAL - case $ProductCode in - B) - Edition="Evaluation" - QT_EDITION="QT_EDITION_EVALUATION" - ;; - esac - ;; - esac - if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then - echo - echo "Invalid license key. Please check the license key." - exit 1 - fi - - # verify that we are licensed to use Qt on this platform - LICENSE_EXTENSION= - case "$PlatformCode" in - *L) - CFG_RTOS_ENABLED=yes - PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'` - ;; - *) - CFG_RTOS_ENABLED=no - PlatformCode=`echo "$PlatformCode" | sed 's/.$//'` - ;; - esac - ### EMBEDDED_QPA logic missing ### - case "$PlatformCode,$PLATFORM_MAC" in - X9,* | XC,* | XU,* | XW,* | XM,*) - # Qt All-OS - LICENSE_EXTENSION="-ALLOS" - ;; - 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) - # Qt for Embedded Linux - LICENSE_EXTENSION="-EMBEDDED" - ;; - 6M,* | N7,* | N9,* | NX,*) - # Embedded no-deploy - LICENSE_EXTENSION="-EMBEDDED" - ;; - FM,* | LM,yes | ZM,no) - # Desktop - LICENSE_EXTENSION="-DESKTOP" - ;; - *) - Platform=Linux/X11 - [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X' - echo - echo "You are not licensed for the $Platform platform." - echo - echo "Please use the contact form at http://qt.digia.com/contact-us" - echo "to upgrade your license to include the $Platform platform, or install" - echo "the Qt Open Source Edition if you intend to develop free software." - exit 1 - ;; - esac - - if test -r "$relpath/.LICENSE"; then - # Generic, non-final license - LICENSE_EXTENSION="" - line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE` - case "$line" in - *BETA*) - Edition=Beta - ;; - *TECHNOLOGY?PREVIEW*) - Edition=Preview - ;; - *EVALUATION*) - Edition=Evaluation - ;; - *) - echo >&2 "Invalid license files; cannot continue" - exit 1 - ;; - esac - Licensee="$Edition" - EditionString="$Edition" - QT_EDITION="QT_EDITION_DESKTOP" - fi - - case "$LicenseFeatureCode" in - B|G|L|Y) - # US - case "$LicenseType" in - Commercial) - cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE" - ;; - Evaluation) - cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE" - ;; - esac - ;; - 2|4|5|F) - # non-US - case "$LicenseType" in - Commercial) - cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE" - ;; - Evaluation) - cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE" - ;; - esac - ;; - *) - echo - echo "Invalid license key. Please check the license key." - exit 1 - ;; - esac - case "$LicenseFeatureCode" in - 4|B|F|Y) - CFG_RTOS_ENABLED=yes - ;; - 2|5|G|L) - CFG_RTOS_ENABLED=no - ;; - esac - if [ '!' -f "$outpath/LICENSE" ]; then - echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with" - echo "this software has disappeared." - echo - echo "Sorry, you are not licensed to use this software." - echo "Try re-installing." - echo - exit 1 - fi -elif [ $COMMERCIAL_USER = "no" ]; then - # Open Source edition - may only be used under the terms of the GPL or LGPL. - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - Licensee="Open Source" - Edition="OpenSource" - EditionString="Open Source" - QT_EDITION="QT_EDITION_OPENSOURCE" -fi - -#------------------------------------------------------------------------------- # initalize variables #------------------------------------------------------------------------------- @@ -907,6 +629,7 @@ CFG_JAVASCRIPTCORE_JIT=auto CFG_PKGCONFIG=auto CFG_STACK_PROTECTOR_STRONG=auto CFG_SLOG2=auto +CFG_PPS=auto CFG_QNX_IMF=auto CFG_SYSTEM_PROXIES=no @@ -939,7 +662,6 @@ CFG_CUPS=auto CFG_ICONV=auto CFG_DBUS=auto CFG_GLIB=auto -CFG_GSTREAMER=auto CFG_QGTKSTYLE=auto CFG_LARGEFILE=auto CFG_OPENSSL=auto @@ -979,6 +701,8 @@ RPATH_FLAGS= W_FLAGS= QCONFIG_FLAGS= XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" +XPLATFORM_MAC=no +XPLATFORM_IOS=no XPLATFORM_ANDROID=no XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) XPLATFORM_MAEMO=no @@ -1001,6 +725,11 @@ QPA_PLATFORM_GUARD=yes CFG_CXX11=auto CFG_DIRECTWRITE=no CFG_WERROR=auto +CFG_QREAL=double +OPT_MAC_SDK= +COMMERCIAL_USER=ask +LICENSE_FILE= +CFG_DEV=no # initalize variables used for installation QT_INSTALL_PREFIX= @@ -1045,13 +774,17 @@ QT_LIBS_DBUS= QT_CFLAGS_GLIB= QT_LIBS_GLIB= -# flags for GStreamer (X11 only) -QT_CFLAGS_GSTREAMER= -QT_LIBS_GSTREAMER= - # default qpa platform QT_QPA_DEFAULT_PLATFORM= +# Android vars +CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT +CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT +CFG_DEFAULT_ANDROID_PLATFORM=android-9 +CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a +CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.8 +CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST + #------------------------------------------------------------------------------- # check SQL drivers available in this package #------------------------------------------------------------------------------- @@ -1062,15 +795,6 @@ CFG_SQL_oci=no CFG_SQL_db2=no CFG_SQL_AVAILABLE= - -# Android vars -CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT -CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT -CFG_DEFAULT_ANDROID_PLATFORM=android-9 -CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a -CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.8 -CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST - if [ -d "$relpath/src/plugins/sqldrivers" ]; then for a in "$relpath/src/plugins/sqldrivers/"*; do if [ -d "$a" ]; then @@ -1166,6 +890,7 @@ while [ "$#" -gt 0 ]; do -mysql_config| \ -qpa| \ -qconfig| \ + -qreal| \ -android-sdk| \ -android-ndk| \ -android-ndk-platform| \ @@ -1319,7 +1044,6 @@ while [ "$#" -gt 0 ]; do esac if [ "$UNKNOWN_ARG" = "yes" ]; then echo "$1: unknown argument" - OPT_HELP=yes ERROR=yes shift continue @@ -1417,6 +1141,9 @@ while [ "$#" -gt 0 ]; do qconfig) CFG_QCONFIG="$VAL" ;; + qreal) + CFG_QREAL="$VAL" + ;; sysroot) CFG_SYSROOT="$VAL" ;; @@ -1488,6 +1215,7 @@ while [ "$#" -gt 0 ]; do sdk) if [ "$BUILD_ON_MAC" = "yes" ]; then DeviceVar set !host_build:QMAKE_MAC_SDK "$VAL" + OPT_MAC_SDK="$VAL" else UNKNOWN_OPT=yes fi @@ -1646,8 +1374,14 @@ while [ "$#" -gt 0 ]; do force-debug-info) CFG_FORCEDEBUGINFO="$VAL" ;; - developer-build|commercial|opensource) - # These switches have been dealt with already + developer-build) + CFG_DEV="yes" + ;; + commercial) + COMMERCIAL_USER="yes" + ;; + opensource) + COMMERCIAL_USER="no" ;; static) if [ "$VAL" = "yes" ]; then @@ -2044,9 +1778,9 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - gstreamer) + pps) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_GSTREAMER="$VAL" + CFG_PPS="$VAL" else UNKNOWN_OPT=yes fi @@ -2200,7 +1934,11 @@ while [ "$#" -gt 0 ]; do break fi done - [ "$found" = yes ] || ERROR=yes + if [ "$found" != "yes" ]; then + echo "$CURRENT_OPT: unknown argument" + ERROR=yes + continue + fi if [ "$VAR" = "sql" ]; then # set the CFG_SQL_driver @@ -2224,10 +1962,6 @@ while [ "$#" -gt 0 ]; do QMakeVar del "${IN_VAR}s" "$VAL" QMakeVar del "${PLUG_VAR}s" "$VAL" fi - if [ "$ERROR" = "yes" ]; then - echo "$CURRENT_OPT: unknown argument" - OPT_HELP=yes - fi ;; v|verbose) if [ "$VAL" = "yes" ]; then @@ -2401,131 +2135,386 @@ while [ "$#" -gt 0 ]; do esac if [ "$UNKNOWN_OPT" = "yes" ]; then echo "${CURRENT_OPT}: invalid command-line switch" - OPT_HELP=yes ERROR=yes fi done - -# update QT_CONFIG to show our current predefined configuration -case "$CFG_QCONFIG" in -minimal|small|medium|large|full) - # these are a sequence of increasing functionality - for c in minimal small medium large full; do - QT_CONFIG="$QT_CONFIG $c-config" - [ "$CFG_QCONFIG" = $c ] && break - done - ;; -*) - # not known to be sufficient for anything - if [ '!' -f "$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" ] && [ '!' -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then - echo >&2 "Error: configuration file not found:" - echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" - echo >&2 " or" - echo >&2 " `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"`" - OPT_HELP=yes - fi -esac +[ "x$ERROR" = "xyes" ] && exit 1 #------------------------------------------------------------------------------- -# build tree initialization +# help - interactive parts of the script _after_ this section please #------------------------------------------------------------------------------- -# where to find which.. -unixtests="$relpath/config.tests/unix" -mactests="$relpath/config.tests/mac" -WHICH="$unixtests/which.test" +if [ "$OPT_HELP" = "yes" ]; then + cat <<EOF +Usage: $relconf [options] -PERL=`$WHICH perl 2>/dev/null` +Installation options: -# find out which awk we want to use, prefer gawk, then nawk, then regular awk -AWK= -for e in gawk nawk awk; do - if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then - AWK=$e - break - fi -done + These are optional, but you may specify install directories. -### skip this if the user just needs help... -if [ "$OPT_HELP" != "yes" ]; then + -prefix <dir> ...... This will install everything relative to <dir> + (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active) -# is this a shadow build? -if [ "$OPT_SHADOW" = "maybe" ]; then - OPT_SHADOW=no - if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then - if [ -h "$outpath" ]; then - [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes - else - OPT_SHADOW=yes - fi - fi -fi -if [ "$OPT_SHADOW" = "yes" ]; then - if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then - echo >&2 "You cannot make a shadow build from a source tree containing a previous build." - echo >&2 "Cannot proceed." - exit 1 - fi - [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." -fi + -extprefix <dir> ... When -sysroot is used, install everything to <dir>, + rather than into SYSROOT/PREFIX. -if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then - echo - echo "WARNING: -debug-and-release is not supported outside of Mac OS X." - echo "Qt can be built in release mode with separate debug information, so" - echo "-debug-and-release is not necessary anymore" - echo -fi + -hostprefix [dir] .. Tools and libraries needed when developing + applications are installed in [dir]. If [dir] is + not given, the current build directory will be used. + (default EXTPREFIX) -if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then - echo "Error: -no-xkbcommon is not supported on XCB platform plugin." - exit 101 -fi + You may use these to separate different parts of the install: -if [ "$CFG_SILENT" = "yes" ]; then - QMAKE_CONFIG="$QMAKE_CONFIG silent" -fi + -bindir <dir> ......... User executables will be installed to <dir> + (default PREFIX/bin) + -headerdir <dir> ...... Headers will be installed to <dir> + (default PREFIX/include) + -libdir <dir> ......... Libraries will be installed to <dir> + (default PREFIX/lib) + -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir> + (default PREFIX) + -plugindir <dir> ...... Plugins will be installed to <dir> + (default ARCHDATADIR/plugins) + -libexecdir <dir> ..... Program executables will be installed to <dir> + (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) + -importdir <dir> ...... Imports for QML1 will be installed to <dir> + (default ARCHDATADIR/imports) + -qmldir <dir> ......... Imports for QML2 will be installed to <dir> + (default ARCHDATADIR/qml) + -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir> + (default PREFIX) + -docdir <dir> ......... Documentation will be installed to <dir> + (default DATADIR/doc) + -translationdir <dir> . Translations of Qt programs will be installed to <dir> + (default DATADIR/translations) + -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir> + (default PREFIX/etc/xdg) + -examplesdir <dir> .... Examples will be installed to <dir> + (default PREFIX/examples) + -testsdir <dir> ....... Tests will be installed to <dir> + (default PREFIX/tests) -# if the source tree is different from the build tree, -# symlink or copy part of the sources -if [ "$OPT_SHADOW" = "yes" ]; then - echo "Preparing build tree..." + -hostbindir <dir> .. Host executables will be installed to <dir> + (default HOSTPREFIX/bin) + -hostlibdir <dir> .. Host libraries will be installed to <dir> + (default HOSTPREFIX/lib) + -hostdatadir <dir> . Data used by qmake will be installed to <dir> + (default HOSTPREFIX) - [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin" +Configure options: - mkdir -p "$outpath/mkspecs" -fi + The defaults (*) are usually acceptable. A plus (+) denotes a default value + that needs to be evaluated. If the evaluation succeeds, the feature is + included. Here is a short explanation of each option: -# symlink fonts to be able to run application from build directory -if [ ! -d "${outpath}/lib/fonts" ]; then - if [ "$PLATFORM" = "$XPLATFORM" ]; then - mkdir -p "${outpath}/lib" - ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" - fi -fi + * -release ........... Compile and link Qt with debugging turned off. + -debug ............. Compile and link Qt with debugging turned on. + -debug-and-release . Compile and link two versions of Qt, with and without + debugging turned on (Mac only). -# find a make command -if [ -z "$MAKE" ]; then - MAKE= - for mk in gmake make; do - if "$WHICH" $mk >/dev/null 2>&1; then - MAKE=`"$WHICH" $mk` - break - fi - done - if [ -z "$MAKE" ]; then - echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH." - echo >&2 "Cannot proceed." - exit 1 - fi - # export MAKE, we need it later in the config.tests - export MAKE -fi + -force-debug-info .. Create symbol files for release builds. + + -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) + + -opensource ........ Compile and link the Open-Source Edition of Qt. + -commercial ........ Compile and link the Commercial Edition of Qt. + + -confirm-license ... Automatically acknowledge the license (use with + either -opensource or -commercial) + + -no-c++11 .......... Do not compile Qt with C++11 support enabled. + + -c++11 ............. Compile Qt with C++11 support enabled. + + * -shared ............ Create and use shared Qt libraries. + -static ............ Create and use static Qt libraries. + + * -process ........... Generate only a top-level Makefile. + -fully-process ..... Generate Makefiles for the entire Qt tree. + -dont-process ...... Do not generate any Makefiles. + + -no-largefile ...... Disables large file support. + + -largefile ......... Enables Qt to access files larger than 4 GB. + + -no-accessibility .. Do not compile Accessibility support. + Disabling accessibility is not recommended, as it will break QStyle + and may break other internal parts of Qt. + With this switch you create a source incompatible version of Qt, + which is unsupported. + + -accessibility ..... Compile Accessibility support. + + -no-sql-<driver> ... Disable SQL <driver> entirely. + -qt-sql-<driver> ... Enable a SQL <driver> in the Qt SQL module, by default + none are turned on. + -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to + at run time. + + Possible values for <driver>: + [$CFG_SQL_AVAILABLE ] + + -system-sqlite ..... Use sqlite from the operating system. + + -no-javascript-jit . Do not build the JavaScriptCore JIT compiler. + + -javascript-jit .... Build the JavaScriptCore JIT compiler. + + -no-qml-debug ...... Do not build the in-process QML debugging support. + + -qml-debug ......... Build the QML debugging support. + + -platform target ... The operating system and compiler you are building + on (default detected from host system). + + See the README file for a list of supported + operating systems and compilers. + + -no-sse2 ........... Do not compile with use of SSE2 instructions. + -no-sse3 ........... Do not compile with use of SSE3 instructions. + -no-ssse3 .......... Do not compile with use of SSSE3 instructions. + -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions. + -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. + -no-avx ............ Do not compile with use of AVX instructions. + -no-avx2 ........... Do not compile with use of AVX2 instructions. + -no-neon ........... Do not compile with use of NEON instructions. + -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions. + -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions. + + -qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'. + -qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so. + + -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool. + -gcov .............. Instrument Qt with the GCov code coverage tool. + + -D <string> ........ Add an explicit define to the preprocessor. + -I <string> ........ Add an explicit include path. + -L <string> ........ Add an explicit library path. + + + -pkg-config ........ Use pkg-config to detect include and library paths. By default, + configure determines whether to use pkg-config or not with + some heuristics such as checking the environment variables. + -no-pkg-config ..... Disable use of pkg-config. + -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability + detection heuristic). + + -help, -h .......... Display this information. + +Third Party Libraries: + + -qt-zlib ........... Use the zlib bundled with Qt. + + -system-zlib ....... Use zlib from the operating system. + See http://www.gzip.org/zlib + + -no-gif ............ Do not compile GIF reading support. + + -no-libpng ......... Do not compile PNG support. + -qt-libpng ......... Use the libpng bundled with Qt. + + -system-libpng ..... Use libpng from the operating system. + See http://www.libpng.org/pub/png + + -no-libjpeg ........ Do not compile JPEG support. + -qt-libjpeg ........ Use the libjpeg bundled with Qt. + + -system-libjpeg .... Use libjpeg from the operating system. + See http://www.ijg.org + + -no-freetype ....... Do not compile in Freetype2 support. + -qt-freetype ....... Use the libfreetype bundled with Qt. + + -system-freetype.... Use the libfreetype provided by the system (enabled if -fontconfig is active). + See http://www.freetype.org + + * -no-harfbuzz ....... Do not compile HarfBuzz-NG support. + -qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt + to do text shaping. It can still be disabled + by setting QT_HARFBUZZ environment variable to "old". + -system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system + to do text shaping. It can still be disabled + by setting QT_HARFBUZZ environment variable to "old". + + -no-openssl ........ Do not compile support for OpenSSL. + + -openssl ........... Enable run-time OpenSSL support. + -openssl-linked .... Enabled linked OpenSSL support. + + -qt-pcre ........... Use the PCRE library bundled with Qt. + + -system-pcre ....... Use the PCRE library from the operating system. + + -qt-xcb ............ Use xcb- libraries bundled with Qt. + (libxcb.so will still be used from operating system). + + -system-xcb ........ Use xcb- libraries from the operating system. + + -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt. + + -system-xkbcommon .. Use the xkbcommon library from the operating system. + + -no-xinput2 ........ Do not compile XInput2 support. + * -xinput2 ........... Compile XInput2 support. + + -no-glib ........... Do not compile Glib support. + + -glib .............. Compile Glib support. + +Additional options: + + -make <part> ....... Add part to the list of parts to be built at make time. + (defaults to: $QT_DEFAULT_BUILD_PARTS) + -nomake <part> ..... Exclude part from the list of parts to be built. + + -skip <module> ..... Exclude an entire module from the build. + + -no-compile-examples ... Install only the sources of examples. + + -no-gui ............ Don't build the Qt GUI module and dependencies. + + -gui ............... Build the Qt GUI module and dependencies. + + -no-widgets ........ Don't build the Qt Widgets module and dependencies. + + -widgets ........... Build the Qt Widgets module and dependencies. + + -R <string> ........ Add an explicit runtime library path to the Qt + libraries. + -l <string> ........ Add an explicit library. + + -no-rpath .......... Do not use the library install path as a runtime + library path. + + -rpath ............. Link Qt libraries and executables using the library + install path as a runtime library path. Equivalent + to -R install_libpath + + -continue .......... Continue as far as possible if an error occurs. + + -verbose, -v ....... Print verbose information about each step of the + configure process. + + -silent ............ Reduce the build output so that warnings and errors + can be seen more easily. + + * -no-optimized-qmake ... Do not build qmake optimized. + -optimized-qmake ...... Build qmake optimized. + + -no-nis ............ Do not compile NIS support. + * -nis ............... Compile NIS support. + + -no-cups ........... Do not compile CUPS support. + * -cups .............. Compile CUPS support. + Requires cups/cups.h and libcups.so.2. + + -no-iconv .......... Do not compile support for iconv(3). + * -iconv ............. Compile support for iconv(3). + + -no-icu ............ Do not compile support for ICU libraries. + + -icu ............... Compile support for ICU libraries. + + -no-fontconfig ..... Do not compile FontConfig support. + + -fontconfig ........ Compile FontConfig support. + + -no-strip .......... Do not strip binaries and libraries of unneeded symbols. + * -strip ............. Strip binaries and libraries of unneeded symbols when installing. + + * -no-pch ............ Do not use precompiled header support. + -pch ............... Use precompiled header support. + + -no-dbus ........... Do not compile the Qt D-Bus module. + + -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1. + -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1. + + -reduce-relocations ..... Reduce relocations in the libraries through extra + linker optimizations (Qt/X11 and Qt for Embedded Linux only; + experimental; needs GNU ld >= 2.18). + + -force-asserts ........ Force Q_ASSERT to be enabled even in release builds. + + -device <name> ............... Cross-compile for device <name> (experimental) + -device-option <key=value> ... Add device specific options for the device mkspec + (experimental) + + -no-separate-debug-info . Do not store debug information in a separate file. + * -separate-debug-info .... Strip debug information into a separate file. + + -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. + * -xcb ............... Compile Xcb support. + + -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. + * -eglfs ............. Compile EGLFS support. + + -no-directfb ....... Do not compile DirectFB support. + * -directfb .......... Compile DirectFB support. + + -no-linuxfb ........ Do not compile Linux Framebuffer support. + * -linuxfb ........... Compile Linux Framebuffer support. + + -no-kms ............ Do not compile KMS support. + * -kms ............... Compile KMS support (Requires EGL). + + -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows). + + -xplatform target ... The target platform when cross-compiling. + + -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths. + -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler + + -no-feature-<feature> Do not compile in <feature>. + -feature-<feature> .. Compile in <feature>. The available features + are described in src/corelib/global/qfeatures.txt + + -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the + default ($CFG_QCONFIG). + + -qreal [double|float] typedef qreal to the specified type. The default is double. + Note that changing this flag affects binary compatibility. + + -no-opengl .......... Do not support OpenGL. + -opengl <api> ....... Enable OpenGL support + With no parameter, this will attempt to auto-detect + OpenGL ES 2, or regular desktop OpenGL. + Use es2 for <api> to override auto-detection. + + * -no-system-proxies .. Do not use system network proxies by default. + -system-proxies ..... Use system network proxies by default. + + -no-warnings-are-errors Make warnings be treated normally + -warnings-are-errors Make warnings be treated as errors + (enabled if -developer-build is active) + +QNX/Blackberry options: + + -no-slog2 .......... Do not compile with slog2 support. + -slog2 ............. Compile with slog2 support. + + -no-pps ............ Do not compile with pps support. + -pps ............... Compile with pps support. + +MacOS/iOS options: + + -Fstring ........... Add an explicit framework path. + -fw string ......... Add an explicit framework. + + * -framework ......... Build Qt as a series of frameworks and + link tools against those frameworks. + -no-framework ...... Do not build Qt as a series of frameworks. + + -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be + one of the available SDKs as listed by 'xcodebuild -showsdks'. + Note that the argument applies only to Qt libraries and applications built + using the target mkspec - not host tools such as qmake, moc, rcc, etc. + +Android options: -fi ### help + -android-sdk path .............. The Android SDK root path. + (default \$ANDROID_SDK_ROOT) + + -android-ndk path .............. The Android NDK root path. + (default \$ANDROID_NDK_ROOT) + + -android-ndk-platform .......... Sets the android platform + (default $CFG_DEFAULT_ANDROID_PLATFORM) + + -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) + (default \$ANDROID_NDK_HOST) + + -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips) + (default $CFG_DEFAULT_ANDROID_TARGET_ARCH) + + -android-toolchain-version ..... Sets the android toolchain version + (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION) +EOF + + exit 0 +fi # Help #------------------------------------------------------------------------------- -# auto-detect all that hasn't been specified in the arguments +# platform detection #------------------------------------------------------------------------------- if [ -z "$PLATFORM" ]; then @@ -2685,7 +2674,6 @@ if [ -z "$PLATFORM" ]; then PLATFORM=unsupported/qnx-g++ ;; *) - if [ "$OPT_HELP" != "yes" ]; then echo >&2 echo " The build script does not currently recognize all" >&2 echo " platforms supported by Qt." >&2 @@ -2693,14 +2681,15 @@ if [ -z "$PLATFORM" ]; then echo " set the system/compiler combination you use." >&2 echo >&2 exit 2 - fi esac fi [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM" -case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac case "$XPLATFORM" in + *win32-g++*) + XPLATFORM_MINGW=yes + ;; *-maemo*) XPLATFORM_MAEMO=yes ;; @@ -2708,8 +2697,12 @@ case "$XPLATFORM" in XPLATFORM_QNX=yes ;; *ios*) + XPLATFORM_MAC=yes XPLATFORM_IOS=yes ;; + *macx*) + XPLATFORM_MAC=yes + ;; # XPLATFORM_ANDROID should not be set for unsupported/android-g++ *unsupported*) ;; @@ -2718,6 +2711,443 @@ case "$XPLATFORM" in ;; esac +#------------------------------------------------------------------------------- +# check the license +#------------------------------------------------------------------------------- + +if [ "$COMMERCIAL_USER" = "ask" ]; then + while true; do + echo "Which edition of Qt do you want to use ?" + echo + echo "Type 'c' if you want to use the Commercial Edition." + echo "Type 'o' if you want to use the Open Source Edition." + echo + read commercial + echo + if [ "$commercial" = "c" ]; then + COMMERCIAL_USER="yes" + break + elif [ "$commercial" = "o" ]; then + COMMERCIAL_USER="no" + break + fi + done +fi + +CFG_RTOS_ENABLED=yes +EditionString=Commercial +if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then + # Commercial preview release + Licensee="Preview" + Edition="Preview" + QT_EDITION="QT_EDITION_DESKTOP" + LicenseType="Technology Preview" +elif [ $COMMERCIAL_USER = "yes" ]; then + # one of commercial editions + + # read in the license file + [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$QT_LICENSE_FILE" + [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license" + if [ -f "$LICENSE_FILE" ]; then + tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp" + diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp" + . "$LICENSE_FILE" >/dev/null 2>&1 + if [ -z "$LicenseKeyExt" ]; then + echo + echo "You are using an old license file." + echo + echo "Please install the license file supplied by Digia," + echo "or install the Qt Open Source Edition if you intend to" + echo "develop free software." + exit 1 + fi + if [ -z "$Licensee" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + else + if [ -z "$LicenseKeyExt" ]; then + echo + echo $ECHO_N "Please enter your license key: $ECHO_C" + read LicenseKeyExt + Licensee="Unknown user" + fi + fi + + # Key verification + echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \ + && LicenseValid="yes" \ + || LicenseValid="no" + if [ "$LicenseValid" != "yes" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` + PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -` + LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -` + LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1` + + # determine which edition we are licensed to use + case "$LicenseTypeCode" in + F4M) + LicenseType="Commercial" + case $ProductCode in + F) + Edition="Universal" + QT_EDITION="QT_EDITION_UNIVERSAL" + ;; + B) + Edition="FullFramework" + EditionString="Full Framework" + QT_EDITION="QT_EDITION_DESKTOP" + ;; + L) + Edition="GUIFramework" + EditionString="GUI Framework" + QT_EDITION="QT_EDITION_DESKTOPLIGHT" + ;; + esac + ;; + Z4M|R4M|Q4M) + LicenseType="Evaluation" + QMakeVar add DEFINES QT_EVAL + case $ProductCode in + B) + Edition="Evaluation" + QT_EDITION="QT_EDITION_EVALUATION" + ;; + esac + ;; + esac + if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + + # verify that we are licensed to use Qt on this platform + LICENSE_EXTENSION= + case "$PlatformCode" in + *L) + CFG_RTOS_ENABLED=yes + PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'` + ;; + *) + CFG_RTOS_ENABLED=no + PlatformCode=`echo "$PlatformCode" | sed 's/.$//'` + ;; + esac + ### EMBEDDED_QPA logic missing ### + case "$PlatformCode,$XPLATFORM_MAC" in + X9,* | XC,* | XU,* | XW,* | XM,*) + # Qt All-OS + LICENSE_EXTENSION="-ALLOS" + ;; + 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) + # Qt for Embedded Linux + LICENSE_EXTENSION="-EMBEDDED" + ;; + 6M,* | N7,* | N9,* | NX,*) + # Embedded no-deploy + LICENSE_EXTENSION="-EMBEDDED" + ;; + FM,* | LM,yes | ZM,no) + # Desktop + LICENSE_EXTENSION="-DESKTOP" + ;; + *) + Platform=Linux/X11 + [ "$XPLATFORM_MAC" = "yes" ] && Platform='Mac OS X' + echo + echo "You are not licensed for the $Platform platform." + echo + echo "Please use the contact form at http://qt.digia.com/contact-us" + echo "to upgrade your license to include the $Platform platform, or install" + echo "the Qt Open Source Edition if you intend to develop free software." + exit 1 + ;; + esac + + if test -r "$relpath/.LICENSE"; then + # Generic, non-final license + LICENSE_EXTENSION="" + line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE` + case "$line" in + *BETA*) + Edition=Beta + ;; + *TECHNOLOGY?PREVIEW*) + Edition=Preview + ;; + *EVALUATION*) + Edition=Evaluation + ;; + *) + echo >&2 "Invalid license files; cannot continue" + exit 1 + ;; + esac + Licensee="$Edition" + EditionString="$Edition" + QT_EDITION="QT_EDITION_DESKTOP" + fi + + case "$LicenseFeatureCode" in + B|G|L|Y) + # US + case "$LicenseType" in + Commercial) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE" + ;; + Evaluation) + cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE" + ;; + esac + ;; + 2|4|5|F) + # non-US + case "$LicenseType" in + Commercial) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE" + ;; + Evaluation) + cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE" + ;; + esac + ;; + *) + echo + echo "Invalid license key. Please check the license key." + exit 1 + ;; + esac + case "$LicenseFeatureCode" in + 4|B|F|Y) + CFG_RTOS_ENABLED=yes + ;; + 2|5|G|L) + CFG_RTOS_ENABLED=no + ;; + esac + if [ '!' -f "$outpath/LICENSE" ]; then + echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with" + echo "this software has disappeared." + echo + echo "Sorry, you are not licensed to use this software." + echo "Try re-installing." + echo + exit 1 + fi +elif [ $COMMERCIAL_USER = "no" ]; then + # Open Source edition - may only be used under the terms of the GPL or LGPL. + Licensee="Open Source" + Edition="OpenSource" + EditionString="Open Source" + QT_EDITION="QT_EDITION_OPENSOURCE" +fi +echo +echo "This is the Qt ${EditionString} Edition." +echo + +if [ "$CFG_RTOS_ENABLED" = "no" ]; then + case `basename "$XPLATFORM"` in + qnx-* | vxworks-*) + echo "" + echo "You are not licensed for Qt for `basename $XPLATFORM`." + echo "" + echo "Please use the contact form at http://qt.digia.com/contact-us" + echo "to upgrade your license to include this platform, or install" + echo "the Qt Open Source Edition if you intend to develop free software." + exit 1 + ;; + esac +fi + +if [ "$Edition" = "OpenSource" ]; then + while true; do + echo "You are licensed to use this software under the terms of" + echo "the Lesser GNU General Public License (LGPL) versions 2.1." + if [ -f "$relpath/LICENSE.GPL3" ]; then + echo "You are also licensed to use this software under the terms of" + echo "the GNU General Public License (GPL) versions 3." + affix="either" + else + affix="the" + fi + echo + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $LicenseType license." + acceptance=yes + else + if [ -f "$relpath/LICENSE.GPL3" ]; then + echo "Type '3' to view the GNU General Public License version 3." + fi + echo "Type 'L' to view the Lesser GNU General Public License version 2.1." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" + read acceptance + fi + echo + if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then + break + elif [ "$acceptance" = "no" ]; then + echo "You are not licensed to use this software." + echo + exit 1 + elif [ "$acceptance" = "3" ]; then + more "$relpath/LICENSE.GPL3" + elif [ "$acceptance" = "L" ]; then + more "$relpath/LICENSE.LGPL" + fi + done +elif [ "$Edition" = "Preview" ]; then + TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"` + while true; do + + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $LicenseType license." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the $TheLicense" + echo + echo "Type '?' to read the Preview License." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ] ;then + echo "You are not licensed to use this software." + echo + exit 0 + elif [ "$acceptance" = "?" ]; then + more "$relpath/LICENSE.PREVIEW.COMMERCIAL" + fi + done +elif [ "$Edition" != "OpenSource" ]; then + if [ -n "$ExpiryDate" ]; then + ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"` + [ -z "$ExpiryDate" ] && ExpiryDate="0" + Today=`date +%Y%m%d` + if [ "$Today" -gt "$ExpiryDate" ]; then + case "$LicenseType" in + Commercial|Academic|Educational) + echo + echo "WARNING WARNING WARNING WARNING" + echo + echo " Your support and upgrade period has expired." + echo + echo " You may continue to use your last licensed release" + echo " of Qt under the terms of your existing license" + echo " agreement. But you are not entitled to technical" + echo " support, nor are you entitled to use any more recent" + echo " Qt releases." + echo + echo " Please use the contact form at http://qt.digia.com/contact-us" + echo " to renew your support and upgrades for this license." + echo + echo "WARNING WARNING WARNING WARNING" + echo + sleep 3 + ;; + Evaluation|*) + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + echo " Your Evaluation license has expired." + echo + echo " You are no longer licensed to use this software. Please" + echo " use the contact form at http://qt.digia.com/contact-us to" + echo " purchase license, or install the Qt Open Source Edition" + echo " if you intend to develop free software." + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + exit 1 + ;; + esac + fi + fi + TheLicense=`head -n 1 "$outpath/LICENSE"` + while true; do + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $TheLicense." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the $TheLicense." + echo + echo "Type '?' to view the $TheLicense." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C" + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ]; then + echo "You are not licensed to use this software." + echo + exit 1 + else [ "$acceptance" = "?" ] + more "$outpath/LICENSE" + fi + done +fi + +#------------------------------------------------------------------------------- +# command line and environment validation +#------------------------------------------------------------------------------- + +# update QT_CONFIG to show our current predefined configuration +CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h +case "$CFG_QCONFIG" in +minimal|small|medium|large|full) + # these are a sequence of increasing functionality + for c in minimal small medium large full; do + QT_CONFIG="$QT_CONFIG $c-config" + [ "$CFG_QCONFIG" = $c ] && break + done + [ "$CFG_QCONFIG" = full ] && CFG_QCONFIG_PATH= + ;; +*) + # not known to be sufficient for anything + if [ ! -f "$CFG_QCONFIG_PATH" ]; then + CFG_QCONFIG_PATH=`"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` + if [ ! -f "$CFG_QCONFIG_PATH" ]; then + echo >&2 "Error: configuration file not found:" + echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" + echo >&2 " or" + echo >&2 " $CFG_QCONFIG_PATH" + exit 1 + fi + fi +esac + +if [ "$XPLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then + echo + echo "WARNING: -debug-and-release is not supported outside of Mac OS X." + echo "Qt can be built in release mode with separate debug information, so" + echo "-debug-and-release is not necessary anymore" + echo +fi + +if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then + echo "Error: -no-xkbcommon is not supported on XCB platform plugin." + exit 101 +fi + if [ "$XPLATFORM_ANDROID" = "yes" ]; then if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then case $PLATFORM in @@ -2743,7 +3173,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then esac fi - if [ "$OPT_HELP" != "yes" ]; then if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then echo echo "Can not find Android NDK. Please use -android-ndk option to specify one" @@ -2774,7 +3203,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST" DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH" DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" - fi fi if [ -d "$PLATFORM" ]; then @@ -2837,26 +3265,46 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then exit 2 fi -if [ "$UNAME_SYSTEM" = "SunOS" ]; then - # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up - if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then - sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new" - mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf" +#------------------------------------------------------------------------------- +# build tree initialization +#------------------------------------------------------------------------------- + +# is this a shadow build? +if [ "$OPT_SHADOW" = "maybe" ]; then + OPT_SHADOW=no + if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then + if [ -h "$outpath" ]; then + [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes + else + OPT_SHADOW=yes + fi fi fi +if [ "$OPT_SHADOW" = "yes" ]; then + if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then + echo >&2 "You cannot make a shadow build from a source tree containing a previous build." + echo >&2 "Cannot proceed." + exit 1 + fi + [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." +fi -if [ "$CFG_RTOS_ENABLED" = "no" ]; then - case `basename "$XPLATFORM"` in - qnx-* | vxworks-*) - echo "" - echo "You are not licensed for Qt for `basename $XPLATFORM`." - echo "" - echo "Please use the contact form at http://qt.digia.com/contact-us" - echo "to upgrade your license to include this platform, or install" - echo "the Qt Open Source Edition if you intend to develop free software." - exit 1 - ;; - esac +# if the source tree is different from the build tree, +# symlink or copy part of the sources +if [ "$OPT_SHADOW" = "yes" ]; then + echo "Preparing build tree..." + + [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin" + + mkdir -p "$outpath/mkspecs" +fi + +# symlink fonts to be able to run application from build directory +if [ ! -d "${outpath}/lib/fonts" ]; then + if [ "$PLATFORM" = "$XPLATFORM" ]; then + mkdir -p "${outpath}/lib" + ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" + fi fi #------------------------------------------------------------------------------- @@ -2865,7 +3313,7 @@ fi # detect build style if [ "$CFG_DEBUG" = "auto" ]; then - if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then + if [ "$XPLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then CFG_DEBUG_RELEASE=yes CFG_DEBUG=yes elif [ "$CFG_DEV" = "yes" ]; then @@ -2890,11 +3338,18 @@ if [ "$XPLATFORM_IOS" = "yes" ]; then CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS examples tests" CFG_SHARED="no" # iOS builds should be static to be able to submit to the App Store CFG_CXX11="no" # C++11 support disabled for now - CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtgraphicaleffects qtlocation qtmacextras qtmultimedia qtquickcontrols qtserialport qttools qtwebkit qtwebkit-examples" + CFG_SKIP_MODULES="$CFG_SKIP_MODULES qtconnectivity qtdoc qtlocation qtmacextras qtserialport qttools qtwebkit qtwebkit-examples" + + # If the user passes -sdk on the command line we build a SDK-specific Qt build. + # Otherwise we build a joined simulator and device build, which is the default. + if [ -z "$OPT_MAC_SDK" ]; then + QT_CONFIG="$QT_CONFIG build_all" + QTCONFIG_CONFIG="$QTCONFIG_CONFIG iphonesimulator_and_iphoneos" + fi fi # disable GTK style support auto-detection on Mac -if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then +if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then CFG_QGTKSTYLE=no fi @@ -2902,7 +3357,7 @@ QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX` TEST_COMPILER=$QMAKE_CONF_COMPILER -if [ "$OPT_HELP" != "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ] ; then +if [ "$XPLATFORM_ANDROID" = "yes" ] ; then ANDROID_NDK_TOOLS_PREFIX= ANDROID_PLATFORM_ARCH= case $CFG_DEFAULT_ANDROID_TARGET_ARCH in @@ -3021,7 +3476,7 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2> fi # find the default framework value -if [ "$BUILD_ON_MAC" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then if [ "$CFG_FRAMEWORK" = "auto" ]; then CFG_FRAMEWORK="$CFG_SHARED" elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then @@ -3034,35 +3489,26 @@ else CFG_FRAMEWORK=no fi -# auto-detect default include and library search paths -unset tty -[ "$OPT_VERBOSE" = "yes" ] && tty=/dev/stderr +# Auto-detect default include and library search paths. -eval `LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK ' +# Use intermediate variable to get around backtick/quote nesting problems. +awkprog=' BEGIN { ORS = ""; FS = "="; incs = 0; libs = 0; } function normalize(dir) { do { odir = dir - gsub(/\\/[^\\/]+\\/\\.\\./, "", dir) + gsub(/\/[^\/]+\/\.\./, "", dir) } while (dir != odir); do { odir = dir - gsub(/\\/\\./, "", dir) + gsub(/\/\./, "", dir) } while (dir != odir); sub("/$", "", dir); return dir; } -function quote(s) -{ - # We only handle spaces - if (match(s, " ") != 0) - return "\\\\\"" s "\\\\\""; - return s; -} - # extract include paths from indented lines between # #include <...> search starts here: # and @@ -3070,7 +3516,7 @@ function quote(s) /^\#include </ { yup=1; print "DEFAULT_INCDIRS=\""; next } /^End of search/ { yup=0; print "\"\n" } / \(framework directory\)$/ { next } -yup { print quote(normalize(substr($0, 2))) " "; ++incs } +yup { print normalize(substr($0, 2)) "\n"; ++incs } # extract from one line like LIBRARY_PATH=/one/path:/another/path:... $1 == "LIBRARY_PATH" { @@ -3079,7 +3525,7 @@ $1 == "LIBRARY_PATH" { for (lib in library_paths) { dir = normalize(library_paths[lib]); if (!(dir in dirs)) { - print quote(dir) " "; + print dir "\n"; dirs[dir] = 1; } } @@ -3088,10 +3534,14 @@ $1 == "LIBRARY_PATH" { END { if (incs == 0) - print "DEFAULT_INCDIRS=\"/usr/include /usr/local/include\"\n"; + print "DEFAULT_INCDIRS=\"/usr/include\n/usr/local/include\"\n"; if (libs == 0) - print "DEFAULT_LIBDIRS=\"/lib /usr/lib\"\n"; -}' | tee $tty` + print "DEFAULT_LIBDIRS=\"/lib\n/usr/lib\"\n"; +}' + +unset tty +[ "$OPT_VERBOSE" = "yes" ] && tty=/dev/stderr +eval "`LC_ALL=C $TEST_COMPILER $SYSROOT_FLAG $TEST_COMPILER_CXXFLAGS -xc++ -E -v - < /dev/null 2>&1 > /dev/null | $AWK "$awkprog" | tee $tty`" unset tty #setup the build parts @@ -3194,7 +3644,7 @@ fi QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"` if [ -z "$QT_INSTALL_SETTINGS" ]; then #default - if [ "$BUILD_ON_MAC" = "yes" ]; then + if [ "$XPLATFORM_MAC" = "yes" ]; then QT_INSTALL_SETTINGS=/Library/Preferences/Qt else QT_INSTALL_SETTINGS=$QT_INSTALL_PREFIX/etc/xdg @@ -3289,669 +3739,8 @@ if [ "$CFG_COMPILE_EXAMPLES" = "yes" ]; then fi #------------------------------------------------------------------------------- -# help - interactive parts of the script _after_ this section please -#------------------------------------------------------------------------------- - -# next, emit a usage message if something failed. -if [ "$OPT_HELP" = "yes" ]; then - [ "x$ERROR" = "xyes" ] && echo - if [ "$CFG_NIS" = "no" ]; then - NSY=" " - NSN="*" - else - NSY="*" - NSN=" " - fi - if [ "$CFG_CUPS" = "no" ]; then - CUY=" " - CUN="*" - else - CUY="*" - CUN=" " - fi - if [ "$CFG_ICONV" = "no" ]; then - CIY=" " - CIN="*" - else - CIY="*" - CIN=" " - fi - if [ "$CFG_LARGEFILE" = "no" ]; then - LFSY=" " - LFSN="*" - else - LFSY="*" - LFSN=" " - fi - if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then - PHY=" " - PHN="*" - else - PHY="*" - PHN=" " - fi - - if [ "$CFG_XCB" = "no" ]; then - XCBY=" " - XCBN="*" - else - XCBY="*" - XCBN=" " - fi - - if [ "$CFG_EGLFS" = "no" ]; then - EGLFSY=" " - EGLFSN="*" - else - EGLFSY="*" - EGLFSN=" " - fi - - if [ "$CFG_DIRECTFB" = "no" ]; then - DFBY=" " - DFBN="*" - else - DFBY="*" - DFBN=" " - fi - - if [ "$CFG_LINUXFB" = "no" ]; then - LFBY=" " - LFBN="*" - else - LFBY="*" - LFBN=" " - fi - - if [ "$CFG_KMS" = "no" ]; then - KMSY=" " - KMSN="*" - else - KMSY="*" - KMSN=" " - fi - - if [ "$CFG_XINPUT2" = "no" ]; then - X2Y=" " - X2N="*" - else - X2Y="*" - X2N=" " - fi - - if [ "$CFG_DBUS" = "no" ]; then - DBY=" " - DBN="+" - else - DBY="+" - DBN=" " - fi - - if [ "$CFG_SEPARATE_DEBUG_INFO" = "no" ]; then - SBY=" " - SBN="*" - else - SBY="*" - SBN=" " - fi - - if [ "$CFG_GLIB" = "no" ]; then - GBY=" " - GBN="+" - else - GBY="+" - GBN=" " - fi - - cat <<EOF -Usage: $relconf [options] - -Installation options: - - These are optional, but you may specify install directories. - - -prefix <dir> ...... This will install everything relative to <dir> - (default $QT_INSTALL_PREFIX) - - -extprefix <dir> ... When -sysroot is used, install everything to <dir>, - rather than into SYSROOT/PREFIX. - - -hostprefix [dir] .. Tools and libraries needed when developing - applications are installed in [dir]. If [dir] is - not given, the current build directory will be used. - (default EXTPREFIX) - - You may use these to separate different parts of the install: - - -bindir <dir> ......... User executables will be installed to <dir> - (default PREFIX/bin) - -headerdir <dir> ...... Headers will be installed to <dir> - (default PREFIX/include) - -libdir <dir> ......... Libraries will be installed to <dir> - (default PREFIX/lib) - -archdatadir <dir> .... Arch-dependent data used by Qt will be installed to <dir> - (default PREFIX) - -plugindir <dir> ...... Plugins will be installed to <dir> - (default ARCHDATADIR/plugins) - -libexecdir <dir> ..... Program executables will be installed to <dir> - (default ARCHDATADIR/$QT_INSTALL_LIBEXECS_DIRNAME) - -importdir <dir> ...... Imports for QML1 will be installed to <dir> - (default ARCHDATADIR/imports) - -qmldir <dir> ......... Imports for QML2 will be installed to <dir> - (default ARCHDATADIR/qml) - -datadir <dir> ........ Arch-independent data used by Qt will be installed to <dir> - (default PREFIX) - -docdir <dir> ......... Documentation will be installed to <dir> - (default DATADIR/doc) - -translationdir <dir> . Translations of Qt programs will be installed to <dir> - (default DATADIR/translations) - -sysconfdir <dir> ..... Settings used by Qt programs will be looked for in <dir> - (default PREFIX/etc/xdg) - -examplesdir <dir> .... Examples will be installed to <dir> - (default PREFIX/examples) - -testsdir <dir> ....... Tests will be installed to <dir> - (default PREFIX/tests) - - -hostbindir <dir> .. Host executables will be installed to <dir> - (default HOSTPREFIX/bin) - -hostlibdir <dir> .. Host libraries will be installed to <dir> - (default HOSTPREFIX/lib) - -hostdatadir <dir> . Data used by qmake will be installed to <dir> - (default HOSTPREFIX) - -Configure options: - - The defaults (*) are usually acceptable. A plus (+) denotes a default value - that needs to be evaluated. If the evaluation succeeds, the feature is - included. Here is a short explanation of each option: - - * -release ........... Compile and link Qt with debugging turned off. - -debug ............. Compile and link Qt with debugging turned on. - -debug-and-release . Compile and link two versions of Qt, with and without - debugging turned on (Mac only). - - -force-debug-info .. Create symbol files for release builds. - - -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) - - -opensource ........ Compile and link the Open-Source Edition of Qt. - -commercial ........ Compile and link the Commercial Edition of Qt. - - -confirm-license ... Automatically acknowledge the license (use with - either -opensource or -commercial) - - -no-c++11 .......... Do not compile Qt with C++11 support enabled. - + -c++11 ............. Compile Qt with C++11 support enabled. - - * -shared ............ Create and use shared Qt libraries. - -static ............ Create and use static Qt libraries. - - * -process ........... Generate only a top-level Makefile. - -fully-process ..... Generate Makefiles for the entire Qt tree. - -dont-process ...... Do not generate any Makefiles. - - -no-largefile ...... Disables large file support. - + -largefile ......... Enables Qt to access files larger than 4 GB. - - -no-accessibility .. Do not compile Accessibility support. - Disabling accessibility is not recommended, as it will break QStyle - and may break other internal parts of Qt. - With this switch you create a source incompatible version of Qt, - which is unsupported. - + -accessibility ..... Compile Accessibility support. - - -no-sql-<driver> ... Disable SQL <driver> entirely. - -qt-sql-<driver> ... Enable a SQL <driver> in the Qt SQL module, by default - none are turned on. - -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to - at run time. - - Possible values for <driver>: - [ $CFG_SQL_AVAILABLE ] - - -system-sqlite ..... Use sqlite from the operating system. - - -no-javascript-jit . Do not build the JavaScriptCore JIT compiler. - + -javascript-jit .... Build the JavaScriptCore JIT compiler. - - -no-qml-debug ...... Do not build the in-process QML debugging support. - + -qml-debug ......... Build the QML debugging support. - - -platform target ... The operating system and compiler you are building - on ($PLATFORM). - - See the README file for a list of supported - operating systems and compilers. - - -no-sse2 ........... Do not compile with use of SSE2 instructions. - -no-sse3 ........... Do not compile with use of SSE3 instructions. - -no-ssse3 .......... Do not compile with use of SSSE3 instructions. - -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions. - -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. - -no-avx ............ Do not compile with use of AVX instructions. - -no-avx2 ........... Do not compile with use of AVX2 instructions. - -no-neon ........... Do not compile with use of NEON instructions. - -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions. - -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions. - - -qtnamespace <name> Wraps all Qt library code in 'namespace <name> {...}'. - -qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so. - - -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool. - -gcov .............. Instrument Qt with the GCov code coverage tool. - - -D <string> ........ Add an explicit define to the preprocessor. - -I <string> ........ Add an explicit include path. - -L <string> ........ Add an explicit library path. - - + -pkg-config ........ Use pkg-config to detect include and library paths. By default, - configure determines whether to use pkg-config or not with - some heuristics such as checking the environment variables. - -no-pkg-config ..... Disable use of pkg-config. - -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability - detection heuristic). - - -help, -h .......... Display this information. - -Third Party Libraries: - - -qt-zlib ........... Use the zlib bundled with Qt. - + -system-zlib ....... Use zlib from the operating system. - See http://www.gzip.org/zlib - - -no-gif ............ Do not compile GIF reading support. - - -no-libpng ......... Do not compile PNG support. - -qt-libpng ......... Use the libpng bundled with Qt. - + -system-libpng ..... Use libpng from the operating system. - See http://www.libpng.org/pub/png - - -no-libjpeg ........ Do not compile JPEG support. - -qt-libjpeg ........ Use the libjpeg bundled with Qt. - + -system-libjpeg .... Use libjpeg from the operating system. - See http://www.ijg.org - - -no-freetype ....... Do not compile in Freetype2 support. - -qt-freetype ....... Use the libfreetype bundled with Qt. - + -system-freetype.... Use the libfreetype provided by the system (enabled if -fontconfig is active). - See http://www.freetype.org - - * -no-harfbuzz ....... Do not compile HarfBuzz-NG support. - -qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt - to do text shaping. It can still be disabled - by setting QT_HARFBUZZ environment variable to "old". - -system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system - to do text shaping. It can still be disabled - by setting QT_HARFBUZZ environment variable to "old". - - -no-openssl ........ Do not compile support for OpenSSL. - + -openssl ........... Enable run-time OpenSSL support. - -openssl-linked .... Enabled linked OpenSSL support. - - -qt-pcre ........... Use the PCRE library bundled with Qt. - + -system-pcre ....... Use the PCRE library from the operating system. - - -qt-xcb ............ Use xcb- libraries bundled with Qt. - (libxcb.so will still be used from operating system). - + -system-xcb ........ Use xcb- libraries from the operating system. - - -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt. - + -system-xkbcommon .. Use the xkbcommon library from the operating system. - -Additional options: - - -make <part> ....... Add part to the list of parts to be built at make time. - (defaults to: $QT_DEFAULT_BUILD_PARTS) - -nomake <part> ..... Exclude part from the list of parts to be built. - - -skip <module> ..... Exclude an entire module from the build. - - -no-compile-examples ... Install only the sources of examples. - - -no-gui ............ Don't build the Qt GUI module and dependencies. - + -gui ............... Build the Qt GUI module and dependencies. - - -no-widgets ........ Don't build the Qt Widgets module and dependencies. - + -widgets ........... Build the Qt Widgets module and dependencies. - - -R <string> ........ Add an explicit runtime library path to the Qt - libraries. - -l <string> ........ Add an explicit library. - - -no-rpath .......... Do not use the library install path as a runtime - library path. - + -rpath ............. Link Qt libraries and executables using the library - install path as a runtime library path. Equivalent - to -R install_libpath - - -continue .......... Continue as far as possible if an error occurs. - - -verbose, -v ....... Print verbose information about each step of the - configure process. - - -silent ............ Reduce the build output so that warnings and errors - can be seen more easily. - - * -no-optimized-qmake ... Do not build qmake optimized. - -optimized-qmake ...... Build qmake optimized. - - $NSN -no-nis ............ Do not compile NIS support. - $NSY -nis ............... Compile NIS support. - - $CUN -no-cups ........... Do not compile CUPS support. - $CUY -cups .............. Compile CUPS support. - Requires cups/cups.h and libcups.so.2. - - $CIN -no-iconv .......... Do not compile support for iconv(3). - $CIY -iconv ............. Compile support for iconv(3). - - -no-icu ............ Do not compile support for ICU libraries. - + -icu ............... Compile support for ICU libraries. - - -no-fontconfig ..... Do not compile FontConfig support. - + -fontconfig ........ Compile FontConfig support. - - -no-strip .......... Do not strip binaries and libraries of unneeded symbols. - * -strip ............. Strip binaries and libraries of unneeded symbols when installing. - - $PHN -no-pch ............ Do not use precompiled header support. - $PHY -pch ............... Use precompiled header support. - - $DBN -no-dbus ........... Do not compile the Qt D-Bus module. - $DBY -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1. - -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1. - - -reduce-relocations ..... Reduce relocations in the libraries through extra - linker optimizations (Qt/X11 and Qt for Embedded Linux only; - experimental; needs GNU ld >= 2.18). - - -force-asserts ........ Force Q_ASSERT to be enabled even in release builds. - - -device <name> ............... Cross-compile for device <name> (experimental) - -device-option <key=value> ... Add device specific options for the device mkspec - (experimental) - - $SBN -no-separate-debug-info . Do not store debug information in a separate file. - $SBY -separate-debug-info .... Strip debug information into a separate file. - - $XCBN -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. - $XCBY -xcb ............... Compile Xcb support. - - $EGLFSN -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. - $EGLFSY -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support). - - $DFBN -no-directfb ....... Do not compile DirectFB support. - $DFBY -directfb .......... Compile DirectFB support. - - $LFBN -no-linuxfb ........ Do not compile Linux Framebuffer support. - $LFBY -linuxfb ........... Compile Linux Framebuffer support. - - $KMSN -no-kms ............ Do not compile KMS support. - $KMSY -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support). - - -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows). - - -xplatform target ... The target platform when cross-compiling. - - -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths. - -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler - - -no-feature-<feature> Do not compile in <feature>. - -feature-<feature> .. Compile in <feature>. The available features - are described in src/corelib/global/qfeatures.txt - - -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the - default ($CFG_QCONFIG). - - -no-opengl .......... Do not support OpenGL. - -opengl <api> ....... Enable OpenGL support - With no parameter, this will attempt to auto-detect - OpenGL ES 2, or regular desktop OpenGL. - Use es2 for <api> to override auto-detection. - - * -no-system-proxies .. Do not use system network proxies by default. - -system-proxies ..... Use system network proxies by default. - - -no-warnings-are-errors Make warnings be treated normally - -warnings-are-errors Make warnings be treated as errors - (enabled if -developer-build is active) - - $GBN -no-glib ........... Do not compile Glib support. - $GBY -glib .............. Compile Glib support. -EOF - -if [ "$XPLATFORM_MAEMO" = "yes" ]; then - cat << EOF - - $X2N -no-xinput2 ........ Do not compile XInput2 support. - $X2Y -xinput2 ........... Compile XInput2 support. - -EOF - -fi - -if [ "$XPLATFORM_QNX" = "yes" ]; then - cat << EOF - - -no-slog2 .......... Do not compile with slog2 support. - -slog2 ............. Compile with slog2 support. -no-imf ............ Do not compile with imf support. -imf ............... Compile with imf support. - -EOF - -fi - -if [ "$BUILD_ON_MAC" = "yes" ]; then - cat << EOF - -Qt/Mac only: - - -Fstring ........... Add an explicit framework path. - -fw string ......... Add an explicit framework. - - * -framework ......... Build Qt as a series of frameworks and - link tools against those frameworks. - -no-framework ...... Do not build Qt as a series of frameworks. - - -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be - one of the available SDKs as listed by 'xcodebuild -showsdks'. - -EOF -fi - -if [ "$XPLATFORM_ANDROID" = "yes" ]; then - cat << EOF - -Android options: - -android-sdk path .............. The Android SDK root path. - (default $CFG_DEFAULT_ANDROID_SDK_ROOT) - - -android-ndk path .............. The Android NDK root path. - (default $CFG_DEFAULT_ANDROID_NDK_ROOT) - - -android-ndk-platform .......... Sets the android platform - (default $CFG_DEFAULT_ANDROID_PLATFORM) - - -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) - (default $CFG_DEFAULT_ANDROID_NDK_HOST) - - -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips) - (default $CFG_DEFAULT_ANDROID_TARGET_ARCH) - - -android-toolchain-version ..... Sets the android toolchain version - (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION) -EOF - -fi - - [ "x$ERROR" = "xyes" ] && exit 1 - exit 0 -fi # Help - - -# ----------------------------------------------------------------------------- -# LICENSING, INTERACTIVE PART -# ----------------------------------------------------------------------------- - -echo -echo "This is the Qt ${EditionString} Edition." -echo - -if [ "$Edition" = "OpenSource" ]; then - while true; do - echo "You are licensed to use this software under the terms of" - echo "the Lesser GNU General Public License (LGPL) versions 2.1." - if [ -f "$relpath/LICENSE.GPL3" ]; then - echo "You are also licensed to use this software under the terms of" - echo "the GNU General Public License (GPL) versions 3." - affix="either" - else - affix="the" - fi - echo - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $LicenseType license." - acceptance=yes - else - if [ -f "$relpath/LICENSE.GPL3" ]; then - echo "Type '3' to view the GNU General Public License version 3." - fi - echo "Type 'L' to view the Lesser GNU General Public License version 2.1." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then - break - elif [ "$acceptance" = "no" ]; then - echo "You are not licensed to use this software." - echo - exit 1 - elif [ "$acceptance" = "3" ]; then - more "$relpath/LICENSE.GPL3" - elif [ "$acceptance" = "L" ]; then - more "$relpath/LICENSE.LGPL" - fi - done -elif [ "$Edition" = "Preview" ]; then - TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"` - while true; do - - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $LicenseType license." - acceptance=yes - else - echo "You are licensed to use this software under the terms of" - echo "the $TheLicense" - echo - echo "Type '?' to read the Preview License." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ]; then - break - elif [ "$acceptance" = "no" ] ;then - echo "You are not licensed to use this software." - echo - exit 0 - elif [ "$acceptance" = "?" ]; then - more "$relpath/LICENSE.PREVIEW.COMMERCIAL" - fi - done -elif [ "$Edition" != "OpenSource" ]; then - if [ -n "$ExpiryDate" ]; then - ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"` - [ -z "$ExpiryDate" ] && ExpiryDate="0" - Today=`date +%Y%m%d` - if [ "$Today" -gt "$ExpiryDate" ]; then - case "$LicenseType" in - Commercial|Academic|Educational) - echo - echo "WARNING WARNING WARNING WARNING" - echo - echo " Your support and upgrade period has expired." - echo - echo " You may continue to use your last licensed release" - echo " of Qt under the terms of your existing license" - echo " agreement. But you are not entitled to technical" - echo " support, nor are you entitled to use any more recent" - echo " Qt releases." - echo - echo " Please use the contact form at http://qt.digia.com/contact-us" - echo " to renew your support and upgrades for this license." - echo - echo "WARNING WARNING WARNING WARNING" - echo - sleep 3 - ;; - Evaluation|*) - echo - echo "NOTICE NOTICE NOTICE NOTICE" - echo - echo " Your Evaluation license has expired." - echo - echo " You are no longer licensed to use this software. Please" - echo " use the contact form at http://qt.digia.com/contact-us to" - echo " purchase license, or install the Qt Open Source Edition" - echo " if you intend to develop free software." - echo - echo "NOTICE NOTICE NOTICE NOTICE" - echo - exit 1 - ;; - esac - fi - fi - TheLicense=`head -n 1 "$outpath/LICENSE"` - while true; do - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $TheLicense." - acceptance=yes - else - echo "You are licensed to use this software under the terms of" - echo "the $TheLicense." - echo - echo "Type '?' to view the $TheLicense." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ]; then - break - elif [ "$acceptance" = "no" ]; then - echo "You are not licensed to use this software." - echo - exit 1 - else [ "$acceptance" = "?" ] - more "$outpath/LICENSE" - fi - done -fi - -# this should be moved somewhere else -case "$PLATFORM" in -aix-*) - AIX_VERSION=`uname -v` - if [ "$AIX_VERSION" -lt "5" ]; then - QMakeVar add QMAKE_LIBS_X11 -lbind - fi - ;; -*) - ;; -esac - -#------------------------------------------------------------------------------- # generate qconfig.cpp #------------------------------------------------------------------------------- [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global" @@ -4401,7 +4190,7 @@ if [ "$CFG_CXX11" != "no" ]; then # Configure detects compiler features based on cross compiler, so we need # to explicitly disable C++11 on Mac to avoid breaking builds where the # host compiler does not support it. - if [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ]; then + if [ "$BUILD_ON_MAC" = "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ]; then CFG_CXX11="no" elif compileTest common/c++11 "C++11"; then CFG_CXX11="yes" @@ -4585,6 +4374,14 @@ if [ "$XPLATFORM_QNX" = "yes" ]; then CFG_QNX_IMF=no fi fi + if [ "$CFG_PPS" != "no" ]; then + if compileTest unix/pps "pps"; then + CFG_PPS=yes + QMAKE_CONFIG="$QMAKE_CONFIG qqnx_pps" + else + CFG_PPS=no + fi + fi fi if [ "$CFG_ZLIB" = "auto" ]; then @@ -4644,11 +4441,6 @@ if [ "$CFG_EGLFS" = "yes" ]; then echo "The EGLFS plugin requires EGL support and cannot be built" exit 101 fi - if [ "$CFG_OPENGL" != "es2" ]; then - echo "The EGLFS plugin requires OpenGL ES 2 support and cannot be built" - exit 101 - fi - CFG_OPENGL="es2" CFG_EGL=yes fi @@ -4657,10 +4449,6 @@ if [ "$CFG_KMS" = "yes" ]; then echo "The KMS plugin requires EGL support and cannot be built" exit 101 fi - if [ "$CFG_OPENGL" != "es2" ]; then - echo "The KMS plugin requires OpenGL ES 2 support and cannot be built" - exit 101 - fi fi # auto-detect SQL-modules support @@ -4749,7 +4537,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; odbc) if [ "$CFG_SQL_odbc" != "no" ]; then - if ( [ "$BUILD_ON_MAC" != "yes" ] || [ "$XPLATFORM_MINGW" = "yes" ] ) && compileTest unix/odbc "ODBC"; then + if [ "$XPLATFORM_MAC" != "yes" ] && compileTest unix/odbc "ODBC"; then if [ "$CFG_SQL_odbc" = "auto" ]; then CFG_SQL_odbc=plugin fi @@ -5050,31 +4838,6 @@ elif [ "$CFG_GLIB" = "no" ]; then CFG_QGTKSTYLE=no fi -# ### Vestige -if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then - if [ -n "$PKG_CONFIG" ]; then - QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null` - QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null` - fi - if compileTest unix/gstreamer "GStreamer" $QT_CFLAGS_GSTREAMER $QT_LIBS_GSTREAMER; then - CFG_GSTREAMER=yes - QMakeVar set QT_CFLAGS_GSTREAMER "$QT_CFLAGS_GSTREAMER" - QMakeVar set QT_LIBS_GSTREAMER "$QT_LIBS_GSTREAMER" - else - if [ "$CFG_GSTREAMER" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then - echo "Gstreamer support cannot be enabled due to functionality tests!" - echo " Turn on verbose messaging (-v) to $0 to see the final report." - echo " If you believe this message is in error you may use the continue" - echo " switch (-continue) to $0 to continue." - exit 101 - else - CFG_GSTREAMER=no - fi - fi -elif [ "$CFG_GLIB" = "no" ]; then - CFG_GSTREAMER=no -fi - # auto-detect libicu support if [ "$CFG_ICU" != "no" ]; then if compileTest unix/icu "ICU"; then @@ -5192,7 +4955,7 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then fi fi # X11/MINGW OpenGL -if [ "$BUILD_ON_MAC" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then if [ "$CFG_COREWLAN" = "auto" ]; then if compileTest mac/corewlan "CoreWlan"; then CFG_COREWLAN=yes @@ -5521,17 +5284,10 @@ elif [ "$CFG_XKBCOMMON" = "no" ]; then fi # EGL Support -if [ "$CFG_OPENGL" != "es2" ]; then - if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "desktop" ]; then - echo "EGL support was requested but Qt is being configured for desktop OpenGL." +if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then + echo "EGL support was requested but OpenGL support is disabled." echo "Either disable EGL support or enable OpenGL ES support." exit 101 - elif [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then - echo "EGL support was requested but OpenGL ES support is disabled." - echo "Either disable EGL support or enable OpenGL ES support." - exit 101 - fi - CFG_EGL=no elif [ "$CFG_EGL" != "no" ]; then if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'` @@ -5554,7 +5310,7 @@ elif [ "$CFG_EGL" != "no" ]; then fi if [ "$CFG_EGLFS" != "no" ]; then - if [ "$CFG_OPENGL" = "es2" ] && [ "$XPLATFORM_QNX" = "no" ]; then + if [ "$XPLATFORM_QNX" = "no" ]; then CFG_EGLFS="$CFG_EGL" else CFG_EGLFS="no" @@ -5562,7 +5318,7 @@ if [ "$CFG_EGLFS" != "no" ]; then fi if [ "$CFG_KMS" = "yes" ]; then - if [ "$CFG_OPENGL" = "es2" ] && [ "$CFG_EGL" = "yes" ]; then + if [ "$CFG_EGL" = "yes" ]; then CFG_KMS="yes" else CFG_KMS="no" @@ -5594,7 +5350,7 @@ if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then if [ "$XPLATFORM_MINGW" = "yes" ]; then QT_QPA_DEFAULT_PLATFORM="windows" - elif [ "$BUILD_ON_MAC" = "yes" ]; then + elif [ "$XPLATFORM_MAC" = "yes" ]; then QT_QPA_DEFAULT_PLATFORM="cocoa" elif [ "$UNAME_SYSTEM" = "QNX" ]; then QT_QPA_DEFAULT_PLATFORM="qnx" @@ -5621,7 +5377,7 @@ if [ "$CFG_KMS" = "yes" ]; then QT_CONFIG="$QT_CONFIG kms" fi -if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then +if [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_KMS" = "no" ]; then if [ "$QPA_PLATFORM_GUARD" = "yes" ] && ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_KMS" = "auto" ] ); then @@ -5896,6 +5652,10 @@ fi [ "$CFG_CXX11" = "yes" ] && QT_CONFIG="$QT_CONFIG c++11" +if [ "$CFG_SILENT" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG silent" +fi + # disable accessibility if [ "$CFG_ACCESSIBILITY" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY" @@ -5942,26 +5702,14 @@ else fi if [ "$CFG_OPENGL" = "es2" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES" -fi - -if [ "$CFG_OPENGL" = "es2" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2" + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES QT_OPENGL_ES_2" QT_CONFIG="$QT_CONFIG opengles2" fi -# build up the variables for output -if [ "$CFG_DEBUG" = "yes" ]; then - QMAKE_OUTDIR="${QMAKE_OUTDIR}debug" -elif [ "$CFG_DEBUG" = "no" ]; then - QMAKE_OUTDIR="${QMAKE_OUTDIR}release" -fi if [ "$CFG_SHARED" = "yes" ]; then - QMAKE_OUTDIR="${QMAKE_OUTDIR}-shared" QT_CONFIG="$QT_CONFIG shared" QTCONFIG_CONFIG="$QTCONFIG_CONFIG shared" elif [ "$CFG_SHARED" = "no" ]; then - QMAKE_OUTDIR="${QMAKE_OUTDIR}-static" QT_CONFIG="$QT_CONFIG static" QTCONFIG_CONFIG="$QTCONFIG_CONFIG static" fi @@ -5971,15 +5719,6 @@ QMAKE_CONFIG="$QMAKE_CONFIG qpa" QT_CONFIG="$QT_CONFIG qpa" QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa" -if [ "$XPLATFORM_MINGW" != "yes" ]; then - # Do not set this here for Windows. Let qmake do it so - # debug and release precompiled headers are kept separate. - QMakeVar set PRECOMPILED_DIR ".pch/$QMAKE_OUTDIR" -fi -QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" -QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" -QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR" -QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR" if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG largefile" fi @@ -6090,7 +5829,7 @@ if [ "$CFG_WIDGETS" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS" fi -if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then #On Mac we implicitly link against libz, so we #never use the 3rdparty stuff. [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" @@ -6107,7 +5846,6 @@ fi [ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv" [ "$CFG_ICONV" = "gnu" ] && QT_CONFIG="$QT_CONFIG gnu-libiconv" [ "$CFG_GLIB" = "yes" ] && QT_CONFIG="$QT_CONFIG glib" -[ "$CFG_GSTREAMER" = "yes" ] && QT_CONFIG="$QT_CONFIG gstreamer" [ "$CFG_DBUS" = "yes" ] && QT_CONFIG="$QT_CONFIG dbus" [ "$CFG_DBUS" = "linked" ] && QT_CONFIG="$QT_CONFIG dbus dbus-linked" [ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl" @@ -6120,7 +5858,7 @@ fi [ '!' -z "$DEFINES" ] && QMakeVar add DEFINES "$DEFINES" [ '!' -z "$L_FLAGS" ] && QMakeVar add LIBS "$L_FLAGS" -if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then +if [ "$XPLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then if [ "$CFG_RPATH" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname" fi @@ -6383,11 +6121,7 @@ full) *) tmpconfig="$outpath/src/corelib/global/qconfig.h.new" echo "#ifndef QT_BOOTSTRAPPED" >"$tmpconfig" - if [ -f "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" ]; then - cat "$relpath/src/corelib/global/qconfig-$CFG_QCONFIG.h" >>"$tmpconfig" - elif [ -f `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` ]; then - cat `"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` >>"$tmpconfig" - fi + cat "$CFG_QCONFIG_PATH" >>"$tmpconfig" echo "#endif" >>"$tmpconfig" ;; esac @@ -6417,11 +6151,15 @@ if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new" fi +if [ "$CFG_QREAL" != double ]; then + echo "#define QT_COORD_TYPE $CFG_QREAL" >>"$outpath/src/corelib/global/qconfig.h.new" +fi + if [ "$CFG_FRAMEWORK" = "yes" ]; then echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new" fi -if [ "$BUILD_ON_MAC" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF #if defined(__LP64__) # define QT_POINTER_SIZE 8 @@ -6496,7 +6234,6 @@ QMakeVar set sql-plugins "$SQL_PLUGINS" [ "$CFG_CUPS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CUPS" [ "$CFG_ICONV" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ICONV" [ "$CFG_GLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLIB" -[ "$CFG_GSTREAMER" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GSTREAMER" [ "$CFG_QGTKSTYLE" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_STYLE_GTK" [ "$CFG_CLOCK_MONOTONIC" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CLOCK_MONOTONIC" [ "$CFG_MREMAP" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_MREMAP" @@ -6661,8 +6398,8 @@ host_build { QT_TARGET_ARCH = $CFG_ARCH } else { QT_ARCH = $CFG_ARCH - QMAKE_DEFAULT_LIBDIRS = $DEFAULT_LIBDIRS - QMAKE_DEFAULT_INCDIRS = $DEFAULT_INCDIRS + QMAKE_DEFAULT_LIBDIRS = `shellQuoteLines "$DEFAULT_LIBDIRS"` + QMAKE_DEFAULT_INCDIRS = `shellQuoteLines "$DEFAULT_INCDIRS"` } QT_EDITION = $Edition QT_CONFIG += $QT_CONFIG @@ -6744,6 +6481,17 @@ echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS" >> "$QTMODULE.tmp" if [ -n "$CFG_SKIP_MODULES" ]; then echo "QT_SKIP_MODULES += $CFG_SKIP_MODULES" >> "$QTMODULE.tmp" fi +DISABLED_FEATURES= +for cfg in $QCONFIG_FLAGS; do + ncfg=${cfg#QT_NO_} + if [ x$ncfg != x$cfg ]; then + DISABLED_FEATURES="$DISABLED_FEATURES $ncfg" + fi +done +if [ -n "$DISABLED_FEATURES" ]; then + echo "QT_NO_DEFINES = $DISABLED_FEATURES" >> "$QTMODULE.tmp" +fi +echo "QT_QCONFIG_PATH = ${CFG_QCONFIG_PATH#$relpath/src/corelib/global/}" >> "$QTMODULE.tmp" cat >>"$QTMODULE.tmp" <<EOF host_build { @@ -6752,6 +6500,7 @@ host_build { QT_CPU_FEATURES.$CFG_ARCH = $CFG_CPUFEATURES } EOF +echo "QT_COORD_TYPE = $CFG_QREAL" >> "$QTMODULE.tmp" if [ -n "$QT_CFLAGS_PSQL" ]; then echo "QT_CFLAGS_PSQL = $QT_CFLAGS_PSQL" >> "$QTMODULE.tmp" @@ -6933,12 +6682,10 @@ report_support_plugin " GIF .................." "$CFG_GIF" qt QtGui report_support_plugin " JPEG ................." "$CFG_JPEG" "$CFG_LIBJPEG" QtGui report_support_plugin " PNG .................." "$CFG_PNG" "$CFG_LIBPNG" QtGui report_support " Glib ..................." "$CFG_GLIB" -report_support " GStreamer .............." "$CFG_GSTREAMER" report_support " GTK theme .............." "$CFG_QGTKSTYLE" report_support " Large File ............." "$CFG_LARGEFILE" -report_support " libudev ................" "$CFG_LIBUDEV" report_support " Networking:" -[ "$BUILD_ON_MAC" = "yes" ] && \ +[ "$XPLATFORM_MAC" = "yes" ] && \ report_support " CoreWlan ............." "$CFG_COREWLAN" report_support " getaddrinfo .........." "$CFG_GETADDRINFO" report_support " getifaddrs ..........." "$CFG_GETIFADDRS" @@ -6978,6 +6725,7 @@ report_support " Session management ....." "$CFG_SM" if [ "$XPLATFORM_QNX" = "yes" ]; then report_support " SLOG2 .................." "$CFG_SLOG2" report_support " IMF ...................." "$CFG_QNX_IMF" + report_support " PPS ...................." "$CFG_PPS" fi report_support " SQL drivers:" report_support " DB2 .................." "$CFG_SQL_db2" plugin "plugin" yes "built into QtSql" @@ -7015,11 +6763,15 @@ if [ "$ORIG_CFG_XKBCOMMON" != qt ] && [ "$CFG_XKBCOMMON" = qt ]; then echo "NOTE: libxkbcommon 0.2.0 (or higher) not found on the system, will use " echo "the bundled version from 3rd party directory." fi +if [ "$CFG_QREAL" = double ] && [ "$CFG_ARCH" = arm ]; then + echo "NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1." + echo "Configure with '-qreal float' to create a build that is binary compatible with 5.1." +fi exec 1>&3 3>&- # restore stdout cat $outpath/config.summary # display config feedback to user -if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then +if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then echo echo "Error: debug-only framework builds are not supported. Configure with -no-framework" echo "if you want a pure debug build." diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index bc0db0b9c8..8ba4547f93 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -99,6 +99,13 @@ QtNetwork - QHostInfo: * Allow QHostInfo::lookupHost() with no receiver to warm the DNS cache. + +QtSql +----- +This changelog as released was missing QtSql changes. +Please refer to changes-5.2.0 for QtSql 5.1.0 changes. + + QtWidgets --------- diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0 index a3a7db8190..f513d64626 100644 --- a/dist/changes-5.2.0 +++ b/dist/changes-5.2.0 @@ -16,36 +16,69 @@ Each of these identifiers can be entered in the bug tracker to obtain more information about a particular change. **************************************************************************** -* Library * +* Important Behavior Changes * **************************************************************************** -QtWidgets ---------- - -- QAbstractScrollArea now has a SizeAdjustPolicy. If it is set to AdjustToContents - it will make use of the new protected viewportSizeHint() (binary compatible since it - was reserved in Qt5). This function returns a suggested size based on contents. + - Qt is now compiled with qreal typedef'ed to double on all + platforms. qreal was a float on ARM chipsets before. This guarantees more + consistent behavior between all platforms Qt supports, but is binary + incompatible to Qt 5.1 on ARM. The old behavior can be restored by + passing -qreal float to configure. + - The supported date range in QDateTime has been reduced to about +/- 292 + million years, the range supported by the number of msecs since the Unix + epoch of 1 Jan 1970 as stored in a qint64, and as able to be used in the + setMSecsSinceEpoch() and toMSecsSinceEpoch() methods. -- QTreeView now has setTreePosition to allow the treestructure to show data from other - columns than logicalindex zero. + - QUrl and QUrlQuery: + * [QTBUG-31660] QUrl no longer considers all delimiter characters + equivalent to their percent-encoded forms. Now, both classes always + keep all delimiters exactly as they were in the original URL text. + * [QTBUG-31660] QUrl no longer decodes %7B and %7D to "{" and "}" in the + output of toString() + * QUrl no longer supports QUrl::FullyDecoded mode in authority() and + userInfo(), nor QUrl::DecodedMode in setAuthority() and setUserInfo(). + * [QTBUG-31945] QUrl no longer decodes %23 found in the fragment to "#" + in the output of toString(QUrl::FullyEncoded) or toEncoded() + * QUrl now defaults to decoded mode in the getters and setters for + userName, password, host, topLevelDomain, path and fileName. This + means a '%' in one of those fields is now returned (or set) as '%' + rather than "%25". In the unlikely case where the former behavior was + expected, pass PrettyDecoded to the getter and TolerantMode to the + setter. + * QUrl now normalizes the path given in setPath, removing ./ and ../ and + duplicate slashes. -- [QTBUG-4206] QTableView resizeToContents will now adjust to actual contents - and not just visible area. QHeaderView::setAutoResizePrecision() has been - introduced to control how precise the autoResize should be. +**************************************************************************** +* Library * +**************************************************************************** -- QFileDialog::setDefaultSuffix() removes leading dot characters. +QtCore +------ -- QSizePolicy got a retainSizeWhenHidden attribute. + - Added QCollator, a class to collate Unicode strings. + - Added QCommandLineParser, a class to parse command lines. + - Added QFileSelector, a class to select platform-specific file assets. + - Added QLoggingCategory and related functions for logging + - [QTBUG-23946] Fixed a bug that prevented Qt from being built in a + namespace on Mac OS X. + - Updated the locale database to CLDR 23.1 + - Added support for ARMv8 64-bit mode. -- [QTBUG-31602] QSpinBox size calculation will now be fixed when stylesheets are - used. + - Metatype system (QMetaType & QVariant): + * Qt now handles metatypes automatically for std::vector, std::list, + std::pair and std::map + * The metatype system now supports registering explicit conversion + functions via QMetaType::registerConverter + * The metatype system now supports iteration over a container type via + QSequentialIterable and QAssociativeIterable + * Registering the same type name twice will now print only a warning (as + opposed to aborting the execution of the program) -QtCore ------- -- [QTBUG-30250] QTime, QDateTime: - When calling QTime::toString(Qt::TextDate) and QTime::toString(Qt::ISODate), - milliseconds are now included in the returned string. This also applies to - QDateTime::toString(Qt::TextDate) and QDateTime::toString(ISODate). + - Qt Containers: + * In debug mode, the Qt containers will now verify whether the iterators + passed to most mutating functions belong to the iterator in question. + * Fixed a number of bugs that would modify shared containers when calling + erase(), under corner-case conditions. - QtAlgorithms With STL no longer being optional for building and using Qt, a number of parts @@ -76,30 +109,458 @@ QtCore - qLess (std::less) - qGreater (std::greater) + - QByteArray: + * Added QByteArray::Base64Url and QByteArray::OmitTrailingEquals flags + for QByteArray::toBase64 and fromBase64. + * [QTBUG-34694] Fixed a bug that would cause QByteArray to overflow some + size calculations. + + - QCoreApplication: + * [QTBUG-15379][QTBUG-30628] Fixed a bug that caused Qt to mis-parse a + command-line argument like -DKEY=\"VALUE\" on Windows. + + - QDateTime: + * [QTBUG-26161][QTBUG-29666] Fully implement support for Qt::TimeSpec of + Qt::OffsetFromUTC, added new methods for offsetFromUTC(), + toTimeSpec(), and toOffsetFromUTC(). + * Added convenience methods for fromMSecsSinceEpoch() and fromTime_t() + to take time spec to be used in returned datetime. + * Add method timeZoneAbbreviation() to return effective time zone + abbreviation. + * The debug datastream is now an ISO-like format instead of Qt::TextDate + * The Standard Time to Daylight Time transition for Qt::LocalTime is now + handled correctly. Any date set in the "missing" hour is now + considered invalid. All date math results that fall into the missing + hour will be automatically adjusted to a valid time in the following + hour. + * Added new method isDaylightTime() to return if the datetime is in + Daylight Time or not. + * Added support for a new Qt::TimeZone spec to be used with QTimeZone to + define times in a specific time zone. + * Added Qt::RFC2822Date format that can be passed to QDateTime and + QLocale formatters and parsers. + * Fixed a bug that caused QDate::toString() to return empty for dates + with years beyond 9999. + + - QFileSystemWatcher: + * [QTBUG-33211] Fixed a bug that caused QFileSystemWatcher to emit change + notifications with the wrong path on Linux. + + - QJson: + * [QTBUG-33229] The Writer and the Parser now fully accept non-character + unicode points. + * The Writer will no longer write inf, -inf and nan for infinites and NaN + values, which resulted in parsing back as strings. Instead, it will now + output null. + * The Writer now emits numeric values with full numeric precision. This + also allows QJson to support integer values with no loss of precision + up to 2^53. + + - QJsonValue: + * Added QJsonValue::toInt(). QJsonValue can store 32-bit signed integers + with no loss of precision. + + - QObject: + * New-style signal connections to functors, lambdas, and static functions + now works with a receiver object. The connection will be removed when + the either the sender or receiver objects are destroyed. + + - QPluginLoader: + * QPluginLoader will no longer load the plugins on Mac OS X and iOS + systems when scanning for valid plugins. + * Added QPluginLoader::staticPlugins(), which returns the list of + built-in plugins (linked to the executable and any loaded libraries). + + - QProcess: + * [QTBUG-32958] Fixed a bug that would cause QProcess to crash if + waitForStarted() were called after an unsuccessful start() + * Added QProcess::nullDevice(), which returns the platform's "blackhole" + device (/dev/null on Unix, NUL on Windows). This can be used with + QProcess::setStandardOutputFile. + * Added enum values QProcess::ForwardedOutputChannel and + QProcess::ForwardedErrorChannel, which allow for more fine-grained + control over which channel is forwarded and which one is captured. + * Added QProcess::ForwardedInputChannel, which allows for stdin to be + forwarded to this process's input. + * [QTBUG-32979] On Unix, QProcess now correctly forwards the siginfo_t + and context parameters of the signal handler to the previous handler. + + - QScopedPointer: + * Added QScopedPointerDeleteLater, a new class that can be used as the + second template to QScopedPointer and will call deleteLater() on the + pointer when it goes out of scope. + + - QSocketNotifier: + * Fixed a bug that caused socket notifiers not to be re-enabled after + they had been activated on BlackBerry. + + - QStandardPaths: + * QStandardPaths::enableTestMode is deprecated and is replaced by + QStandardPaths::setTestModeEnabled. + * Added QStandardPaths::GenericConfigLocation, which refers to a location + where applications can store config files to be shared with other + applications. + + - QThread: + * Added an advisory interrupt mechanism (QThread::requestInterruption and + QThread::isInterruptionRequested). + + - QThreadPool: + * Added method clear() to remove any queued QRunnables. + * Fixed a number of race conditions. + + - QTime: + * [QTBUG-30250] When calling QTime::toString(Qt::TextDate) and + QTime::toString(Qt::ISODate), milliseconds are now included in + the returned string. This also applies to + QDateTime::toString(Qt::TextDate) and + QDateTime::toString(ISODate). + * Added new methods fromMSecsSinceStartOfDay() to create a new QTime + from an msecs value, and msecsSinceStartOfDay() to return the QTime as + the number of msecs since the start of the day. + + - QTimeZone: + * Added new QTimeZone class to support time tone calculations using the + host platform time zone database and the Olsen time zone ID's. + + - QUrl: + * [QTBUG-33229] QUrl now fully accepts non-character unicode points; + they are encoded as percent characters; they can also be pretty + decoded + * Added QUrl::RemoveFilename flag which can be passed to path(), + authority() and toString() and will cause the filename part of the path + (the contents after the last '/') to be removed. + * Added QUrl::fileName(), which returns just the filename part of the + path. + * Added QUrl::NormalizePathSegments flag, which will cause QUrl to + remove "/./" or "/../" sequences as much as possible. It will not + remove "/../" from the beginning of the path. + * Added QUrl::adjusted(), which returns a new QUrl with certain parts of + the original URL removed or normalized. + * Added QUrl::matches(), which can be used to compare parts of two URLs + or to compare two URLs after normalization. + + - QUtf8: + * [QTBUG-33229] UTF-8 now accepts non-character unicode points; these + are not replaced by the replacement character anymore + + - QVariant: + * Fixed QVariant::canConvert with longlong + * Variant containing enum types can now be converted to integer + * [QTBUG-33981] Fixed a bug that would cause QPolygonF to be saved or + loaded incorrectly in QDataStream. + +QtDBus +------ + + - Improved error handling so as to give more feedback to the developer when + certain marshalling or demarshalling actions fail. + - [QTBUG-27809] Fixed some race conditions related to delivering method + reply deliveries. + - Fixed a bug that made non-slot invokables not get listed in the + auto-generated introspections. + +QtDeclarative +------------- + + - ColorDialog: + * Added currentColor property. + + - [QTBUG-32928] ShortcutOverride events now work for QQuickItem + subclasses + QtGui ----- -- [QTBUG-28228] Session Management: - The new QPlatformSessionManager class brings back the session management - functionality. It allows the implementation of platform specific behavior - related to session management. For platform that don't support this - feature the default behavior has not changed. - Both X11 and Windows session management are supported. + + - Accessibility classes are now public allowing accessibility + information for custom widgets/QQuickItems + + - Session Management: + * [QTBUG-28228] The new QPlatformSessionManager class brings back + the session management functionality. It allows the + implementation of platform specific behavior related to session + management. For platform that don't support this feature the + default behavior has not changed. Both X11 and Windows session + management are supported. + + - QPolygonF: + * When a QVariant holds a QPolygonF() then it will be correctly seen as + a null QVariant. + + - [QTBUG-27349] Reintroduced command line argument for positioning + windows (-geometry on X11, -qwindowgeometry on other platforms) QtNetwork --------- -- API was added to store and resume TLS session tickets. + - API was added to store and resume TLS session tickets. + - The minimum support openssl version has been increased to openssl + 1.0. The code to support older versions has not been removed, but is no + longer supported. + - An off-by-one error in NTLM proxy authentication has been fixed. + - Various improvements to reduce the memory used by qtnetwork have been + made. + - Improved support for HTTP proxy authentication. + - Support for preconnecting to servers before making HTTP and HTTPS + connections. This allows for much reduced latency when the hosts to be + connected to are known. + +QtPrintSupport +-------------- + + - QPrintDialog: + * Added support for setting CUPS job options in the print dialog. + * Added support for setting CUPS Banner pages in the print dialog. + * Added support for setting CUPS Page Set (even/odd pages only) in the + print dialog. + * Added support for setting CUPS Pages Per Sheet and Pages Per Sheet + Layout options + * Added CUPS server-side print range support for apps that can't support + print range option themselves + +QtSql +----- + +Changes in Qt 5.1.0 (missing from released changelog dist/changes-5.1.0) + - [QTBUG-28088] Remove dependency of DB driver headers on qsqlcachedresult_p.h. + - Deprecate QSqlError setters. The constructor is sufficient, since it has + a parameter for each member variable. + - Rename the SQL driver header files to _p.h (make private) + The drivers were never public API. They were exposed by mistake in + public headers. What's more, they have #include'd a private header + (qsqlcachedresult_p.h) since at least Qt 4.5.1. That means no one used + those headers in Qt 4 (private headers weren't installed then) and + it's unlikely anyone did in 5.0. + - ODBC: Implemented lastInsertId() for some ODBC compatible databases. + - PSQL: Make lastInsertID work for tables without OIDs. + - [QTBUG-14904] SQLITE: Fix for Sql query aliases with dots + - [QTBUG-2192] ODBC: fix loss of milliseconds when binding QDateTime + - [QTBUG-30076] PSQL: escape backslashes only when server requires it + IMPORTANT: Applications that implemented their own workarounds must be + updated to avoid misbehavior and SQL injection vulnerabilities. + - [QTBUG-10569] ODBC: fixed QODBCResult::exec() return value for DELETE + operations when no rows are affected. + - ODBC: Fixed loss of column metadata on SQL_NO_DATA. + - QSqlTableModel: expose methods for getting primary values. + - ODBC: Fixed possible cause of spurious errors (commit af35ee291a1bbbc8) + +Changes in Qt 5.2.0 + - [QTBUG-29261] IBASE: Construct a valid QTime when creating timestamps for + iBase SQL driver. + - [QTBUG-33389] PSQL: Format QDateTime following ISO8601. + - Add QSQLITE_OPEN_URI option to QSQLITE driver + +QtWidgets +--------- + + - [QTBUG-30255] Fixed a bug where spans across empty cells in a grid + layout got broken. + - [QTBUG-32788] Properly handles Qt::WidgetWithChildrenShortcut + shortcuts in MDI subwindows now. + - [QTBUG-33078] QWidget::setWindowOpacity() now works when called + before QWidget::show(). + - [QTBUG-33247] Changed accessible trees and tables to always expose + hidden headers, instead of only exposing the visible headers. + - [QTBUG-34007] Fixed a crash in tablet support. + - Fixed a bug where the maximum size hint of a layout with spans was + wrong. + - Item delegates now cycle through all three states of tri-state + checkboxes, the same way QCheckBox itself does. + + - QAbstractItemView: + * [QTBUG-7232] In ItemViews scrollbars will now by default only + scroll 1 pixel when scrollMode is set to scrollPerPixel. That is + it will (when scrollMode is scrollPerPixel) do what is stated in + the documentation, and no longer automatically adjust the + scrollbar's singleStep. The user can now control that value. + + - QAbstractScrollArea: + * QAbstractScrollArea now has a SizeAdjustPolicy. If it is set to + AdjustToContents it will make use of the protected viewportSizeHint() + virtual function. This function returns a suggested size based on + contents. Note that although the viewportSizeHint() virtual function + was reserved in 5.0, user code was not supposed to be overriding it + (as the function was private and undocumented). Code that was + overriding viewportSizeHint() needs to be recompiled against 5.2 for + this feature to work correctly. + + - QColorDialog: + * Added a web color QLineEdit. + * [QTBUG-14332] Added a screen color picker button. + * [QTBUG-31998] Does no longer create widgets when using the + platform dialog. + + - QComboBox: + * Added currentData() convenience function which allows to retrieve + the user data set for the current item. + + - QCompleter: + * [QTBUG-3414] Added filterMode property. + + - QDesktopWidget: + * [QTBUG-32567] Fixed emission of workAreaResized() signal. + + - QDialogButtonBox: + * Added a (StandardButtons,QWidget*) constructor. + + - QDockWidget: + * [QTBUG-31044] The position of a dock widget is now kept when + undocking. + * [QTBUG-32260] Fixed a bug where visibilityChanged was signaled + wrongly in certain multi-screen setups. + + - QFileDialog: + * setDefaultSuffix() now removes leading dot characters. + * Introduced DontUseCustomDirectoryIcons. This improves the file + dialog performance under Windows for the case where there are + lots of folders. Went from taking 60 seconds to 2 seconds, on a + SDCard with 10k folders. + * Added setMimeTypeFilters() for mimetype-based filtering, as an + alternative to pattern matching. + * Fixed removing of directories containing hidden or system files. + * Added QUrl-based API for remote files. + * [QTBUG-13182] Improved performance on Windows by + + not resolving NTFS symlinks (15x speedup on pessimistic + workloads) and + + using extensions over calling GetFileAttributesEx() in certain + cases. + * [QTBUG-29403] Fixed potential crash in destructor of + ~QFileInfoGather in threaded applications. + * [QTBUG-34132] QFileDialog does no longer instantiate widgets if a + native dialog will be used instead. Therefore some accessors + which previously returned unused objects will now return null. + As before, you can set the DontUseNativeDialog option to ensure + that widgets will be created and used instead. + * [QTBUG-33039] Does no longer create widgets when using the + platform dialog. + + - QFontDialog: + * Now has finer-grained control over the types of fonts listed, + similar to what QFontComboBox already had. + + - QGraphicsView etc + * Fixed a crash in QGraphicsProxyWidget. + * [QTBUG-8061] Allow handling of mouseDoubleClickEvent in + QGraphicsItems. + * [QTBUG-19036] Make QGraphicsScene::items(QPointF) work using + Qt::{Contains,Intersets}ItemBoundingRect with items that contain + the point in the bounding rectangle, but not their (custom) + shape. + + - QHeaderView: + * [QTBUG-4346] A maximumSize for sections has been introduced. The + maximum section size is by default the largest possible section + size which in Qt 5.2 has been limited to 1048575 pixels. + + - QInputDialog: + * Added getMultiLineText static method. + + - QLineEdit: + * Keep placeholderText visible when focused, until text is added. + * Context-menu actions now have icons. + * Made it possible to add side widgets. + * Made it possible to add a clear button commonly used for item + view filtering as a side widget + + - QListView: + * [QTBUG-1180] Dragging an item outside the QListView in icon mode + no longer loses the icon. Also fixed a bug where under certain + conditions code overriding QAbstractItemView::viewOptions() would + not be called. + + - QMenuBar: + * [QTBUG-32807] Menus now close again on second click. + + - QMessageBox: + * May use native message boxes on some platforms now. + * [QTBUG-6731] It is now possible to select some or all text from a + QMessageBox and copy it to the clipboard. + + - QSizePolicy: + * Added a retainSizeWhenHidden attribute. + + - QSpinBox: + * Values can now be displayed in different bases + (cf. displayIntegerBase property) + * [QTBUG-31602] Size calculation will now be fixed when stylesheets + are used. + + - QSplitter: + * Now gets the default value of opaqueResize property from (new) + QStyle::SH_Splitter_OpaqueResize styleHint. + + - QSystemTrayIcon: + * [QTBUG-31762] Fixed position of system tray icon on Linux/X11 + (except Unity). + * [QTBUG-33461] Increased the maximum length of a system tray + tooltip on Windows to what it was in Qt 4. + + - QTableView: + * [QTBUG-4206] resizeToContents will now adjust to actual contents + and not just visible area. QHeaderView::setAutoResizePrecision() + has been introduced to control how precise the autoResize should + be. + + - QTextEdit: + * Added placeholderText akin to QLineEdit. + * Context-menu actions now have icons. + + - QTreeView: + * QTreeView now has setTreePosition to allow the treestructure to + show data from other columns than logicalindex zero. + + - QWindowContainer: + * [QTBUG-32177] Sets active window correctly now. + + - QWizard: + * [QTBUG-29924] Gave all buttons an objectName(). + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + + +Android +------- + + - Project structure and deployment has changed with the introduction of + androiddeployqt. Source and build files are no longer mixed, and the + build files for the APK package should not be touched. Customizing + the build files is possible. Read the documentation for androiddeployqt + for more information. + - Status bar visibility is now controlled by Qt, so the window state will + override settings in the AndroidManifest.xml. The default is still to + show the status bar (QWindow::showMaximized()). Use + QWindow::showFullScreen() to hide it. + - Implemented support for accessibility on Android. + +OS X +---- -- The minimum support openssl version has been increased to openssl 1.0. The - code to support older versions has not been removed, but is no longer - supported. + - Qt for OS X is now identified by the macro Q_OS_OSX. This complements the + existing Q_OS_DARWIN macro (which identifies the open source kernel and + could identify non-Apple products) and Q_OS_MAC, which is defined for + both OS X and iOS. The old macro Q_OS_MACX is now deprecated. + - Qt no longer complains about new versions of OS X that haven't been + released yet. This will allow Qt 5.2 and future versions to build on + future versions yet to be released. Note that those versions are not + supported until official announcement by the Qt Project. + - Added a number of functions to QtCore to convert to and from + CFString/NSString and QString, CFURL/NSURL and QUrl. -- An off-by-one error in NTLM proxy authentication has been fixed. +Windows +------- -- Various improvements to reduce the memory used by qtnetwork have been made. + - [QTBUG-33409][QTBUG-8764][QTBUG-10032] Fixed virtual key mapping on + Windows. + - QCoreApplication::arguments() changed the handling of single quotes, double quotes + and the backslash character, in order to match what argv[] contains. + In particular, single quotes are no longer removed from the argument string. + (QTBUG-15379, QTBUG-30628) -- Improved support for HTTP proxy authentication. +X11 +--- -- Support for preconnecting to servers before making HTTP and HTTPS - connections. This allows for much reduced latency when the hosts to be - connected to are known. + - [QTBUG-31762] Fix position of system tray icon (except Unity) + - [QTBUG-27349] Reintroduced command line argument for positioning + windows (-geometry) diff --git a/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index 9ac80eb831..0a6e8dc5d1 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -30,6 +30,10 @@ \title Qt Creator: Deploying Applications to QNX Devices */ /*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-baremetal.html + \title Qt Creator: Connecting Bare Metal Devices +*/ +/*! \externalpage http://qt-project.org/doc/qtcreator/creator-developing-bb10.html \title Qt Creator: Connecting BlackBerry 10 Devices */ @@ -46,32 +50,8 @@ \title Qt Creator: Connecting Embedded Linux Devices */ /*! - \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-maemo.html - \title Qt Creator: Publishing Qt Content for Maemo Devices -*/ -/*! - \externalpage http://qt-project.org/doc/qtcreator/creator-maemo-emulator.html - \title Qt Creator: Using Maemo or MeeGo Harmattan Emulator -*/ -/*! - \externalpage http://qt-project.org/doc/qtcreator/creator-developing-meego.html - \title Qt Creator: Connecting MeeGo Harmattan Devices -*/ -/*! - \externalpage http://qt-project.org/doc/qtcreator/creator-developing-maemo.html - \title Qt Creator: Connecting Maemo Devices -*/ -/*! - \externalpage http://qt-project.org/doc/qtcreator/creator-publish-ovi-meego.html - \title Qt Creator: Publishing Qt Content for MeeGo Harmattan Devices -*/ -/*! - \externalpage http://qt-project.org/doc/qtcreator/creator-publishing-to-maemo-extras.html - \title Qt Creator: Publishing Maemo Applications to Extras-devel -*/ -/*! \externalpage http://qt-project.org/doc/qtcreator/creator-deployment-maemo.html - \title Qt Creator: Deploying Applications to Linux-Based Devices + \title Qt Creator: Deploying Applications to Embedded Linux Devices */ /*! \externalpage http://qt-project.org/doc/qtcreator/creator-faq.html @@ -118,14 +98,6 @@ \title Qt Creator: Creating Screens */ /*! - \externalpage http://qt-project.org/doc/qtcreator/quick-animations.html - \title Qt Creator: Animating Screens -*/ -/*! - \externalpage http://qt-project.org/doc/qtcreator/quick-user-interaction.html - \title Qt Creator: Adding User Interaction Methods -*/ -/*! \externalpage http://qt-project.org/doc/qtcreator/creator-qml-application.html \title Qt Creator: Creating a Qt Quick Application */ @@ -142,10 +114,6 @@ \title Qt Creator: Developing Qt Quick Applications */ /*! - \externalpage http://qt-project.org/doc/qtcreator/quick-application-logic.html - \title Qt Creator: Implementing Application Logic -*/ -/*! \externalpage http://qt-project.org/doc/qtcreator/creator-using-qt-quick-designer.html \title Qt Creator: Using Qt Quick Designer */ @@ -369,6 +337,12 @@ \externalpage http://qt-project.org/doc/qtcreator/creator-deploying-android.html \title Qt Creator: Deploying Applications to Android Devices */ + +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-developing-ios.html + \title Qt Creator: Connecting iOS devices +*/ + /*! \externalpage http://qt-project.org/doc/qtcreator/creator-developing-android.html \title Qt Creator: Connecting Android Devices @@ -489,3 +463,7 @@ \externalpage http://qt-project.org/doc/qtcreator/creator-configuring.html \title Qt Creator: Configuring Qt Creator */ +/*! + \externalpage http://qt-project.org/doc/qtcreator/creator-debuggers.html + \title Qt Creator: Adding Debuggers +*/ diff --git a/doc/global/html-footer.qdocconf b/doc/global/html-footer.qdocconf index 6c26dc7c29..c53eb2f599 100644 --- a/doc/global/html-footer.qdocconf +++ b/doc/global/html-footer.qdocconf @@ -7,24 +7,14 @@ HTML.footer = \ " </div>\n" \ "</div>\n" \ "<div class=\"footer\">\n" \ - " <div class=\"qt13a-copyright\" id=\"copyright\">\n" \ - " <div class=\"qt13a-container\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2013 Digia Plc and/or its\n" \ - " subsidiaries. Documentation contributions included herein are the copyrights of\n" \ - " their respective owners.</p>\n" \ - " <p>\n" \ - " The documentation provided herein is licensed under the terms of the\n" \ - " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation\n" \ - " License version 1.3</a> as published by the Free Software Foundation.</p>\n" \ - " <p>\n" \ - " Documentation sources may be obtained from <a href=\"http://www.qt-project.org\">\n" \ - " www.qt-project.org</a>.</p>\n" \ - " <p>\n" \ - " Digia, Qt and their respective logos are trademarks of Digia Plc \n" \ - " in Finland and/or other countries worldwide. All other trademarks are property\n" \ - " of their respective owners. <a title=\"Privacy Policy\"\n" \ - " href=\"http://en.gitorious.org/privacy_policy/\">Privacy Policy</a></p>\n" \ - " </div>\n" \ - " </div>\n" \ + " <p>\n" \ + " <acronym title=\"Copyright\">©</acronym> 2013 Digia Plc and/or its\n" \ + " subsidiaries. Documentation contributions included herein are the copyrights of\n" \ + " their respective owners.<br>" \ + " The documentation provided herein is licensed under the terms of the" \ + " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation" \ + " License version 1.3</a> as published by the Free Software Foundation.<br>" \ + " Digia, Qt and their respective logos are trademarks of Digia Plc " \ + " in Finland and/or other countries worldwide. All other trademarks are property\n" \ + " of their respective owners. </p>\n" \ "</div>\n" \ diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf index 93cd7ddc55..fb0f5c200b 100644 --- a/doc/global/manifest-meta.qdocconf +++ b/doc/global/manifest-meta.qdocconf @@ -32,7 +32,7 @@ # manifestmeta.global.names = * # manifestmeta.global.tags = qt5 -manifestmeta.filters = highlighted webkit1 webkit2 android thumbnail +manifestmeta.filters = highlighted webkit1 webkit2 android thumbnail ios manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ "QtQuick/Qt Quick Demo - Photo Surface" \ @@ -125,8 +125,11 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \ "QtLinguist/Arrow Pad Example" \ "QtGui/Raster Window Example" \ "QtGui/Analog Clock Window Example" \ - "QtMultimediaWidgets/Video Widget Example" \ - "QtMultimediaWidgets/Media Player Example" \ + "QtAndroidExtras/Qt Notifier" \ + "QtMultimedia/QML Video Shader Effects Example" \ + "QtMultimedia/QML Video Example" \ + "QtMultimedia/QML Camera Example" \ + "QtMultimedia/Audio Output Example" \ "QtSVG/Text Object Example" \ "QtQML/Qt Quick Examples - XMLHttpRequest" \ "QtQuick/Qt Quick Particles Examples - *" \ @@ -138,6 +141,9 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \ "QtQuick/Qt Quick Examples - Animation" \ "QtQuick/Qt Quick Examples - Shader Effects" \ "QtQuick/Qt Quick Examples - Canvas" \ + "QtQuick/Qt Quick Examples - MouseArea" \ + "QtQuick/Qt Quick Examples - Positioners" \ + "QtQuick/Qt Quick Examples - Right to Left" \ "QtWidgets/Interview" \ "QtWidgets/Spreadsheet" \ "QtWidgets/Pixelator Example" \ @@ -164,11 +170,106 @@ manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \ "QtQML/Extending QML - Methods Example" \ "QtQML/Extending QML - Signal Support Example" \ "QtQML/Extending QML - Attached Properties Example" \ - "QtQuick/Qt Quick Examples - Window and Screen" \ "QtWidgets/Address Book Example" manifestmeta.android.tags = android +manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \ + "QtCore/Mandelbrot Example" \ + "QtCore/Queued Custom Type Example" \ + "QtGui/Analog Clock Window Example" \ + "QtGui/OpenGL Window Example" \ + "QtGui/Raster Window Example" \ + "QtNetwork/Loopback Example" \ + "QtNetwork/Network Chat Example" \ + "QtNetwork/Torrent Example" \ + "QtOpenGL/2D Painting Example" \ + "QtOpenGL/Textures Example" \ + "QtWidgets/Animated Tiles Example" \ + "QtWidgets/Application Chooser Example" \ + "QtWidgets/Easing Curves Example" \ + "QtWidgets/Move Blocks Example" \ + "QtWidgets/States Example" \ + "QtWidgets/Class Wizard Example" \ + "QtWidgets/Find Files Example" \ + "QtWidgets/License Wizard Example" \ + "QtWidgets/Standard Dialogs Example" \ + "QtWidgets/Tab Dialog Example" \ + "QtWidgets/Trivial Wizard Example" \ + "QtWidgets/Draggable Text Example" \ + "QtWidgets/Fridge Magnets Example" \ + "QtWidgets/Blur Picker Effect Example" \ + "QtWidgets/Fade Message Effect Example" \ + "QtWidgets/Lighting Effect Example" \ + "QtWidgets/Anchor Layout Example" \ + "QtWidgets/Basic Graphics Layouts Example" \ + "QtWidgets/40000 Chips" \ + "QtWidgets/Colliding Mice Example" \ + "QtWidgets/Diagram Scene Example" \ + "QtWidgets/Elastic Nodes Example" \ + "QtWidgets/Embedded Dialogs" \ + "QtWidgets/Graphics View Flow Layout Example" \ + "QtWidgets/Simple Anchor Layout Example" \ + "QtWidgets/Weather Anchor Layout Example" \ + "QtWidgets/Address Book Example" \ + "QtWidgets/Basic Sort/Filter Model Example" \ + "QtWidgets/Chart Example" \ + "QtWidgets/Custom Sort/Filter Model Example" \ + "QtWidgets/Dir View Example" \ + "QtWidgets/Editable Tree Model Example" \ + "QtWidgets/Frozen Column Example" \ + "QtWidgets/Interview" \ + "QtWidgets/Simple Tree Model Example" \ + "QtWidgets/Simple Widget Mapper Example" \ + "QtWidgets/Basic Layouts Example" \ + "QtWidgets/Border Layout Example" \ + "QtWidgets/Flow Layout Example" \ + "QtWidgets/Basic Drawing Example" \ + "QtWidgets/Concentric Circles Example" \ + "QtWidgets/Font Sampler Example" \ + "QtWidgets/Gradients" \ + "QtWidgets/Image Composition Example" \ + "QtWidgets/Painter Paths Example" \ + "QtWidgets/Transformations Example" \ + "QtWidgets/Calendar Example" \ + "QtWidgets/Order Form Example" \ + "QtWidgets/Syntax Highlighter Example" \ + "QtWidgets/Text Edit" \ + "QtWidgets/Traffic Light Example" \ + "QtWidgets/Two-way Button Example" \ + "QtWidgets/Completer Example" \ + "QtWidgets/Custom Completer Example" \ + "QtWidgets/Undo Framework" \ + "QtWidgets/Analog Clock Example" \ + "QtWidgets/Calculator Example" \ + "QtWidgets/Calendar Widget Example" \ + "QtWidgets/Character Map Example" \ + "QtWidgets/Code Editor Example" \ + "QtWidgets/Digital Clock Example" \ + "QtWidgets/Elided Label Example" \ + "QtWidgets/Line Edits Example" \ + "QtWidgets/Scribble Example" \ + "QtWidgets/Shaped Clock Example" \ + "QtWidgets/Sliders Example" \ + "QtWidgets/Validators Example" \ + "QtWidgets/Window Flags Example" \ + "QtWidgets/Wiggly Example" \ + "QtQuick/Qt Quick Examples - Animation" \ + "QtQuick/Qt Quick Examples - Canvas" \ + "QtQuick/Qt Quick Examples - Drag and Drop" \ + "QtQuick/Qt Quick Examples - Image Elements" \ + "QtQuick/Qt Quick Examples - MouseArea" \ + "QtQuick/Qt Quick Examples - Positioners" \ + "QtQuick/Qt Quick Examples - Right to Left" \ + "QtQuick/Scene Graph - OpenGL Under QML" \ + "QtQuick/Qt Quick Examples - Shader Effects" \ + "QtQuick/Qt Quick Examples - Text" \ + "QtQuick/Qt Quick Examples - Touch Interaction" \ + "QtQuick/Qt Quick Examples - Views" \ + "QtQuick/Qt Quick Examples - Window and Screen" + +manifestmeta.ios.tags = ios + # add a generic thumbnail image to examples that do not have any images in their documentation manifestmeta.thumbnail.attributes = "imageUrl:qthelp\://org.qt-project.qtdoc.$QT_VERSION_TAG/qtdoc/images/qt-codesample.png" diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index b1738e129f..528b0cd561 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -15,6 +15,7 @@ defines += Q_QDOC \ Q_NO_USING_KEYWORD \ __cplusplus \ Q_COMPILER_INITIALIZER_LISTS \ + Q_COMPILER_UNIFORM_INIT \ Q_COMPILER_RVALUE_REFS Cpp.ignoretokens += \ diff --git a/doc/global/template/style/offline.css b/doc/global/template/style/offline.css index 5dc4908aff..81e11aac0b 100644 --- a/doc/global/template/style/offline.css +++ b/doc/global/template/style/offline.css @@ -192,7 +192,29 @@ footer and license */ .footer { - text-align: center + text-align: left; + margin-top: 50px; + padding-left: 5px; + margin-bottom: 10px; + font-size: 10px; + border-top: 1px solid #999; + padding-top: 11px; +} + +.footer p { + line-height: 14px; + font-size: 11px; +} + +.footer a[href*="http://"], a[href*="ftp://"], a[href*="https://"] { + font-weight: bold; +} + +.footerNavi { + width: auto; + text-align: right; + margin-top: 50px; + z-index: 1; } .navigationbar { @@ -244,16 +266,6 @@ footer and license padding-right: 17px; } -/* ------------ -footer and license ------------ -*/ - -.footer { - text-align: center -} - #buildversion { font-style: italic; font-size: small; @@ -492,22 +504,6 @@ ol { padding: 20px 20px 20px 20px; } -.footer { - margin-top: 50px; - padding-left: 5px; - margin-bottom: 10px; - font-size: 10px; - border-top: 1px solid #999; - padding-top: 11px; -} - -.footerNavi { - width: auto; - text-align: right; - margin-top: 50px; - z-index: 1; -} - .memItemLeft { padding-right: 3px } diff --git a/examples/qtconcurrent/imagescaling/imagescaling.cpp b/examples/qtconcurrent/imagescaling/imagescaling.cpp index 01083edb4e..9cc8ef655d 100644 --- a/examples/qtconcurrent/imagescaling/imagescaling.cpp +++ b/examples/qtconcurrent/imagescaling/imagescaling.cpp @@ -40,8 +40,6 @@ #include "imagescaling.h" #include "math.h" -#ifndef QT_NO_CONCURRENT - const int imageSize = 100; QImage scale(const QString &imageFileName) @@ -141,5 +139,3 @@ void Images::finished() cancelButton->setEnabled(false); pauseButton->setEnabled(false); } - -#endif // QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/imagescaling/imagescaling.h b/examples/qtconcurrent/imagescaling/imagescaling.h index 3c02db05b9..a84e2bdb6d 100644 --- a/examples/qtconcurrent/imagescaling/imagescaling.h +++ b/examples/qtconcurrent/imagescaling/imagescaling.h @@ -43,8 +43,6 @@ #include <QtWidgets> #include <QtConcurrent> -#ifndef QT_NO_CONCURRENT - class Images : public QWidget { Q_OBJECT @@ -65,18 +63,4 @@ private: QFutureWatcher<QImage> *imageScaling; }; -#else - -// Dummy class required because QT_NO_CONCURRENT is not set when moc is run. -class Images : public QWidget -{ -Q_OBJECT -public Q_SLOTS: - void open() {} - void showImage(int) {} - void finished() {} -}; - -#endif // QT_NO_CONCURRENT - #endif // IMAGESCALING_H diff --git a/examples/qtconcurrent/imagescaling/main.cpp b/examples/qtconcurrent/imagescaling/main.cpp index ccdea2e771..442c8a4771 100644 --- a/examples/qtconcurrent/imagescaling/main.cpp +++ b/examples/qtconcurrent/imagescaling/main.cpp @@ -40,8 +40,6 @@ #include <QtWidgets> #include <QtConcurrent> -#ifndef QT_NO_CONCURRENT - #include "imagescaling.h" int main(int argc, char *argv[]) @@ -53,21 +51,3 @@ int main(int argc, char *argv[]) return app.exec(); } - -#else - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QString text("Qt Concurrent is not supported on this platform"); - - QLabel *label = new QLabel(text); - label->setWordWrap(true); - - label->show(); - qDebug() << text; - - app.exec(); -} - -#endif diff --git a/examples/qtconcurrent/progressdialog/main.cpp b/examples/qtconcurrent/progressdialog/main.cpp index c646105db6..01d4aef256 100644 --- a/examples/qtconcurrent/progressdialog/main.cpp +++ b/examples/qtconcurrent/progressdialog/main.cpp @@ -41,8 +41,6 @@ #include <QtWidgets> #include <QtConcurrent> -#ifndef QT_NO_CONCURRENT - using namespace QtConcurrent; const int iterations = 20; @@ -88,22 +86,3 @@ int main(int argc, char **argv) // Query the future to check if was canceled. qDebug() << "Canceled?" << futureWatcher.future().isCanceled(); } - -#else - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QString text("Qt Concurrent is not yet supported on this platform"); - - QLabel *label = new QLabel(text); - label->setWordWrap(true); - - label->show(); - qDebug() << text; - - app.exec(); -} - -#endif - diff --git a/examples/qtconcurrent/runfunction/main.cpp b/examples/qtconcurrent/runfunction/main.cpp index 0e62bd0a75..85c5e1267a 100644 --- a/examples/qtconcurrent/runfunction/main.cpp +++ b/examples/qtconcurrent/runfunction/main.cpp @@ -44,8 +44,6 @@ #include <qtconcurrentrun.h> #include <QApplication> -#ifndef QT_NO_CONCURRENT - using namespace QtConcurrent; void hello(QString name) @@ -61,23 +59,3 @@ int main(int argc, char **argv) f1.waitForFinished(); f2.waitForFinished(); } - -#else - -#include <QLabel> - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QString text("Qt Concurrent is not yet supported on this platform"); - - QLabel *label = new QLabel(text); - label->setWordWrap(true); - - label->show(); - qDebug() << text; - - app.exec(); -} - -#endif diff --git a/examples/qtconcurrent/wordcount/main.cpp b/examples/qtconcurrent/wordcount/main.cpp index 635951fd4a..408e92dbb3 100644 --- a/examples/qtconcurrent/wordcount/main.cpp +++ b/examples/qtconcurrent/wordcount/main.cpp @@ -50,8 +50,6 @@ #include <qtconcurrentmap.h> -#ifndef QT_NO_CONCURRENT - using namespace QtConcurrent; /* @@ -155,23 +153,3 @@ int main(int argc, char** argv) } qDebug() << "MapReduce speedup x" << ((double)singleThreadTime - (double)mapReduceTime) / (double)mapReduceTime + 1; } - -#else - -#include <QLabel> - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - QString text("Qt Concurrent is not yet supported on this platform"); - - QLabel *label = new QLabel(text); - label->setWordWrap(true); - - label->show(); - qDebug() << text; - - app.exec(); -} - -#endif diff --git a/examples/threads/doc/src/queuedcustomtype.qdoc b/examples/threads/doc/src/queuedcustomtype.qdoc index ffeb3dd805..40ec2668de 100644 --- a/examples/threads/doc/src/queuedcustomtype.qdoc +++ b/examples/threads/doc/src/queuedcustomtype.qdoc @@ -42,8 +42,9 @@ \section1 Overview - In the \l{Custom Type Sending Example}, we showed how to use a custom type - with signal-slot communication within the same thread. + In the \l{Custom Type Example}, we showed how to integrate custom types with + the meta-object system, enabling them to be stored in QVariant objects, written + out in debugging information and used in signal-slot communication. In this example, we create a new value class, \c Block, and register it with the meta-object system to enable us to send instances of it between @@ -152,7 +153,7 @@ meta-object system so that it can be used with signal-slot connections between threads. For ordinary communication involving direct signals and slots, it is enough to simply declare the type in the way described in the - \l{Custom Type Sending Example}. + \l{Custom Type Example}. In practice, both the Q_DECLARE_METATYPE() macro and the qRegisterMetaType() template function can be used to register custom types, but diff --git a/examples/threads/doc/src/semaphores.qdoc b/examples/threads/doc/src/semaphores.qdoc index 494ed7592a..e90045f824 100644 --- a/examples/threads/doc/src/semaphores.qdoc +++ b/examples/threads/doc/src/semaphores.qdoc @@ -54,7 +54,7 @@ An alternative to using QSemaphore to solve the producer-consumer problem is to use QWaitCondition and QMutex. This is what the - \l{threads/waitconditions}{Wait Conditions} example does. + \l{Wait Conditions Example} does. \section1 Global Variables diff --git a/examples/threads/doc/src/waitconditions.qdoc b/examples/threads/doc/src/waitconditions.qdoc index 1439824a78..25c9ce88fb 100644 --- a/examples/threads/doc/src/waitconditions.qdoc +++ b/examples/threads/doc/src/waitconditions.qdoc @@ -54,7 +54,7 @@ An alternative to using QWaitCondition and QMutex to solve the producer-consumer problem is to use QSemaphore. This is what the - \l{threads/semaphores}{Semaphores} example does. + \l{Semaphores Example} does. \section1 Global Variables diff --git a/examples/tools/doc/src/customtype.qdoc b/examples/tools/doc/src/customtype.qdoc index 6e6d08fb35..e016933e04 100644 --- a/examples/tools/doc/src/customtype.qdoc +++ b/examples/tools/doc/src/customtype.qdoc @@ -132,8 +132,8 @@ \section1 Further Reading The custom \c Message type can also be used with direct signal-slot - connections; see the \l{Custom Type Sending Example} for a demonstration - of this. + connections. + To register a custom type for use with queued signals and slots, such as those used in cross-thread communication, see the \l{Queued Custom Type Example}. diff --git a/examples/widgets/doc/src/padnavigator.qdoc b/examples/widgets/doc/src/padnavigator.qdoc index 55a6b5e4ac..391ef62587 100644 --- a/examples/widgets/doc/src/padnavigator.qdoc +++ b/examples/widgets/doc/src/padnavigator.qdoc @@ -32,8 +32,8 @@ \brief Demonstrates how to create animated user interface The Pad Navigator Example shows how you can use Graphics View together with - embedded widgets and Qt's \l{State Machine Framework} to create a simple - but useful, dynamic, animated user interface. + embedded widgets and Qt's \l{The State Machine Framework}{state machine + framework} to create a simple but useful, dynamic, animated user interface. \image padnavigator-example.png diff --git a/examples/widgets/doc/src/wiggly.qdoc b/examples/widgets/doc/src/wiggly.qdoc index 9430a3ed36..c2b920decd 100644 --- a/examples/widgets/doc/src/wiggly.qdoc +++ b/examples/widgets/doc/src/wiggly.qdoc @@ -42,8 +42,8 @@ time has passed, it sends a QTimerEvent to a QObject of our choice. This makes QBasicTimer a more lightweight alternative to QTimer. Qt's built-in widgets use it internally, and it is - provided in Qt's API for highly-optimized applications (e.g., - \l{Qt for Embedded Linux} applications). + provided in Qt's API for highly-optimized applications (such as + embedded applications). The example consists of two classes: diff --git a/examples/widgets/tutorials/threads/clock/clock.pro b/examples/widgets/tutorials/threads/clock/clock.pro deleted file mode 100644 index 041c02bea8..0000000000 --- a/examples/widgets/tutorials/threads/clock/clock.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += widgets -CONFIG += console -TEMPLATE = app -SOURCES += main.cpp \ - clockthread.cpp -HEADERS += clockthread.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/clock -INSTALLS += target diff --git a/examples/widgets/tutorials/threads/clock/clockthread.cpp b/examples/widgets/tutorials/threads/clock/clockthread.cpp deleted file mode 100644 index 5068a9b14a..0000000000 --- a/examples/widgets/tutorials/threads/clock/clockthread.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtWidgets> -#include "clockthread.h" - - //This class starts another thread where it emits a signal for every new second. - -//! [1] -// clock/clockthread.cpp -void ClockThread::run() -{ - QTimer timer; - connect(&timer, SIGNAL(timeout()), this, SLOT(timerHit()), Qt::DirectConnection); - timer.setInterval(10); - timer.start(); // puts one event in the threads event queue - exec(); - timer.stop(); -} - -void ClockThread::timerHit() -{ - QString newTime= QDateTime::currentDateTime().toString("ddd MMMM d yy, hh:mm:ss"); - if(m_lastTime != newTime ){ - m_lastTime = newTime; - emit sendTime(newTime) ; - } -} -//! [1] diff --git a/examples/widgets/tutorials/threads/clock/clockthread.h b/examples/widgets/tutorials/threads/clock/clockthread.h deleted file mode 100644 index 9d3b06ddd8..0000000000 --- a/examples/widgets/tutorials/threads/clock/clockthread.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CLOCKTHREAD_H -#define CLOCKTHREAD_H - -#include <QString> -#include <QThread> - - - -//! [1] -// clock/clockthread.h -class ClockThread : public QThread -{ - Q_OBJECT -signals: - void sendTime(QString time); -private: - void run(); - QString m_lastTime; -private slots: - void timerHit(); - -}; -//! [1] -#endif // CLOCKTHREAD_H
\ No newline at end of file diff --git a/examples/widgets/tutorials/threads/clock/main.cpp b/examples/widgets/tutorials/threads/clock/main.cpp deleted file mode 100644 index f90318027c..0000000000 --- a/examples/widgets/tutorials/threads/clock/main.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtWidgets> -#include "clockthread.h" - -//A clock that does time formatting in another thread - -//! [1] -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - // build gui - QWidget widget; - QLabel *label = new QLabel; - QHBoxLayout *layout = new QHBoxLayout(&widget); - layout->addWidget(label); - widget.setWindowTitle("clock"); - - //instantiate thread object - ClockThread clockThread; - QObject::connect(&clockThread, SIGNAL(sendTime(QString)), label, SLOT(setText(QString)), Qt::QueuedConnection); - clockThread.start(); - widget.show(); - app.exec(); - clockThread.quit(); - clockThread.wait(); - return 0; -} -//! [1] diff --git a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp b/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp deleted file mode 100644 index 773c685ba0..0000000000 --- a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore> -#include <QtConcurrent> - -/* - says hello from main thread and secondary thread using QtConcurrent -*/ - -//! [1] -// helloconcurrent/main.cpp -void hello() -{ - qDebug() << "Hello from thread " << QThread::currentThread(); -} - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - QFuture<void> future = QtConcurrent::run(hello); - qDebug() << "hello from GUI thread " << QThread::currentThread(); - future.waitForFinished(); - return 0; -} -//! [1] diff --git a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro b/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro deleted file mode 100644 index 7e6da1133c..0000000000 --- a/examples/widgets/tutorials/threads/helloconcurrent/helloconcurrent.pro +++ /dev/null @@ -1,14 +0,0 @@ -QT -= gui -QT += concurrent - -CONFIG += console -CONFIG -= app_bundle -TEMPLATE = app -SOURCES += helloconcurrent.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/helloconcurrent -INSTALLS += target - - - diff --git a/examples/widgets/tutorials/threads/hellothread/hellothread.cpp b/examples/widgets/tutorials/threads/hellothread/hellothread.cpp deleted file mode 100644 index 1b5088e0db..0000000000 --- a/examples/widgets/tutorials/threads/hellothread/hellothread.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QDebug> -#include "hellothread.h" -/* - * demonstrates use of QThread, says hello in another thread and terminates - */ - -void HelloThread::run() -{ - qDebug() << "hello from worker thread " << thread()->currentThreadId(); -} diff --git a/examples/widgets/tutorials/threads/hellothread/hellothread.h b/examples/widgets/tutorials/threads/hellothread/hellothread.h deleted file mode 100644 index 281f2c6cb5..0000000000 --- a/examples/widgets/tutorials/threads/hellothread/hellothread.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef HELLOTHREAD_H -#define HELLOTHREAD_H - -#include <QThread> - -class HelloThread : public QThread -{ - Q_OBJECT -private: - void run(); -}; - -#endif // HELLOTHREAD_H diff --git a/examples/widgets/tutorials/threads/hellothread/hellothread.pro b/examples/widgets/tutorials/threads/hellothread/hellothread.pro deleted file mode 100644 index 40fd33b146..0000000000 --- a/examples/widgets/tutorials/threads/hellothread/hellothread.pro +++ /dev/null @@ -1,14 +0,0 @@ -QT -= gui - -CONFIG += console -CONFIG -= app_bundle -TEMPLATE = app -SOURCES += main.cpp \ - hellothread.cpp -HEADERS += hellothread.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/hellothread -INSTALLS += target - - diff --git a/examples/widgets/tutorials/threads/hellothread/main.cpp b/examples/widgets/tutorials/threads/hellothread/main.cpp deleted file mode 100644 index 8b4b00874f..0000000000 --- a/examples/widgets/tutorials/threads/hellothread/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore> -#include "hellothread.h" - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - HelloThread thread; - thread.start(); - qDebug() << "hello from GUI thread " << app.thread()->currentThreadId(); - thread.wait(); // do not exit before the thread is completed! - return 0; -} diff --git a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp b/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp deleted file mode 100644 index f904159fe4..0000000000 --- a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QtCore> -// A hello world program to demonstrate the use of the global thread pool - -//! [1] -// hellothreadpool/main.cpp -class Work : public QRunnable -{ -public: - void run() - { - qDebug() << "Hello from thread " << QThread::currentThread(); - } -}; - -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - Work work; - work.setAutoDelete(false); - QThreadPool *threadPool = QThreadPool::globalInstance(); - threadPool->start(&work); - qDebug() << "hello from GUI thread " << QThread::currentThread(); - threadPool->waitForDone(); - return 0; -} -//! [1] diff --git a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro b/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro deleted file mode 100644 index d5404a5134..0000000000 --- a/examples/widgets/tutorials/threads/hellothreadpool/hellothreadpool.pro +++ /dev/null @@ -1,14 +0,0 @@ -QT -= gui - -CONFIG += console -CONFIG -= app_bundle -TEMPLATE = app -SOURCES += hellothreadpool.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/hellothreadpool -INSTALLS += target - - - - diff --git a/examples/widgets/tutorials/threads/movedobject/main.cpp b/examples/widgets/tutorials/threads/movedobject/main.cpp deleted file mode 100644 index 2894707fda..0000000000 --- a/examples/widgets/tutorials/threads/movedobject/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore> -#include "workerobject.h" -#include "thread.h" - -/* - * moves a class derived from QObject (WorkerObject) to another thread - * and calls methods over thread boundaries. - */ - -//![1] -// movedobject/main.cpp -int main(int argc, char *argv[]) -{ - QCoreApplication app(argc, argv); - Thread thread; - qDebug() << "main thread ID: " << app.thread()->currentThreadId(); - WorkerObject *worker = new WorkerObject; - thread.launchWorker(worker); - QMetaObject::invokeMethod(worker, "doWork", Qt::QueuedConnection); - QMetaObject::invokeMethod(worker, "startPolling", Qt::QueuedConnection, Q_ARG(int, 500)); - //let application produce output for 3 seconds and quit - QTimer::singleShot(3000, &app, SLOT(quit())); - app.exec(); - thread.stop(); - thread.wait(); - delete worker; - return 0; -} -//![1] diff --git a/examples/widgets/tutorials/threads/movedobject/movedobject.pro b/examples/widgets/tutorials/threads/movedobject/movedobject.pro deleted file mode 100644 index b2ea7e5366..0000000000 --- a/examples/widgets/tutorials/threads/movedobject/movedobject.pro +++ /dev/null @@ -1,15 +0,0 @@ -QT += widgets -CONFIG += console -CONFIG -= app_bundle -TEMPLATE = app -SOURCES += main.cpp \ - workerobject.cpp \ - thread.cpp - -HEADERS += \ - workerobject.h \ - thread.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/movedobject -INSTALLS += target diff --git a/examples/widgets/tutorials/threads/movedobject/thread.cpp b/examples/widgets/tutorials/threads/movedobject/thread.cpp deleted file mode 100644 index 2b6c2ffbd6..0000000000 --- a/examples/widgets/tutorials/threads/movedobject/thread.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "thread.h" - -/* - * QThread derived class with additional capability to move a QObject to the - * new thread, to stop the thread and move the QObject back to the thread where - *it came from. - */ - -Thread::Thread( QObject *parent) - : QThread (parent) -{ - //we need a class that receives signals from other threads and emits a signal in response - shutDownHelper=new QSignalMapper; - shutDownHelper->setMapping(this,0); - connect(this, SIGNAL(started()), this, SLOT(setReadyStatus() ), Qt::DirectConnection); - connect(this, SIGNAL(aboutToStop()), shutDownHelper, SLOT(map()) ); -} - -//------------------------------------------------------ -Thread::~Thread() -{ - delete shutDownHelper; -} - -//------------------------------------------------------ -// starts thread, moves worker to this thread and blocks -void Thread::launchWorker(QObject *worker) -{ - this->worker = worker; - start(); - worker->moveToThread(this); - shutDownHelper->moveToThread(this); - connect(shutDownHelper, SIGNAL(mapped(int) ), this, SLOT(stopExecutor()), Qt::DirectConnection ); - mutex.lock(); - waitCondition.wait(&mutex); -} - -//------------------------------------------------------ -// puts a command to stop processing in the event queue of worker thread -void Thread::stop() -{ - emit aboutToStop(); -} - -//------------------------------------------------------ - -// methods above this line should be called in gui thread context -// methods below this line are private and will be run in secondary thread context - -//------------------------------------------------------ -void Thread::stopExecutor() //secondary thread context -{ - exit(); -} - -//------------------------------------------------------ -void Thread::setReadyStatus() -{ - waitCondition.wakeAll(); -} diff --git a/examples/widgets/tutorials/threads/movedobject/thread.h b/examples/widgets/tutorials/threads/movedobject/thread.h deleted file mode 100644 index e95d480ca8..0000000000 --- a/examples/widgets/tutorials/threads/movedobject/thread.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef THREAD_H -#define THREAD_H - -#include <QtCore> - -class Thread :public QThread -{ - Q_OBJECT -public: - Thread( QObject *parent=0); - ~Thread(); - void stop(); - void launchWorker(QObject *worker); -private: - QObject *worker; - QSignalMapper *shutDownHelper; - QWaitCondition waitCondition; - QMutex mutex; -private slots: - void stopExecutor(); - void setReadyStatus(); -signals: - void aboutToStop(); -}; - -#endif // THREAD_H diff --git a/examples/widgets/tutorials/threads/movedobject/workerobject.cpp b/examples/widgets/tutorials/threads/movedobject/workerobject.cpp deleted file mode 100644 index a630042f9a..0000000000 --- a/examples/widgets/tutorials/threads/movedobject/workerobject.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QtCore> -#include "workerobject.h" - -/* - * represents an object that lives in another thread where it polls a resource - * and communicates with the gui thread - */ - -WorkerObject::WorkerObject(QObject *parent) - : QObject(parent) -{ - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(poll())); -} - -//--------------------------------------------------------------- -void WorkerObject::doWork() -{ - - qDebug() << "doing work in thread " << thread()->currentThreadId() ; -} - -//--------------------------------------------------------------- -WorkerObject::~WorkerObject() -{ - qDebug() << "destruction WorkerObject in thread " << thread()->currentThreadId(); -} - -//--------------------------------------------------------------- -void WorkerObject::startPolling(int milliseconds) -{ - count=0; - timer->start(milliseconds); -} - -//--------------------------------------------------------------- -void WorkerObject::stopPolling() -{ - timer->stop(); -} - -//--------------------------------------------------------------- -void WorkerObject::poll() -{ - qDebug() << QString("timer hit %1").arg(count); - count++; -} - diff --git a/examples/widgets/tutorials/threads/movedobject/workerobject.h b/examples/widgets/tutorials/threads/movedobject/workerobject.h deleted file mode 100644 index 251a935282..0000000000 --- a/examples/widgets/tutorials/threads/movedobject/workerobject.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef WORKEROBJECT_H -#define WORKEROBJECT_H - -#include <QtCore> - -class WorkerObject : public QObject -{ - Q_OBJECT -public: - explicit WorkerObject(QObject *parent = 0); - ~WorkerObject(); -public slots: - void doWork(); - void startPolling(int milliseconds); - void stopPolling(); -private slots: - void poll(); -private: - QTimer *timer; - int count; -}; - -#endif // WORKEROBJECT_H diff --git a/examples/widgets/tutorials/threads/threads.pro b/examples/widgets/tutorials/threads/threads.pro deleted file mode 100644 index 19718d760c..0000000000 --- a/examples/widgets/tutorials/threads/threads.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = hellothread \ - hellothreadpool \ - clock \ - movedobject - -qtHaveModule(concurrent): SUBDIRS += helloconcurrent diff --git a/examples/widgets/tutorials/tutorials.pro b/examples/widgets/tutorials/tutorials.pro index cf94830551..2eb87cdbd5 100644 --- a/examples/widgets/tutorials/tutorials.pro +++ b/examples/widgets/tutorials/tutorials.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS += threads addressbook widgets modelview gettingStarted +SUBDIRS += addressbook widgets modelview gettingStarted diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf index 11d62a1efb..e3fa924e23 100644 --- a/mkspecs/android-g++/qmake.conf +++ b/mkspecs/android-g++/qmake.conf @@ -4,7 +4,6 @@ QMAKE_PLATFORM = android QMAKE_COMPILER = gcc CONFIG += android_install unversioned_soname android_deployment_settings -DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG include(../common/linux.conf) include(../common/gcc-base-unix.conf) diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf index a903ed025d..5bc1fd14c9 100644 --- a/mkspecs/features/android/android_deployment_settings.prf +++ b/mkspecs/features/android/android_deployment_settings.prf @@ -47,18 +47,6 @@ contains(TEMPLATE, ".*app"):!build_pass:!android-no-sdk { !isEmpty(ANDROID_PACKAGE_SOURCE_DIR): \ FILE_CONTENT += " \"android-package-source-directory\": $$emitString($$ANDROID_PACKAGE_SOURCE_DIR)," - !isEmpty(ANDROID_PACKAGE): \ - FILE_CONTENT += " \"android-package\": $$emitString($$ANDROID_PACKAGE)," - - !isEmpty(ANDROID_MINIMUM_VERSION): \ - FILE_CONTENT += " \"android-minimum-version\": $$ANDROID_MINIMUM_VERSION," - - !isEmpty(ANDROID_TARGET_VERSION): \ - FILE_CONTENT += " \"android-target-version\": $$ANDROID_TARGET_VERSION," - - !isEmpty(ANDROID_APP_NAME): \ - FILE_CONTENT += " \"android-app-name\": $$emitString($$ANDROID_APP_NAME)," - !isEmpty(ANDROID_EXTRA_LIBS): \ FILE_CONTENT += " \"android-extra-libs\": $$emitString($$join(ANDROID_EXTRA_LIBS, ","))," diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf index 4643c3915c..19b26460a0 100644 --- a/mkspecs/features/create_cmake.prf +++ b/mkspecs/features/create_cmake.prf @@ -51,7 +51,7 @@ contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") { CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True } -!exists($$first(QT.$${MODULE}.private_includes)): CMAKE_NO_PRIVATE_INCLUDES = true +!exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX]) contains(CMAKE_LIB_DIR,"^\\.\\./.*") { @@ -111,15 +111,15 @@ if(build_all|CONFIG(debug, debug|release)): CMAKE_DEBUG_TYPE = debug if(build_all|CONFIG(release, debug|release)): CMAKE_RELEASE_TYPE = release contains(CONFIG, plugin) { - equals(PLUGIN_TYPE, bearer): PLUGIN_MODULE_NAME = network - else:equals(PLUGIN_TYPE, sqldrivers): PLUGIN_MODULE_NAME = sql - else:equals(PLUGIN_TYPE, accessible): PLUGIN_MODULE_NAME = widgets - else:equals(PLUGIN_TYPE, imageformats): PLUGIN_MODULE_NAME = gui - else:equals(PLUGIN_TYPE, platforminputcontexts): PLUGIN_MODULE_NAME = gui - else:equals(PLUGIN_TYPE, platformthemes): PLUGIN_MODULE_NAME = gui - else:equals(PLUGIN_TYPE, generic): PLUGIN_MODULE_NAME = gui - else:equals(PLUGIN_TYPE, platforms): PLUGIN_MODULE_NAME = gui - else: return() + PLUGIN_MODULE_NAME = + for (mod, QT_MODULES) { + types = $$replace(QT.$${mod}.plugin_types, /.*$, ) + contains(types, $$PLUGIN_TYPE) { + PLUGIN_MODULE_NAME = $$mod + break() + } + } + isEmpty(PLUGIN_MODULE_NAME): return() CMAKE_MODULE_NAME = $$cmakeModuleName($$PLUGIN_MODULE_NAME) diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 0cdaafee7f..dce981e059 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -95,7 +95,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\" ) !!ELSE - set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") !!ENDIF !!ELSE !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE) @@ -106,7 +106,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\" ) !!ELSE - set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") !!ENDIF !!ELSE set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\" \"$${CMAKE_INCLUDE_DIR}Qt$${CMAKE_MODULE_NAME}\") @@ -116,7 +116,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) \"$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\" ) !!ELSE - set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") !!ENDIF !!ENDIF !!ENDIF @@ -124,8 +124,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL) !!ENDIF !!ELSE - set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS) - set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) + set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"\") + set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\") !!ENDIF foreach(_dir ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) @@ -163,6 +163,8 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) set(_Qt5$${CMAKE_MODULE_NAME}_FIND_VERSION_EXACT EXACT) endif() + set(Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS \"\") + foreach(_module_dep ${_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES}) if (NOT Qt5${_module_dep}_FOUND) find_package(Qt5${_module_dep} @@ -188,9 +190,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME}) list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS) list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS) list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS) - if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) - list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) - endif() + list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) set(_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES \"$${CMAKE_QT5_MODULE_DEPS}\") diff --git a/mkspecs/features/dbuscommon.pri b/mkspecs/features/dbuscommon.pri index 6e1e5659c3..2f2e6b831f 100644 --- a/mkspecs/features/dbuscommon.pri +++ b/mkspecs/features/dbuscommon.pri @@ -67,6 +67,7 @@ for(group, groups) { $${group}_source.name = DBUSXML2CPP $${dbus_TYPE} SOURCE ${QMAKE_FILE_IN} $${group}_source.variable_out = SOURCES $${group}_source.input = $$input_list + $${group}_source.depends = $$eval($${group}_header.output) # this actually belongs to the object file $${group}_moc.commands = $$moc_header.commands $${group}_moc.output = $$moc_header.output diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index 4501b2a568..8eb7101acc 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -6,6 +6,8 @@ contains(TEMPLATE, ".*(lib|app)"):CONFIG += have_target load(resolve_config) +exclusive_builds: load(exclusive_builds_post) + # If the TARGET looks like a path, split it into DESTDIR and the resulting TARGET target_dir_part = $$dirname(TARGET) !isEmpty(target_dir_part) { diff --git a/mkspecs/features/exclusive_builds.prf b/mkspecs/features/exclusive_builds.prf index c45ff22c06..4d88dcd15e 100644 --- a/mkspecs/features/exclusive_builds.prf +++ b/mkspecs/features/exclusive_builds.prf @@ -1,92 +1,37 @@ -# fixExclusiveOutputDirs(1config, 2config) -# Change all output paths that references 2config to have the string 1config in them -defineTest(fixExclusiveOutputDirs) { - firstBuild = $$1 - secondBuild = $$2 - count(ARGS, 2, greaterThan):isEqual($$list($$lower($$3)), false):appendFirstBuild = false - else:appendFirstBuild = true - isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR - lessThan(firstBuild, $$secondBuild):eval($${firstBuild}_and_$${secondBuild}_target:QMAKE_DIR_REPLACE += DESTDIR) - else:eval($${secondBuild}_and_$${firstBuild}_target:QMAKE_DIR_REPLACE += DESTDIR) - for(fix, QMAKE_DIR_REPLACE) { - isEmpty($$fix)|isEqual($$fix, .) { - eval($$fix = $${firstBuild}) - } else:contains($$list($$first($$fix)), .*$${secondBuild}.*) { - eval($$fix ~= s/$${secondBuild}/$${firstBuild}/gi) - } else:isEqual(appendFirstBuild, true):!contains($$list($$first($$fix)), .*$${firstBuild}.*) { - contains($$list($${first($$fix)}), .*/$):eval($$fix = $${first($$fix)}$${firstBuild}) - else:eval($$fix = $${first($$fix)}-$${firstBuild}) - } - export($$fix) - } - return(true) -} - -# addExclusiveBuilds(1config, 1name, 2config, 2name) -# Adds two BUILDS which are exclusive to each other. defineTest(addExclusiveBuilds) { - firstBuild = $$1 - firstBuildName = $$2 - secondBuild = $$3 - secondBuildName = $$4 + lessThan(ARGC, 2): \ + error("addExclusiveBuilds() requires at least two arguments") - contains(TEMPLATE, subdirs) { - eval(sub_$${firstBuildName}.target = $$firstBuild) - export(sub_$${firstBuildName}.target) - eval(sub_$${firstBuildName}.CONFIG = recursive) - export(sub_$${firstBuildName}.CONFIG) - eval(sub_$${secondBuildName}.target = $$secondBuild) - export(sub_$${secondBuildName}.target) - eval(sub_$${secondBuildName}.CONFIG = recursive) - export(sub_$${secondBuildName}.CONFIG) - QMAKE_EXTRA_TARGETS += sub_$${firstBuildName} sub_$${secondBuildName} - export(QMAKE_EXTRA_TARGETS) - } else:!build_pass { - first_BUILDS = - second_BUILDS = - suffix_BUILDS = Build + !$$join(ARGS, _and_):!fix_output_dirs: \ + return(true) - isEmpty(BUILDS): BUILDPERMUTATIONS = $$suffix_BUILDS - else: BUILDPERMUTATIONS = $$BUILDS + for(build, ARGS) { + isEmpty($${build}.name) { + $${build}.name = $$title($$build) + export($${build}.name) + } + isEmpty($${build}.target) { + $${build}.target = $$lower($$build) + export($${build}.target) + } + isEmpty($${build}.dir_affix) { + $${build}.dir_affix = $$lower($$build) + export($${build}.dir_affix) + } - for(permutation, BUILDPERMUTATIONS) { - permutation ~= s/$${suffix_BUILDS}$// - isEmpty(permutation): permutationName = - else: permutationName = -$$permutation - # Makefile target rule - eval($${firstBuildName}$${permutation}.target = $${firstBuild}$$lower($${permutationName})) - export($${firstBuildName}$${permutation}.target) - # IDE name - eval($${firstBuildName}$${permutation}.name = $${firstBuildName}$${permutationName}) - export($${firstBuildName}$${permutation}.name) - # prl import CONFIG option - eval($${firstBuildName}$${permutation}.PRL_CONFIG = $${firstBuild}$${permutation}) - export($${firstBuildName}$${permutation}.PRL_CONFIG) - # Individual CONFIG option - eval($${firstBuildName}$${permutation}.CONFIG = $${firstBuild} $${firstBuildName}Build $$eval($${permutation}.CONFIG)) - export($${firstBuildName}$${permutation}.CONFIG) + $${build}.exclusive = $$ARGS + export($${build}.exclusive) - eval($${secondBuildName}$${permutation}.target = $${secondBuild}$$lower($${permutationName})) - export($${secondBuildName}$${permutation}.target) - eval($${secondBuildName}$${permutation}.name = $${secondBuildName}$${permutationName}) - export($${secondBuildName}$${permutation}.name) - eval($${secondBuildName}$${permutation}.PRL_CONFIG = $${secondBuild}$${permutation}) - export($${secondBuildName}$${permutation}.PRL_CONFIG) - eval($${secondBuildName}$${permutation}.CONFIG = $${secondBuild} $${secondBuildName}Build $$eval($${permutation}.CONFIG)) - export($${secondBuildName}$${permutation}.CONFIG) + QMAKE_EXCLUSIVE_BUILDS += $$build + } - first_BUILDS += $${firstBuildName}$${permutation} - second_BUILDS += $${secondBuildName}$${permutation} - } + CONFIG *= exclusive_builds + export(CONFIG) - # A mutual exclusive block. - CONFIG($${firstBuild}, $${firstBuild}|$${secondBuild}): BUILDS = $$first_BUILDS $$second_BUILDS - else: BUILDS = $$second_BUILDS $$first_BUILDS - export(BUILDS) - } else { - eval($${firstBuildName}Build:fixExclusiveOutputDirs($$firstBuild, $$secondBuild, false)) - eval($${secondBuildName}Build:fixExclusiveOutputDirs($$secondBuild, $$firstBuild, false)) - } + export(QMAKE_EXCLUSIVE_BUILDS) return(true) } + +# Default directories to process +QMAKE_DIR_REPLACE = OBJECTS_DIR MOC_DIR RCC_DIR PRECOMPILED_DIR DESTDIR diff --git a/mkspecs/features/exclusive_builds_post.prf b/mkspecs/features/exclusive_builds_post.prf new file mode 100644 index 0000000000..936085af0b --- /dev/null +++ b/mkspecs/features/exclusive_builds_post.prf @@ -0,0 +1,160 @@ + +contains(TEMPLATE, subdirs) { + for(build, QMAKE_EXCLUSIVE_BUILDS) { + prepareRecursiveTarget($$build) + QMAKE_EXTRA_TARGETS += $$build + } +} else { + # Recursively combines a list of exclusive builds into combinations + # of non-exclusive builds (separated by a ':' character), eg the + # list [debug, release, static, shared] will result in the four + # combinations [debug:static, debug:shared, release:static, + # release:shared]. + defineReplace(combineExclusiveBuilds) { + permutationBuilds = $$1 + existingBuilds = $$2 + + isEmpty(permutationBuilds): \ + # Exit-condition, no more recursing + return($$existingBuilds) + + # Choose the first build of the permutations and use the set of exclusive + # builds associated with that build as the list of existing builds. This + # partitions the permutations into one set of exclusive builds + the rest + # of the unknown permutations. + newExistingBuilds = $$eval($$first(permutationBuilds).exclusive) + permutationBuilds -= $$newExistingBuilds + + # Recursively compute the combination of these two sets + recursiveCombination = $$combineExclusiveBuilds($$permutationBuilds, $$newExistingBuilds) + + isEmpty(existingBuilds): \ + # No need to combine further + return($$recursiveCombination) + + result = + for(existingBuild, existingBuilds) { + for(combination, recursiveCombination): \ + result += "$${existingBuild}:$${combination}" + } + return($$result) + } + + buildCombinations = $$combineExclusiveBuilds($$QMAKE_EXCLUSIVE_BUILDS) + + for(combination, buildCombinations) { + builds = $$split(combination, :) + key = + config = + target = + priority = + for(build, builds) { + key = $${key}$$eval($${build}.name) + config *= $$eval($${build}.CONFIG) $${build} $$eval($${build}.name)Build + target += $$eval($${build}.target) + + # If a build has been prioritized through CONFIG we prefer that + CONFIG($$build, $$join($${build}.exclusive, |)): \ + priority += 1 + } + + $${key}.name = $$key + $${key}.target = $$join(target, -) + $${key}.CONFIG = $$config + $${key}.builds = $$builds + + BUILDS.$$size(priority) += $$key + + # Add makefile targets for each exclusive build that will aggregate all targets + # that include the exclusive build. This matches the targets in the SUBDIR files + # so that you can recursivly build a single exclusive build. + !build_pass:count(builds, 1, >) { + for(build, builds) { + $${build}.depends += $$eval($${key}.target) + QMAKE_EXTRA_TARGETS *= $$build + } + } + } + + BUILDS = + priority = + for(ever) { + # Keep the order in BUILDS matching the priority from CONFIG, so that the first + # entry in BUILDS will be the first/default target when not CONFIG(build_all). + BUILDS = $$eval(BUILDS.$$size(priority)) $$BUILDS + count(BUILDS, $$size(buildCombinations), >=): break() + priority += 1 + } + + build_pass|fix_output_dirs { + !build_pass { + # The builds are sorted by priority based on the current config + # so choosing the first one gives us the most appropriate build. + BUILD_PASS = $$first(BUILDS) + } + + for(dir, QMAKE_DIR_REPLACE) { + + # Limit builds to ones that should affect the current $$dir + builds = + for(build, $${BUILD_PASS}.builds) { + equals(dir, DESTDIR) { + !$$join($${build}.exclusive, _and_)_target: \ + next() + } + + builds += $$build + } + + isEmpty(builds): \ + next() + + affixes = + for(build, builds): \ + affixes += $$eval($${build}.dir_affix) + full_dir_affix = $$join(affixes, -) + + isEmpty($$dir)|isEqual($$dir, .) { + # Use affix directly + $$dir = $$full_dir_affix + next() + } + + contains(QMAKE_DIR_REPLACE_SANE, $$dir) { + # Suffix output dir + $$dir = $$clean_path($$eval($$dir)/$$full_dir_affix) + } else { + # "Compatibility mode" with QTBUG-491 + for(build, builds) { + did_replace = false + build_affix = $$eval($${build}.dir_affix) + for(exclusive, $${build}.exclusive) { + equals(exclusive, $$build): \ + next() + + exclusive_affix = $$eval($${exclusive}.dir_affix) + contains($$dir, .*$${exclusive_affix}.*) { + $$dir ~= s/$${exclusive_affix}/$${build_affix}/gi + did_replace = true + } + } + $$did_replace: next() + + # Append (as subdir or as suffix) + !build_pass { + dir_affix = $$eval($${build}.dir_affix) + !contains($$dir, .*$${dir_affix}.*) { + contains($$dir, .*/$) { + # Subdir + $$dir = $$eval($$dir)$$dir_affix + } else { + # Suffix + $$dir = $$eval($$dir)-$${dir_affix} + } + } + } + } + } + } + } +} diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index b183814e63..c3addf9319 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -19,13 +19,10 @@ qt:!isEmpty(QT_CONFIG) { contains(QT_CONFIG, static):contains(QT_CONFIG, c++11): CONFIG += c++11 } -isEmpty(_QMAKE_CACHE_) { - warning("No .qmake.cache is present. This significantly slows down qmake with this makespec.") - warning("Call 'cache()' in the top-level project file to rectify this problem.") -} else { - cache(QMAKE_XCODE_DEVELOPER_PATH) - cache(QMAKE_XCODE_VERSION) -} +cache(QMAKE_XCODE_DEVELOPER_PATH, stash) +cache(QMAKE_XCODE_VERSION, stash) + +QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() # Ensure that we process sdk.prf first, as it will update QMAKE_CXX # and friends that other features/extra compilers may depend on. diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index c0596d5ef0..c031403930 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -24,8 +24,16 @@ isEmpty(QMAKE_XCODE_VERSION) { unset(xcode_version) } -# These two variables are used by the xcode_dynamic_library_suffix +isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) { + QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist + exists($$QMAKE_XCODE_PREFERENCES_FILE): \ + QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null") + + !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \ + cache(QMAKE_TARGET_BUNDLE_PREFIX) +} + +# This variable is used by the xcode_dynamic_library_suffix # feature, which allows Xcode to choose the Qt libraries to link to # at build time, depending on the current Xcode SDK and configuration. -QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 788fa5b362..5b5186a14b 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -8,7 +8,7 @@ contains(QMAKE_MAC_SDK, .*/.*): \ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) { QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null") isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'") - !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set, QMAKE_MAC_SDK_PATH) + cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set stash, QMAKE_MAC_SDK_PATH) } else { QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) } @@ -41,7 +41,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ isEmpty(sysrooted): next() $$tool = $$sysrooted $$member(value, 1, -1) - !isEmpty(_QMAKE_CACHE_): cache($$tool_variable, set, $$tool) + cache($$tool_variable, set stash, $$tool) } isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) { @@ -52,7 +52,7 @@ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) { "sed 's/.*Value: \\(.*\\)/\\1/'") isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") - !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set, QMAKE_MAC_PLATFORM_NAME) + cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set stash, QMAKE_MAC_PLATFORM_NAME) } else { QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) } diff --git a/mkspecs/features/qfeatures.prf b/mkspecs/features/qfeatures.prf new file mode 100644 index 0000000000..15ef5c5be0 --- /dev/null +++ b/mkspecs/features/qfeatures.prf @@ -0,0 +1,4 @@ +# This file needs to be loaded explicitly, as the evaluation is relatively +# expensive, and not many projects will actually need it. +QMAKE_QT_FEATURES = $$[QT_HOST_DATA/get]/mkspecs/qfeatures.pri +include($$QMAKE_QT_FEATURES) | error("Failed to load $$QMAKE_QT_FEATURES") diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 04375d4ce1..83a8778654 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -62,7 +62,7 @@ qaxserver { unset(using_privates) qtAddModules(QT, LIBS) qtAddModules(QT_PRIVATE, LIBS_PRIVATE) -!isEmpty(using_privates):!auto_use_privates:!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) { +!isEmpty(using_privates):!no_private_qt_headers_warning:if(!debug_and_release|!build_pass) { message("This project is using private headers and will therefore be tied to this specific Qt module build version.") message("Running this project against other versions of the Qt modules may crash at any arbitrary point.") message("This is not a bug, but a result of using Qt internals. You have been warned!") @@ -74,13 +74,16 @@ wince*:static:gui { } # static builds: link qml import plugins into the app. -if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \ +qt_module_deps = $$QT $$QT_PRIVATE +qt_module_deps = $$replace(qt_module_deps, -private$, _private) +qt_module_deps = $$resolve_depends(qt_module_deps, "QT.") +contains(qt_module_deps, qml): \ contains(QT_CONFIG, static):contains(TEMPLATE, .*app):!host_build:!no_import_scan { # run qmlimportscanner qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner) for (MODULE, QT_MODULES) { PATH = $$eval(QT.$${MODULE}.qml) - !isEmpty(PATH): QMLPATHS += $$PATH + !isEmpty(PATH):exists($$PATH): QMLPATHS += $$PATH } QMLPATHS = $$unique(QMLPATHS) for (QMLPATH, QMLPATHS): \ @@ -96,7 +99,7 @@ if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \ for (key, IMPORTS._KEYS_): { PATH = $$eval(IMPORTS.$${key}.path) PLUGIN = $$eval(IMPORTS.$${key}.plugin) - !isEmpty(PATH):!isEmpty(PLUGIN): LIBS *= -L$$PATH -l$$PLUGIN + !isEmpty(PATH):!isEmpty(PLUGIN): LIBS *= -L$$PATH -l$${PLUGIN}$$qtPlatformTargetSuffix() } # create qml_plugin_import.cpp @@ -124,33 +127,37 @@ if(contains(QT, qml)|contains(QT_PRIVATE, qml)): \ QMAKE_CLEAN += $$QML_IMPORT_CPP # copy qml files. this part is platform spesific. - macx { - # copy to Contents/Resources in the bundle. - QmlImports.path = Contents/Resources/ - QmlImports.files *= $$QMLPATHS - QMAKE_BUNDLE_DATA += QmlImports + mac { + osx { + # Note: user can override QMAKE_BUNDLE_QML from pro file to change target bundle path + isEmpty(QMAKE_QML_BUNDLE_PATH):QMAKE_QML_BUNDLE_PATH = "Resources/qt_qml" + qmlTargetPath = $$OUT_PWD/$${TARGET}.app/Contents/$$QMAKE_QML_BUNDLE_PATH + qtconfTargetPath = $$OUT_PWD/$${TARGET}.app/Contents/Resources/qt.conf + } else { + # iOS: flat bundle layout (no Contents/Resources) + isEmpty(QMAKE_QML_BUNDLE_PATH):QMAKE_QML_BUNDLE_PATH = "qt_qml" + qmlTargetPath = $CODESIGNING_FOLDER_PATH/$$QMAKE_QML_BUNDLE_PATH + qtconfTargetPath = $CODESIGNING_FOLDER_PATH/qt.conf + } - # place qt.conf in Contents/Resources in the app bundle - QT_CONF_CONTENTS = \ - "[Paths]" \ - "Imports = Resources/qml" \ - "Qml2Imports = Resources/qml" - QT_CONF = "$$OUT_PWD/$${TARGET}.app/Contents/Resources/qt.conf" - write_file($$QT_CONF, QT_CONF_CONTENTS)|error("Aborting.") - } else: ios { - # flat bundle layout (no Contents/Resources) - QmlImports.files *= $$QMLPATHS - QMAKE_BUNDLE_DATA += QmlImports - - # write qt.conf to OUT_PWD and make xcode copy it via QMAKE_BUNDLE_DATA + # set import path in qt.conf to point to the bundeled qml: QT_CONF_CONTENTS = \ "[Paths]" \ - "Imports = qml" \ - "Qml2Imports = qml" - QT_CONF = "$$OUT_PWD/qt.conf" - write_file($$QT_CONF, QT_CONF_CONTENTS)|error("Aborting.") - QtConf.files = $$QT_CONF - QMAKE_BUNDLE_DATA += QtConf + "Imports = $$QMAKE_QML_BUNDLE_PATH" \ + "Qml2Imports = $$QMAKE_QML_BUNDLE_PATH" + write_file("$$OUT_PWD/qt.conf", QT_CONF_CONTENTS)|error("Aborting.") + + # write qt.conf and copy each qml import dir into the bundle. + # But strip away archives and other files that are not needed: + !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";" + QMAKE_POST_LINK += \ + "cp $$OUT_PWD/qt.conf $$qtconfTargetPath; " \ + "test -d $$qmlTargetPath && rm -r $$qmlTargetPath; " \ + "mkdir -p $$qmlTargetPath && " \ + "for p in $$QMLPATHS; do" \ + "rsync -r --exclude='*.a' --exclude='*.prl' --exclude='*.qmltypes' " + macx-xcode: QMAKE_POST_LINK += "$p/ $$qmlTargetPath; done" + else: QMAKE_POST_LINK += "\$\$p/ $$qmlTargetPath; done" } } } diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf index 96337da9de..7ec7bad047 100644 --- a/mkspecs/features/qt_android_deps.prf +++ b/mkspecs/features/qt_android_deps.prf @@ -64,6 +64,19 @@ DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml } } + !isEmpty(ANDROID_PERMISSIONS) { + for (ANDROID_PERMISSION, ANDROID_PERMISSIONS) { + FILE_CONTENT += "<permission name=\"$$ANDROID_PERMISSION\" />" + } + } + + !isEmpty(ANDROID_FEATURES) { + for (ANDROID_FEATURE, ANDROID_FEATURES) { + FILE_CONTENT += "<feature name=\"$$ANDROID_FEATURE\" />" + } + } + + !isEmpty(FILE_CONTENT) { FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>" write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.") diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index a29e09cbc5..faa7a44f67 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -20,6 +20,14 @@ debug(1, "Not loading qmodule.pri twice") } +PRECOMPILED_DIR = .pch +OBJECTS_DIR = .obj +MOC_DIR = .moc +RCC_DIR = .rcc +UI_DIR = .uic + +QMAKE_DIR_REPLACE_SANE = PRECOMPILED_DIR OBJECTS_DIR MOC_DIR RCC_DIR UI_DIR + # force_independent can be set externally. prefix_build not. !exists($$[QT_HOST_DATA]/.qmake.cache): \ CONFIG += prefix_build force_independent diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 746e2878a7..22d66e8907 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -9,6 +9,9 @@ # We mean it. # +QMAKE_DIR_REPLACE_SANE += DESTDIR +CONFIG -= debug_and_release_target + contains(QT_CONFIG, c++11): CONFIG += c++11 contains(TEMPLATE, .*lib) { # module and plugins diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index f1f7c00b9e..1dacfedd02 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -1,11 +1,16 @@ defineReplace(qtPlatformTargetSuffix) { + ios:CONFIG(iphonesimulator, iphonesimulator|iphoneos): \ + suffix = _iphonesimulator + else: \ + suffix = + CONFIG(debug, debug|release) { !debug_and_release|build_pass { - mac:return(_debug) - win32:return(d) + mac: return($${suffix}_debug) + win32: return($${suffix}d) } } - return() + return($$suffix) } defineReplace(qtLibraryTarget) { @@ -28,7 +33,7 @@ defineTest(qtAddLibrary) { # Reverse-engineer the module name from the library name. for(var, QT_MODULES) { isEqual(QT.$${var}.name, $$1) { - qtAddModule($$var, , LIBS) + qtAddModule($$var, LIBS) return(true) } } @@ -48,12 +53,12 @@ defineTest(qtProcessModuleFlags) { # qt module defineTest(qtHaveModule) { - !isEmpty(QT.$${1}.name): \ + !isEmpty(QT.$$replace(1, -, _).name): \ return(true) return(false) } -# qt module, UsePrivate flag, libs variable +# qt module, libs variable defineTest(qtAddModule) { MODULE_NAME = $$eval(QT.$${1}.name) MODULE_INCLUDES = $$eval(QT.$${1}.includes) @@ -61,8 +66,10 @@ defineTest(qtAddModule) { MODULE_CONFIG = $$eval(QT.$${1}.module_config) MODULE_MAJOR_VERSION = $$eval(QT.$${1}.MAJOR_VERSION) - contains(MODULE_CONFIG, internal_module):!if(auto_use_privates|isEqual(2, UsePrivate)): \ - error("Module $$1 has no public API.") + contains(MODULE_CONFIG, internal_module) { + using_privates = true + export(using_privates) + } qtProcessModuleFlags(CONFIG, QT.$${1}.CONFIG) qtProcessModuleFlags(DEFINES, QT.$${1}.DEFINES) @@ -77,80 +84,75 @@ defineTest(qtAddModule) { !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) { INCLUDEPATH *= $$FRAMEWORK_INCLUDE } - auto_use_privates|isEqual(2, UsePrivate): \ + contains(MODULE_CONFIG, internal_module): \ INCLUDEPATH += \ $$FRAMEWORK_INCLUDE/$$eval(QT.$${1}.VERSION) \ $$FRAMEWORK_INCLUDE/$$eval(QT.$${1}.VERSION)/$$MODULE_NAME QMAKE_FRAMEWORKPATH *= $${MODULE_LIBS} - LINKAGE += -framework $${MODULE_NAME}$${QT_LIBINFIX} + export(QMAKE_FRAMEWORKPATH) + !contains(MODULE_CONFIG, no_link): \ + LINKAGE += -framework $${MODULE_NAME}$${QT_LIBINFIX} } else { INCLUDEPATH *= $$MODULE_INCLUDES - auto_use_privates|isEqual(2, UsePrivate): \ - INCLUDEPATH += $$eval(QT.$${1}.private_includes) } + export(INCLUDEPATH) - # Re-insert the major version in the library name (cf qtLibraryTarget above) - # unless it's a framework build - !mac|!contains(MODULE_CONFIG, lib_bundle): \ - MODULE_NAME ~= s,^Qt,Qt$$MODULE_MAJOR_VERSION, - - win32 { - # Make sure the version number isn't appended again to the lib name - ver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE - dver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE - $$ver_var = 0 - $$dver_var = 0 - export($$ver_var) - export($$dver_var) - } + # Only link to this module if a libs directory is set, else this is just a module + # to give access to sources or include files, and not for linking. + !isEmpty(MODULE_LIBS):!contains(MODULE_CONFIG, no_link) { + + # Re-insert the major version in the library name (cf qtLibraryTarget above) + # unless it's a framework build + !mac|!contains(MODULE_CONFIG, lib_bundle): \ + MODULE_NAME ~= s,^Qt,Qt$$MODULE_MAJOR_VERSION, + + win32 { + # Make sure the version number isn't appended again to the lib name + ver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}_VERSION_OVERRIDE + dver_var = QMAKE_$${upper($$MODULE_NAME$$QT_LIBINFIX)}D_VERSION_OVERRIDE + $$ver_var = 0 + $$dver_var = 0 + export($$ver_var) + export($$dver_var) + } - isEmpty(LINKAGE) { - !isEmpty(MODULE_LIBS_ADD): LINKAGE = -L$$MODULE_LIBS_ADD - lib = $${MODULE_NAME}$${QT_LIBINFIX}$$qtPlatformTargetSuffix() - LINKAGE += -l$$lib + isEmpty(LINKAGE) { + !isEmpty(MODULE_LIBS_ADD): \ + LINKAGE = -L$$MODULE_LIBS_ADD + lib = $${MODULE_NAME}$${QT_LIBINFIX}$$qtPlatformTargetSuffix() + LINKAGE += -l$$lib - contains(QT_CONFIG, rpath): QMAKE_RPATHDIR *= $$eval(QT.$${1}.rpath) + contains(QT_CONFIG, rpath) { + QMAKE_RPATHDIR *= $$eval(QT.$${1}.rpath) + export(QMAKE_RPATHDIR) + } + + contains(MODULE_CONFIG, staticlib) { + PRE_TARGETDEPS *= $$MODULE_LIBS/$${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB} + export(PRE_TARGETDEPS) + } + } + + $$2 += $$LINKAGE + export($$2) - contains(MODULE_CONFIG, staticlib): \ - PRE_TARGETDEPS *= $$MODULE_LIBS/$${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB} - } - # Only link to this module if a libs directory is set, else this is just a module - # to give access to sources or include files, and not for linking. - !isEmpty(MODULE_LIBS) { !isEmpty(QMAKE_LSB) { - !isEmpty(MODULE_LIBS_ADD): QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS_ADD - QMAKE_LIBDIR *= /opt/lsb/lib + !isEmpty(MODULE_LIBS_ADD): \ + QMAKE_LFLAGS *= --lsb-libpath=$$MODULE_LIBS_ADD QMAKE_LFLAGS *= --lsb-shared-libs=$${MODULE_NAME}$${QT_LIBINFIX} + QMAKE_LIBDIR *= /opt/lsb/lib + export(QMAKE_LFLAGS) + export(QMAKE_LIBDIR) } - $$3 += $$LINKAGE } - export($$3) - export(INCLUDEPATH) - export(QMAKE_FRAMEWORKPATH) - export(QMAKE_LFLAGS) - export(QMAKE_LIBDIR) - export(QMAKE_RPATHDIR) - export(QMAKE_RPATHLINKDIR) - export(PRE_TARGETDEPS) } # qt variable, libs variable defineTest(qtAddModules) { - # Figure out from which modules we're wanting to use the private headers - NEWQT = - for(QTLIB, $$1) { - QTLIBRAW = $$replace(QTLIB, -private$, ) - !isEqual(QTLIBRAW, $$QTLIB) { - want_var = QT.$${QTLIBRAW}.want_private - $$want_var = UsePrivate - using_privates = true - NEWQT += $$eval(QT.$${QTLIBRAW}.private_depends) - } - NEWQT += $$QTLIBRAW - contains(QT.$${QTLIBRAW}.CONFIG, auto_use_privates): CONFIG += auto_use_privates - } + # qmake variables cannot contain dashes, so normalize the names first + $$1 = $$replace($$1, -private$, _private) # Topological resolution of modules based on their QT.<module>.depends variable - $$1 = $$resolve_depends(NEWQT, "QT.") + $$1 = $$resolve_depends($$1, "QT.") # Finally actually add the modules unset(BAD_QT) for(QTLIB, $$1) { @@ -165,11 +167,9 @@ defineTest(qtAddModules) { next() } - qtAddModule($$QTLIB, $$eval(QT.$${QTLIB}.want_private), $$2) + qtAddModule($$QTLIB, $$2) } - !isEmpty(BAD_QT):error("Unknown module(s) in $$1: $$BAD_QT") - - export(using_privates) + !isEmpty(BAD_QT):error("Unknown module(s) in $$1: $$replace(BAD_QT, _private$, -private)") } defineTest(qtAddRpathLink) { @@ -178,7 +178,7 @@ defineTest(qtAddRpathLink) { # This means that paths of direct dependencies (QT & QT_PRIVATE) # don't need to appear here. However, their private dependencies' # paths OTOH need to be put there. - pubqt = $$replace(1, -private$, ) + pubqt = $$replace(1, -private$, _private) pubdep = $$resolve_depends(pubqt, "QT.") privdep = $$resolve_depends(pubqt, "QT.", ".depends" ".private_depends" ".run_depends") privdep -= $$pubdep @@ -246,7 +246,7 @@ defineTest(qtAddToolEnv) { # target variable, dependency var name, [non-empty: prepare for system(), not make] defineTest(qtAddTargetEnv) { - deps = $$replace($$2, -private$, ) + deps = $$replace($$2, -private$, _private) deps = $$resolve_depends(deps, "QT.", ".depends" ".private_depends" ".run_depends") !isEmpty(deps) { for(dep, deps) { diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf index e82b499009..7cacca9935 100644 --- a/mkspecs/features/qt_installs.prf +++ b/mkspecs/features/qt_installs.prf @@ -50,7 +50,12 @@ qt_install_module { pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules pritarget.files = $$MODULE_PRI INSTALLS += pritarget - } else { + } else: isEmpty(MODULE_PRIVATE_PRI) { warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.") } + !isEmpty(MODULE_PRIVATE_PRI) { + privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules + privpritarget.files = $$MODULE_PRIVATE_PRI + INSTALLS += privpritarget + } } diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index b614112fd7..5068f7028f 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -44,7 +44,10 @@ ucmodule = $$upper($$MODULE) isEmpty(MODULE_INCNAME): MODULE_INCNAME = $$TARGET -MODULE_DEPENDS = $$replace(QT, -private$, ) +internal_module: \ + MODULE_DEPENDS = $$replace(QT, -private$, _private) +else: \ + MODULE_DEPENDS = $$replace(QT, -private$, ) MODULE_DEPENDS = $$unique(MODULE_DEPENDS) contains(TARGET, QtAddOn.*): \ @@ -55,14 +58,14 @@ MODULE_DEFINES = $$MODULE_DEFINE $$MODULE_DEFINES load(qt_module_pris) -INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}.private_includes) +INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.includes) !no_module_headers: load(qt_module_headers) #other TEMPLATE = lib -DESTDIR = $$eval(QT.$${MODULE}.libs) -win32:!wince*:!prefix_build: DLLDESTDIR = $$eval(QT.$${MODULE}.bins) +DESTDIR = $$eval(QT.$${MODULE_ID}.libs) +win32:!wince*:!prefix_build: DLLDESTDIR = $$eval(QT.$${MODULE_ID}.bins) CONFIG += qmake_cache target_qt @@ -92,7 +95,7 @@ mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) { #QMAKE_FRAMEWORK_VERSION = 4.0 CONFIG += lib_bundle sliced_bundle qt_framework CONFIG -= qt_install_headers #no need to install these as well - !debug_and_release|if(build_all:CONFIG(release, debug|release)) { + !debug_and_release|!build_all|CONFIG(release, debug|release) { FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES FRAMEWORK_HEADERS.path = Headers diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf index 90e5288524..900ade9b6e 100644 --- a/mkspecs/features/qt_module_pris.prf +++ b/mkspecs/features/qt_module_pris.prf @@ -19,11 +19,25 @@ load(qt_build_paths) CONFIG += split_incpath force_independent|split_incpath: \ CONFIG += need_fwd_pri -MODULE_FWD_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules/qt_lib_$${MODULE}.pri +mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules need_fwd_pri: \ - MODULE_PRI = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst/qt_lib_$${MODULE}.pri + mod_inst_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules-inst else: \ - MODULE_PRI = $$MODULE_FWD_PRI + mod_inst_pfx = $$mod_work_pfx +!internal_module { + MODULE_ID = $$MODULE + MODULE_PRIVATE_PRI = $$mod_inst_pfx/qt_lib_$${MODULE}_private.pri + mods_to_load = $$MODULE $${MODULE}_private +} else { + MODULE_ID = $${MODULE}_private + mods_to_load = $${MODULE}_private +} +need_fwd_pri: \ + pris_to_load = $$MODULE_ID +else: \ + pris_to_load = $$mods_to_load +MODULE_PRI = $$mod_inst_pfx/qt_lib_$${MODULE_ID}.pri +MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri !build_pass { @@ -34,20 +48,14 @@ else: \ module_libs = "\$\$QT_MODULE_LIB_BASE" unix:!static { host_build: \ - module_rpath = "QT.$${MODULE}.rpath = $$[QT_HOST_LIBS]" + module_rpath = "QT.$${MODULE_ID}.rpath = $$[QT_HOST_LIBS]" else: \ - module_rpath = "QT.$${MODULE}.rpath = $$[QT_INSTALL_LIBS/raw]" + module_rpath = "QT.$${MODULE_ID}.rpath = $$[QT_INSTALL_LIBS/raw]" } else { module_rpath = } - !isEmpty(QT_FOR_PRIVATE) { - contains(QT_FOR_PRIVATE, .*-private$):error("QT_FOR_PRIVATE may not contain *-private.") - module_privdep = "QT.$${MODULE}.private_depends = $$QT_FOR_PRIVATE" - } else { - module_privdep = - } !isEmpty(QT_PRIVATE): \ - module_rundep = "QT.$${MODULE}.run_depends = $$unique($$list($$replace(QT_PRIVATE, -private$, )))" + module_rundep = "QT.$${MODULE_ID}.run_depends = $$replace(QT_PRIVATE, -private$, _private)" else: \ module_rundep = static: \ @@ -58,10 +66,8 @@ else: \ module_build_type = internal_module: \ module_build_type += internal_module - !isEmpty(module_build_type): \ - module_build_type = "QT.$${MODULE}.module_config = $$module_build_type" !isEmpty(MODULE_CONFIG): \ - module_config = "QT.$${MODULE}.CONFIG = $$MODULE_CONFIG" + module_config = "QT.$${MODULE_ID}.CONFIG = $$MODULE_CONFIG" else: \ module_config = !no_module_headers:!minimal_syncqt { @@ -74,46 +80,52 @@ else: \ $$MODULE_BASE_OUTDIR/include) MODULE_INCLUDES += $$MODULE_AUX_INCLUDES MODULE_PRIVATE_INCLUDES += $$MODULE_PRIVATE_AUX_INCLUDES - internal_module { - MODULE_PRIVATE_INCLUDES = $$MODULE_INCLUDES $$MODULE_PRIVATE_INCLUDES - MODULE_INCLUDES = - MODULE_PRIVATE_SHADOW_INCLUDES = $$MODULE_SHADOW_INCLUDES - MODULE_SHADOW_INCLUDES = - } - split_incpath { - !isEmpty(MODULE_SHADOW_INCLUDES): \ - MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE}.includes += $$MODULE_SHADOW_INCLUDES" - !isEmpty(MODULE_PRIVATE_SHADOW_INCLUDES): \ - MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE}.private_includes += $$MODULE_PRIVATE_SHADOW_INCLUDES" - } + internal_module: \ + MODULE_INCLUDES += $$MODULE_PRIVATE_INCLUDES + split_incpath: \ + MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE_ID}.includes += $$MODULE_SHADOW_INCLUDES" MODULE_PRI_CONT = \ - "QT.$${MODULE}.VERSION = $${VERSION}" \ - "QT.$${MODULE}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \ - "QT.$${MODULE}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \ - "QT.$${MODULE}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \ + "QT.$${MODULE_ID}.VERSION = $${VERSION}" \ + "QT.$${MODULE_ID}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \ + "QT.$${MODULE_ID}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \ + "QT.$${MODULE_ID}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \ "" \ - "QT.$${MODULE}.name = $$TARGET" \ - "QT.$${MODULE}.libs = $$module_libs" \ + "QT.$${MODULE_ID}.name = $$TARGET" \ + "QT.$${MODULE_ID}.libs = $$module_libs" \ $$module_rpath \ - "QT.$${MODULE}.private_includes = $$MODULE_PRIVATE_INCLUDES" + "QT.$${MODULE_ID}.includes = $$MODULE_INCLUDES" !host_build: MODULE_PRI_CONT += \ - "QT.$${MODULE}.includes = $$MODULE_INCLUDES" \ - "QT.$${MODULE}.bins = \$\$QT_MODULE_BIN_BASE" \ - "QT.$${MODULE}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \ - "QT.$${MODULE}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \ - "QT.$${MODULE}.imports = \$\$QT_MODULE_IMPORT_BASE" \ - "QT.$${MODULE}.qml = \$\$QT_MODULE_QML_BASE" + "QT.$${MODULE_ID}.bins = \$\$QT_MODULE_BIN_BASE" \ + "QT.$${MODULE_ID}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \ + "QT.$${MODULE_ID}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \ + "QT.$${MODULE_ID}.imports = \$\$QT_MODULE_IMPORT_BASE" \ + "QT.$${MODULE_ID}.qml = \$\$QT_MODULE_QML_BASE" \ + $$join(MODULE_PLUGIN_TYPES, " ", "QT.$${MODULE_ID}.plugin_types = ") MODULE_PRI_CONT += \ - "QT.$${MODULE}.depends =$$join(MODULE_DEPENDS, " ", " ")" \ - $$module_privdep \ + "QT.$${MODULE_ID}.depends =$$join(MODULE_DEPENDS, " ", " ")" \ $$module_rundep \ - $$module_build_type \ + "QT.$${MODULE_ID}.module_config =$$join(module_build_type, " ", " ")" \ $$module_config \ - "QT.$${MODULE}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting + "QT.$${MODULE_ID}.DEFINES = $$MODULE_DEFINES" \ # assume sufficient quoting "" \ "QT_MODULES += $$MODULE" write_file($$MODULE_PRI, MODULE_PRI_CONT)|error("Aborting.") - MODULE_PRI_FILES = $$MODULE_PRI + !internal_module { + module_build_type += internal_module no_link + MODULE_PRIVATE_PRI_CONT = \ + "QT.$${MODULE}_private.VERSION = $${VERSION}" \ + "QT.$${MODULE}_private.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \ + "QT.$${MODULE}_private.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \ + "QT.$${MODULE}_private.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \ + "" \ + "QT.$${MODULE}_private.name = $${TARGET}" \ # Same name as base module + "QT.$${MODULE}_private.libs = $$module_libs" \ + "QT.$${MODULE}_private.includes = $$MODULE_PRIVATE_INCLUDES" \ + "QT.$${MODULE}_private.depends = $$replace($$list($$MODULE $$QT_FOR_PRIVATE), -private$, _private)" \ + "QT.$${MODULE}_private.module_config =$$join(module_build_type, " ", " ")" + write_file($$MODULE_PRIVATE_PRI, MODULE_PRIVATE_PRI_CONT)|error("Aborting.") + } + MODULE_PRI_FILES = $$MODULE_PRI $$MODULE_PRIVATE_PRI need_fwd_pri { @@ -132,8 +144,10 @@ else: \ "QT_MODULE_HOST_LIB_BASE = $$MODULE_BASE_OUTDIR/lib" \ "QT_MODULE_LIBEXEC_BASE = $$MODULE_BASE_OUTDIR/libexec" \ "QT_MODULE_PLUGIN_BASE = $$MODULE_BASE_OUTDIR/plugins" \ - "include($$MODULE_PRI)" \ - $$MODULE_FWD_PRI_CONT_SUFFIX + "include($$MODULE_PRI)" + !internal_module: MODULE_FWD_PRI_CONT += \ + "include($$MODULE_PRIVATE_PRI)" + MODULE_FWD_PRI_CONT += $$MODULE_FWD_PRI_CONT_SUFFIX write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") touch($$MODULE_FWD_PRI, $$MODULE_PRI) MODULE_PRI_FILES += $$MODULE_FWD_PRI @@ -155,12 +169,15 @@ else: \ # Then, inject the new module into the current cache state !contains(QMAKE_INTERNAL_INCLUDED_FILES, $$MODULE_PRI): \ # before the actual include()! cache(QMAKE_INTERNAL_INCLUDED_FILES, add transient, MODULE_PRI_FILES) - include($$MODULE_FWD_PRI) - for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ - name depends private_depends module_config CONFIG DEFINES sources \ - includes private_includes bins libs libexecs plugins imports qml \ - rpath_link rpath_link_private \ - )):defined(QT.$${MODULE}.$$var, var):cache(QT.$${MODULE}.$$var, transient) + for(pri, pris_to_load): \ + include($$mod_work_pfx/qt_lib_$${pri}.pri) + for(mod, mods_to_load) { + for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \ + name depends module_config CONFIG DEFINES sources \ + includes bins libs libexecs plugins imports qml \ + rpath_link \ + )):defined(QT.$${mod}.$$var, var):cache(QT.$${mod}.$$var, transient) + } cache(QT_MODULES, transient) } # !build_pass diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf index f0f0fe567b..f0864f9e74 100644 --- a/mkspecs/features/qt_tool.prf +++ b/mkspecs/features/qt_tool.prf @@ -19,7 +19,7 @@ CONFIG += console !build_pass:if(!host_build|!force_bootstrap|force_independent) { isEmpty(MODULE):MODULE = $$TARGET - !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, ) + !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private) load(qt_build_paths) diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf index 3884598a94..7835fe4f7c 100644 --- a/mkspecs/features/resolve_config.prf +++ b/mkspecs/features/resolve_config.prf @@ -22,14 +22,8 @@ CONFIG(static, static|shared) { contains(TEMPLATE, ".*lib"): CONFIG += dll } -static_and_shared { - !macx-xcode: addExclusiveBuilds(static, Static, shared, Shared) -} else: fix_output_dirs { - static: \ - fixExclusiveOutputDirs(static, shared) - else: \ - fixExclusiveOutputDirs(shared, static) -} +!macx-xcode: \ + addExclusiveBuilds(shared, static) CONFIG(debug, debug|release): \ CONFIG -= release @@ -37,14 +31,7 @@ else: \ CONFIG -= debug !macx-xcode { - debug_and_release { - addExclusiveBuilds(debug, Debug, release, Release) - } else: fix_output_dirs { - debug: \ - fixExclusiveOutputDirs(debug, release) - else: \ - fixExclusiveOutputDirs(release, debug) - } + addExclusiveBuilds(debug, release) } else { # The Xcode generator always generates project files with # debug and release configurations, regardless of whether diff --git a/mkspecs/features/resolve_target.prf b/mkspecs/features/resolve_target.prf index 22d7722ce3..fe5808940a 100644 --- a/mkspecs/features/resolve_target.prf +++ b/mkspecs/features/resolve_target.prf @@ -11,6 +11,8 @@ load(resolve_config) +exclusive_builds: load(exclusive_builds_post) + QMAKE_RESOLVED_TARGET = $$absolute_path($$DESTDIR, $$OUT_PWD)/ win32 { diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 7876ef1c34..ee5f1f0ea4 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -13,6 +13,7 @@ QMAKE_LEXFLAGS = QMAKE_YACC = yacc QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = +QMAKE_CFLAGS_APP = -fPIE QMAKE_CFLAGS_DEPS = -M QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261 QMAKE_CFLAGS_WARN_OFF = -w @@ -33,6 +34,7 @@ QMAKE_CFLAGS_AVX2 += -xCORE-AVX2 QMAKE_CXX = icpc QMAKE_CXXFLAGS = $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_APP = $$QMAKE_CFLAGS_APP QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF @@ -63,6 +65,7 @@ QMAKE_LFLAGS_SONAME = -Wl,-soname, QMAKE_LFLAGS_THREAD = QMAKE_LFLAGS_NOUNDEF = -Wl,-z,defs QMAKE_LFLAGS_RPATH = -Wl,-rpath, +QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link, QMAKE_LFLAGS_CXX11 = QMAKE_LIBS = diff --git a/mkspecs/macx-clang-32/Info.plist.app b/mkspecs/macx-clang-32/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-clang-32/Info.plist.app +++ b/mkspecs/macx-clang-32/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-clang/Info.plist.app b/mkspecs/macx-clang/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-clang/Info.plist.app +++ b/mkspecs/macx-clang/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-g++-32/Info.plist.app b/mkspecs/macx-g++-32/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-g++-32/Info.plist.app +++ b/mkspecs/macx-g++-32/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-g++/Info.plist.app b/mkspecs/macx-g++/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-g++/Info.plist.app +++ b/mkspecs/macx-g++/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-g++40/Info.plist.app b/mkspecs/macx-g++40/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-g++40/Info.plist.app +++ b/mkspecs/macx-g++40/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-g++42/Info.plist.app b/mkspecs/macx-g++42/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-g++42/Info.plist.app +++ b/mkspecs/macx-g++42/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-icc/Info.plist.app b/mkspecs/macx-icc/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-icc/Info.plist.app +++ b/mkspecs/macx-icc/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/macx-ios-clang/Info.plist.app b/mkspecs/macx-ios-clang/Info.plist.app index 91f4b3d07e..5a0a631d7f 100755 --- a/mkspecs/macx-ios-clang/Info.plist.app +++ b/mkspecs/macx-ios-clang/Info.plist.app @@ -13,7 +13,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@BUNDLEIDENTIFIER@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>CFBundleDisplayName</key> <string>${PRODUCT_NAME}</string> <key>CFBundleName</key> diff --git a/mkspecs/macx-ios-clang/features/default_post.prf b/mkspecs/macx-ios-clang/features/default_post.prf index 0d38c058c9..0a35b1167d 100644 --- a/mkspecs/macx-ios-clang/features/default_post.prf +++ b/mkspecs/macx-ios-clang/features/default_post.prf @@ -1,6 +1,21 @@ -equals(TEMPLATE, app) { +# In case the user sets the SDK manually +contains(QMAKE_MAC_SDK, ^iphonesimulator.*) { + iphonesimulator_and_iphoneos: \ + error("iOS simulator is handled automatically for iphonesimulator_and_iphoneos") + + CONFIG += iphonesimulator +} + +# Resolve config so we don't need to use CONFIG() later on +CONFIG(iphonesimulator, iphonesimulator|iphoneos) { + CONFIG -= iphoneos +} else { + CONFIG -= iphonesimulator + CONFIG += iphoneos +} +equals(TEMPLATE, app) { # If the application uses Qt, it needs to be an application bundle # to be able to deploy and run on iOS. The only exception to this # is if you're working with a jailbroken device and can run the @@ -8,47 +23,150 @@ equals(TEMPLATE, app) { # use-case we care about, so no need to complicate the logic. qt: CONFIG *= app_bundle - # Application bundles require building through Xcode - app_bundle:!macx-xcode { - # For Qt applications we want Xcode project files as the generated output, - # but since qmake doesn't handle the transition between makefiles and Xcode - # project files (which happens when using subdirs), we create a wrapper - # makefile that takes care of generating the Xcode project, and allows - # building by calling out to xcodebuild. - TEMPLATE = aux - - CONFIG = - SOURCES = - OBJECTIVE_SOURCES = - RESOURCES = - INSTALLS = - QMAKE_EXTRA_COMPILERS = - QMAKE_EXTRA_TARGETS = - - TARGET_XCODE_PROJECT_DIR = $${TARGET}.xcodeproj - - system("cd $$system_quote($$OUT_PWD) && $${QMAKE_QMAKE} $$system_quote($$_PRO_FILE_) -spec macx-xcode") - - # We use xcodebuild to do the actual build, but filter out the verbose - # output that shows all environment variables for each build step. - xcodebuild_build.commands = "@bash -o pipefail -c 'xcodebuild | grep -v setenv'" - QMAKE_EXTRA_TARGETS += xcodebuild_build - all.depends = xcodebuild_build - QMAKE_EXTRA_TARGETS += all - - # We do the same for the clean action - xcodebuild_clean.commands = "@xcodebuild clean" - QMAKE_EXTRA_TARGETS += xcodebuild_clean - clean.depends = xcodebuild_clean - QMAKE_EXTRA_TARGETS += clean - - # And distclean - xcodebuild_distclean.commands = "$(DEL_FILE) -R $$TARGET_XCODE_PROJECT_DIR" - xcodebuild_distclean.depends = xcodebuild_clean - QMAKE_EXTRA_TARGETS += xcodebuild_distclean - distclean.depends = xcodebuild_distclean - QMAKE_EXTRA_TARGETS += distclean + app_bundle { + macx-xcode { + # There is no way to genereate Xcode projects that are limited to either + # simulator or device builds, so iphonesimulator_and_iphoneos is always + # effectivly active, even if the user disabled it explicitly. + # The Xcode generator doesn't support multiple BUILDS though (exclusive + # builds), so we have to manually set up the simulator suffix. + library_suffix_iphonesimulator.name = "$${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING}[sdk=iphonesimulator*]" + library_suffix_iphonesimulator.value = "_iphonesimulator$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})" + QMAKE_MAC_XCODE_SETTINGS += library_suffix_iphonesimulator + CONFIG *= xcode_dynamic_library_suffix + } else { + # For Qt applications we want Xcode project files as the generated output, + # but since qmake doesn't handle the transition between makefiles and Xcode + # project files (which happens when using subdirs), we create a wrapper + # makefile that takes care of generating the Xcode project, and allows + # building by calling out to xcodebuild. + TEMPLATE = aux + + SOURCES = + OBJECTIVE_SOURCES = + RESOURCES = + INSTALLS = + QMAKE_EXTRA_COMPILERS = + QMAKE_EXTRA_TARGETS = + + !build_pass { + CONFIG += debug_and_release + load(resolve_config) + + CONFIG += iphonesimulator_and_iphoneos + iphonesimulator.name = Simulator + iphoneos.name = Device + addExclusiveBuilds(iphonesimulator, iphoneos) + + load(exclusive_builds_post) + + xcode_distclean.commands = "$(DEL_FILE) -R $${TARGET}.xcodeproj" + xcode_distclean.depends = \ + debug-iphonesimulator-distclean debug-iphoneos-distclean \ + release-iphonesimulator-distclean release-iphoneos-distclean + QMAKE_EXTRA_TARGETS += xcode_distclean + distclean.depends = xcode_distclean + QMAKE_EXTRA_TARGETS += distclean + + args = + for(arg, QMAKE_ARGS): \ + args += $$system_quote($$arg) + system("cd $$system_quote($$OUT_PWD) && $$QMAKE_QMAKE $$args $$system_quote($$_PRO_FILE_) -spec macx-xcode") + + } else { + load(resolve_config) + + iphonesimulator: \ + sdk = iphonesimulator + else: \ + sdk = iphoneos + + debug: \ + cfg = debug + else: \ + cfg = release + + for(action, $$list(build install clean)) { + equals(action, build) { + action_target_suffix = + action_target = all + } else { + action_target_suffix = -$$action + action_target = $$action + } + + target = $${sdk}-$${cfg}$${action_target_suffix} + + $${target}.commands = "@bash -o pipefail -c 'xcodebuild $$action -sdk $$sdk -configuration $$title($$cfg) | grep -v setenv'" + QMAKE_EXTRA_TARGETS += $$target + + $${action_target}.depends += $$target + QMAKE_EXTRA_TARGETS *= $${action_target} + } + + xcode_build_dir_distclean.commands = "$(DEL_FILE) -R $$title($$cfg)-$${sdk}" + xcode_build_dir_distclean.depends = clean + QMAKE_EXTRA_TARGETS += xcode_build_dir_distclean + distclean.depends = xcode_build_dir_distclean + QMAKE_EXTRA_TARGETS += distclean + } + + CONFIG = + } + } +} else: equals(TEMPLATE, lib) { + iphonesimulator.name = Simulator + iphoneos.name = Device + addExclusiveBuilds(iphonesimulator, iphoneos) + + iphonesimulator_and_iphoneos:iphonesimulator { + QT_ARCH = i386 + QMAKE_MAC_SDK ~= s,^iphoneos,iphonesimulator, + + # Since the CPU feature detection done by configure is limited to one + # target at the moment, we disable SIMD support for simulator. + CONFIG -= simd } +} else: equals(TEMPLATE, subdirs) { + # Prevent recursion into host_builds + for(subdir, SUBDIRS) { + contains($${subdir}.CONFIG, host_build) { + $${subdir}.CONFIG += no_iphoneos_target no_iphonesimulator_target + + # Other targets which we do want to recurse into may depend on this target, + # for example corelib depends on moc, rcc, bootstrap, etc, and other libs + # may depend on host-tools that are needed to build the lib, so we resolve + # the final target name and redirect it to the base target, so that the + # dependency chain is not broken for the other targets. + + !isEmpty($${subdir}.target) { + target = $$eval($${subdir}.target) + } else { + !isEmpty($${subdir}.file): \ + file = $$eval($${subdir}.file) + else: !isEmpty($${subdir}.subdir): \ + file = $$eval($${subdir}.subdir) + else: \ + file = $$subdir + + target = sub-$$file + } + + target ~= s,[^a-zA-Z0-9_],-, + + $${target}-iphonesimulator.depends = $$target + $${target}-iphoneos.depends = $$target + QMAKE_EXTRA_TARGETS += $${target}-iphonesimulator $${target}-iphoneos + } + } + + prepareRecursiveTarget(iphonesimulator) + prepareRecursiveTarget(iphoneos) + QMAKE_EXTRA_TARGETS += iphonesimulator iphoneos + +} else: equals(TEMPLATE, aux) { + # Dummy targets for the 'aux' TEMPLATE, so we can always recurse + QMAKE_EXTRA_TARGETS *= iphonesimulator iphoneos } macx-xcode { @@ -57,15 +175,21 @@ macx-xcode { QMAKE_MAC_XCODE_SETTINGS += ios_device_family } -# Be more specific about which architecture we're targeting -equals(QT_ARCH, arm): \ - actual_archs = $$QMAKE_IOS_DEVICE_ARCHS -else: \ - actual_archs = $$QMAKE_IOS_SIMULATOR_ARCHS - macx-xcode { - QMAKE_XCODE_ARCHS = $$actual_archs + arch_iphoneos.name = "ARCHS[sdk=iphoneos*]" + arch_iphoneos.value = $$QMAKE_IOS_DEVICE_ARCHS + arch_iphonesimulator.name = "ARCHS[sdk=iphonesimulator*]" + arch_iphonesimulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS + + QMAKE_MAC_XCODE_SETTINGS += arch_iphoneos arch_iphonesimulator + unset(QMAKE_XCODE_ARCHS) } else { +# Be more specific about which architecture we're targeting + equals(QT_ARCH, arm): \ + actual_archs = $$QMAKE_IOS_DEVICE_ARCHS + else: \ + actual_archs = $$QMAKE_IOS_SIMULATOR_ARCHS + for(arch, actual_archs): \ arch_flags += -arch $$arch diff --git a/mkspecs/macx-ios-clang/features/default_pre.prf b/mkspecs/macx-ios-clang/features/default_pre.prf index b37f67495c..3501f5eae0 100644 --- a/mkspecs/macx-ios-clang/features/default_pre.prf +++ b/mkspecs/macx-ios-clang/features/default_pre.prf @@ -1,6 +1,10 @@ load(default_pre) +# In case Qt was built for a specific SDK +!iphonesimulator_and_iphoneos:contains(QMAKE_MAC_SDK, ^iphonesimulator.*): \ + CONFIG += iphonesimulator + # Check for supported Xcode versions lessThan(QMAKE_XCODE_VERSION, "4.3"): \ error("This mkspec requires Xcode 4.3 or later") diff --git a/mkspecs/macx-ios-clang/features/qt.prf b/mkspecs/macx-ios-clang/features/qt.prf index 2897c62819..9202a70a5a 100644 --- a/mkspecs/macx-ios-clang/features/qt.prf +++ b/mkspecs/macx-ios-clang/features/qt.prf @@ -31,14 +31,19 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) { # able to add symbolic breakpoints for 'main', not caring that the symbol is actually # called 'qt_main' now. - isEmpty(OBJECTS_DIR): \ - OBJECTS_DIR = . + macx-xcode { + objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}/${CURRENT_ARCH}" + } else { + objects_dir = $$OBJECTS_DIR + isEmpty(objects_dir): \ + objects_dir = . + } !isEmpty(QMAKE_PRE_LINK): \ QMAKE_PRE_LINK += ";" QMAKE_PRE_LINK += \ - "for f in $(find $${OBJECTS_DIR} -name '*.o'); do" \ + "for f in $(find $${objects_dir} -name '*.o'); do" \ "(nm $f | grep -q 'T _main' && cp $f $f.original" \ "&& ld -r -alias _main _qt_main -unexported_symbol _main $f.original -o $f)" \ "|| true" \ diff --git a/mkspecs/macx-llvm/Info.plist.app b/mkspecs/macx-llvm/Info.plist.app index 187a8e0aa4..8e44bd7f60 100644 --- a/mkspecs/macx-llvm/Info.plist.app +++ b/mkspecs/macx-llvm/Info.plist.app @@ -15,7 +15,7 @@ <key>CFBundleExecutable</key> <string>@EXECUTABLE@</string> <key>CFBundleIdentifier</key> - <string>com.yourcompany.@EXECUTABLE@</string> + <string>@BUNDLEIDENTIFIER@</string> <key>NOTE</key> <string>This file was generated by Qt/QMake.</string> </dict> diff --git a/mkspecs/win32-msvc2005/qplatformdefs.h b/mkspecs/win32-msvc2005/qplatformdefs.h index c6feb4895d..c7370f1c63 100644 --- a/mkspecs/win32-msvc2005/qplatformdefs.h +++ b/mkspecs/win32-msvc2005/qplatformdefs.h @@ -81,6 +81,8 @@ #define QT_STAT_MASK _S_IFMT #if defined(_S_IFLNK) # define QT_STAT_LNK _S_IFLNK +#else +# define QT_STAT_LNK 0120000 #endif #define QT_FILENO _fileno #define QT_OPEN ::_open diff --git a/mkspecs/win32-msvc2013/qmake.conf b/mkspecs/win32-msvc2013/qmake.conf index 89d2dd45a4..7ca261f1d4 100644 --- a/mkspecs/win32-msvc2013/qmake.conf +++ b/mkspecs/win32-msvc2013/qmake.conf @@ -21,7 +21,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = byacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t +QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t -FS QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD diff --git a/qmake/doc/qmake.qdocconf b/qmake/doc/qmake.qdocconf index 537c6b3e65..a5bd089a5d 100644 --- a/qmake/doc/qmake.qdocconf +++ b/qmake/doc/qmake.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QMake description = QMake Manual -url = http://qt-project.org/doc/qt-$QT_VER/qmake +url = http://qt-project.org/doc/qt-$QT_VER qhp.projects = qmake @@ -75,4 +75,3 @@ depends += \ qtx11extras \ qtxml \ qtxmlpatterns - diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index d7624c2dc3..2eaf2cfc54 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2773,7 +2773,7 @@ Basic test functions are implemented as built-in functions. - \section2 cache(variablename, [set|add|sub] [transient] [super], [source variablename]) + \section2 cache(variablename, [set|add|sub] [transient] [super|stash], [source variablename]) This is an internal function that you will typically not need. diff --git a/qmake/generators/integrity/gbuild.cpp b/qmake/generators/integrity/gbuild.cpp index 8a3a75b7d9..e8e992b694 100644 --- a/qmake/generators/integrity/gbuild.cpp +++ b/qmake/generators/integrity/gbuild.cpp @@ -417,6 +417,7 @@ QString GBuildMakefileGenerator::writeOne(QString filename, QString pathtoremove bool GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const { + Q_UNUSED(build) debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); QFileInfo fi(file); if (fi.filePath().isEmpty()) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 524603aa63..2674f31d03 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -463,12 +463,12 @@ ProjectBuilderSources::files(QMakeProject *project) const { QStringList ret = project->values(ProKey(key)).toQStringList(); if(key == "QMAKE_INTERNAL_INCLUDED_FILES") { + QStringList newret; for(int i = 0; i < ret.size(); ++i) { - QStringList newret; if(!ret.at(i).endsWith(Option::prf_ext)) newret.append(ret.at(i)); - ret = newret; } + ret = newret; } if(key == "SOURCES" && project->first("TEMPLATE") == "app" && !project->isEmpty("ICON")) ret.append(project->first("ICON").toQString()); @@ -1260,11 +1260,33 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n" << "\t\t};\n"; + { + QString aggregate_target_key = keyFor(pbx_dir + "QMAKE_PBX_AGGREGATE_TARGET"); + project->values("QMAKE_PBX_TARGETS").append(aggregate_target_key); + t << "\t\t" << aggregate_target_key << " = {\n" + << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES"), SettingsAsList, 4) << ";\n" + << "\t\t\t" << writeSettings("dependencies", ProStringList(), SettingsAsList, 4) << ";\n" + << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_TARGET"), SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("isa", "PBXAggregateTarget", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList) << ";\n" + << "\t\t\t" << writeSettings("productName", "Qt Preprocess") << ";\n" + << "\t\t\t" << writeSettings("name", "Qt Preprocess") << ";\n" + << "\t\t};\n"; + + QString aggregate_target_dep_key = keyFor(pbx_dir + "QMAKE_PBX_AGGREGATE_TARGET_DEP"); + t << "\t\t" << aggregate_target_dep_key << " = {\n" + << "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("target", aggregate_target_key) << ";\n" + << "\t\t};\n"; + + project->values("QMAKE_PBX_TARGET_DEPENDS").append(aggregate_target_dep_key); + } + //TARGET QString target_key = keyFor(pbx_dir + "QMAKE_PBX_TARGET"); - project->values("QMAKE_PBX_TARGETS").append(target_key); + project->values("QMAKE_PBX_TARGETS").prepend(target_key); t << "\t\t" << target_key << " = {\n" - << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES") + project->values("QMAKE_PBX_BUILDPHASES"), + << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_BUILDPHASES"), SettingsAsList, 4) << ";\n"; t << "\t\t\t" << writeSettings("dependencies", project->values("QMAKE_PBX_TARGET_DEPENDS"), SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("productReference", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";\n"; @@ -1367,7 +1389,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if ((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) || (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && project->isActiveConfig("lib_bundle"))) { - QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString()); + QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), Option::output_dir, input_dir); if (plist.isEmpty()) plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); if (exists(plist)) { @@ -1382,7 +1404,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } else { plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString()); } - plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", QLatin1String("${PRODUCT_NAME:rfc1034identifier}")); + QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString(); + if (bundlePrefix.isEmpty()) + bundlePrefix = "com.yourcompany"; + plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", bundlePrefix + "." + QLatin1String("${PRODUCT_NAME:rfc1034identifier}")); if (!project->values("VERSION").isEmpty()) { plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + project->first("VER_MIN")); @@ -1397,6 +1422,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";\n"; } } + } else { + warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData()); } } @@ -1770,6 +1797,7 @@ ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where) QString ProjectBuilderMakefileGenerator::sourceTreeForFile(const QString &where) { + Q_UNUSED(where) // We always use absolute paths, instead of maintaining the SRCROOT // build variable and making files relative to that. return QLatin1String("<absolute>"); diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 9ebaf60843..d88c6e447a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -43,6 +43,9 @@ #include "option.h" #include "cachekeys.h" #include "meta.h" + +#include <ioutils.h> + #include <qdir.h> #include <qfile.h> #include <qtextstream.h> @@ -52,6 +55,7 @@ #include <qbuffer.h> #include <qsettings.h> #include <qdatetime.h> + #if defined(Q_OS_UNIX) #include <unistd.h> #else @@ -92,7 +96,7 @@ bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const QString MakefileGenerator::mkdir_p_asstring(const QString &dir, bool escape) const { - QString edir = escape ? escapeFilePath(dir) : dir; + QString edir = escape ? escapeFilePath(Option::fixPathToTargetOS(dir, false, false)) : dir; return "@" + makedir.arg(edir); } @@ -2261,7 +2265,7 @@ QString MakefileGenerator::buildArgs() { QString ret; - foreach (const QString &arg, Option::qmake_args) + foreach (const QString &arg, Option::globals->qmake_args) ret += " " + escapeFilePath(arg); return ret; } @@ -3270,7 +3274,11 @@ MakefileGenerator::writePkgConfigFile() } } t << "Description: " << desc << endl; - t << "Version: " << project->first("VERSION") << endl; + ProString version = project->first("QMAKE_PKGCONFIG_VERSION"); + if (version.isEmpty()) + version = project->first("VERSION"); + if (!version.isEmpty()) + t << "Version: " << version << endl; // libs t << "Libs: "; @@ -3341,11 +3349,17 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")), replace = project->first(ProKey(replace_rules.at(r) + ".replace")); if (!match.isEmpty() /*&& match != replace*/) - ret += " -e \"s," + match + "," + replace + ",g\""; + ret += " -e " + shellQuote("s," + match + "," + replace + ",g"); } ret += " \"" + src + "\" >\"" + dst + "\""; } return ret; } +QString MakefileGenerator::shellQuote(const QString &str) +{ + return isWindowsShell() ? QMakeInternal::IoUtils::shellQuoteWin(str) + : QMakeInternal::IoUtils::shellQuoteUnix(str); +} + QT_END_NAMESPACE diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 09327c599c..4b8a96c15f 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -271,6 +271,7 @@ public: virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; } virtual bool openOutput(QFile &, const QString &build) const; bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); } + QString shellQuote(const QString &str); }; inline void MakefileGenerator::setNoIO(bool o) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 2373059f79..35639a33bf 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -285,13 +285,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << odir << ".deps/%.d: " << pwd << "/%.cpp\n\t"; if(project->isActiveConfig("echo_depend_creation")) t << "@echo Creating depend for $<\n\t"; - t << mkdir_p_asstring("$(@D)") << "\n\t" + t << mkdir_p_asstring("$(@D)", false) << "\n\t" << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n"; t << odir << ".deps/%.d: " << pwd << "/%.c\n\t"; if(project->isActiveConfig("echo_depend_creation")) t << "@echo Creating depend for $<\n\t"; - t << mkdir_p_asstring("$(@D)") << "\n\t" + t << mkdir_p_asstring("$(@D)", false) << "\n\t" << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n"; static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 }; @@ -502,7 +502,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) incr_lflags += var("QMAKE_LFLAGS_RELEASE"); t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)\n\t"; if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir) << "\n\t"; + t << mkdir_p_asstring(destdir, false) << "\n\t"; t << "$(LINK) " << incr_lflags << " " << var("QMAKE_LINK_O_FLAG") << incr_target_dir << " $(INCREMENTAL_OBJECTS)\n"; //communicated below @@ -528,7 +528,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << " " << var("POST_TARGETDEPS"); } if(!destdir.isEmpty()) - t << "\n\t" << mkdir_p_asstring(destdir); + t << "\n\t" << mkdir_p_asstring(destdir, false); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" << var("QMAKE_PRE_LINK"); @@ -685,7 +685,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->first("QMAKE_PKGINFO").isEmpty()) { ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO")); - QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents"); + QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents"; t << pkginfo << ": \n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; @@ -697,7 +697,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) { ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE")); bundledFiles << resources; - QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources"); + QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources"; t << resources << ": \n\t"; t << mkdir_p_asstring(destdir) << "\n\t"; t << "@touch " << resources << "\n\t\n"; @@ -710,7 +710,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); t << info_plist_out << ": \n\t"; if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir) << "\n\t"; + t << mkdir_p_asstring(destdir, false) << "\n\t"; ProStringList commonSedArgs; if (!project->values("VERSION").isEmpty()) commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" "; @@ -804,7 +804,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) project->first("OBJECTS_DIR")) + ddir, Option::output_dir, Option::output_dir)); t << "dist: \n\t" - << mkdir_p_asstring(ddir_c) << "\n\t" + << mkdir_p_asstring(ddir_c, false) << "\n\t" << "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && "; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); @@ -920,7 +920,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " << destdir << "$(TARGET2) $(TARGETA)\n"; } else { - t << "\t-$(DEL_FILE) $(TARGET) \n"; + t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n"; } t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n"); { @@ -1266,6 +1266,8 @@ void UnixMakefileGenerator::init2() alldeps += path + Option::dir_sep + fileInfo(files[file].toQString()).fileName(); } } + } else { + warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData()); } } } diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index a83f8f364b..f5a6e15a7b 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -147,6 +147,7 @@ const char _HeapReserveSize[] = "HeapReserveSize"; const char _IgnoreAllDefaultLibraries[] = "IgnoreAllDefaultLibraries"; const char _IgnoreEmbeddedIDL[] = "IgnoreEmbeddedIDL"; const char _IgnoreImportLibrary[] = "IgnoreImportLibrary"; +const char _ImageHasSafeExceptionHandlers[] = "ImageHasSafeExceptionHandlers"; const char _IgnoreSpecificDefaultLibraries[] = "IgnoreSpecificDefaultLibraries"; const char _IgnoreStandardIncludePath[] = "IgnoreStandardIncludePath"; const char _ImportLibrary[] = "ImportLibrary"; @@ -1494,6 +1495,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCLinkerTool &tool) << attrTagT(_IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries) << attrTagT(_IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL) << attrTagT(_IgnoreImportLibrary, tool.IgnoreImportLibrary) + << attrTagT(_ImageHasSafeExceptionHandlers, tool.ImageHasSafeExceptionHandlers) << attrTagX(_IgnoreSpecificDefaultLibraries, tool.IgnoreDefaultLibraryNames, ";") << attrTagS(_ImportLibrary, tool.ImportLibrary) << attrTagS(_KeyContainer, tool.KeyContainer) @@ -1760,9 +1762,6 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu else root = new XTreeNode; - QString name, extfilter; - triState parse; - for (int i = 0; i < project.SingleProjects.count(); ++i) { VCFilter filter; const VCProjectSingleConfig &singleCfg = project.SingleProjects.at(i); @@ -1792,14 +1791,6 @@ void VCXProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, XmlOutpu // Merge all files in this filter to root tree for (int x = 0; x < filter.Files.count(); ++x) root->addElement(filter.Files.at(x)); - - // Save filter setting from first filter. Next filters - // may differ but we cannot handle that. (ex. extfilter) - if (name.isEmpty()) { - name = filter.Name; - extfilter = filter.Filter; - parse = filter.ParseFiles; - } } if (!root->hasElements()) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index f50b3dd0d0..6d148e41a2 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -113,9 +113,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) qPrintable(variables["QMAKESPEC"].first().toQString())); return false; } - } -#ifdef Q_OS_WIN - else if (project->isActiveConfig(QStringLiteral("winrt"))) { + } else if (project->isActiveConfig(QStringLiteral("winrt"))) { QString arch = project->first("VCPROJ_ARCH").toQString().toLower(); QString compiler; QString compilerArch; @@ -143,6 +141,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return false; } + const bool isPhone = project->isActiveConfig(QStringLiteral("winphone")); +#ifdef Q_OS_WIN QString regKeyPrefix; #if !defined(Q_OS_WIN64) && _WIN32_WINNT >= 0x0501 BOOL isWow64; @@ -160,7 +160,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return false; } - const bool isPhone = project->isActiveConfig(QStringLiteral("winphone")); regKey = regKeyPrefix + (isPhone ? QStringLiteral("Microsoft\\Microsoft SDKs\\WindowsPhone\\v") : QStringLiteral("Microsoft\\Microsoft SDKs\\Windows\\v")) @@ -170,6 +169,10 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) fprintf(stderr, "Failed to find the Windows Kit installation directory.\n"); return false; } +#else + const QString vcInstallDir = "/fake/vc_install_dir"; + const QString kitDir = "/fake/sdk_install_dir"; +#endif // Q_OS_WIN QStringList incDirs; QStringList libDirs; @@ -209,7 +212,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) t << "\nLIB = " << nmakePathList(libDirs); t << "\nPATH = " << nmakePathList(binDirs) << '\n'; } -#endif // Q_OS_WIN } writeNmakeParts(t); return MakefileGenerator::writeMakefile(t); @@ -251,8 +253,10 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t) if(targetdir.right(1) != Option::dir_sep) targetdir += Option::dir_sep; - if(t == "target" && project->first("TEMPLATE") == "lib") { - if(project->isActiveConfig("shared") && project->isActiveConfig("debug")) { + if (project->isActiveConfig("debug")) { + if (t == "dlltarget" + || (project->first("TEMPLATE") == "lib" + && project->isActiveConfig("shared"))) { QString pdb_target = getPdbTarget(); pdb_target.remove('"'); QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 09213bec8e..019bb2504d 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1172,6 +1172,7 @@ VCLinkerTool::VCLinkerTool() IgnoreAllDefaultLibraries(unset), IgnoreEmbeddedIDL(unset), IgnoreImportLibrary(_True), + ImageHasSafeExceptionHandlers(unset), LargeAddressAware(addrAwareDefault), LinkDLL(unset), LinkIncremental(linkIncrementalDefault), @@ -1198,7 +1199,6 @@ VCLinkerTool::VCLinkerTool() TurnOffAssemblyGeneration(unset), TypeLibraryResourceID(0), GenerateManifest(unset), - GenerateWindowsMetadata(unset), EnableUAC(unset), UACUIAccess(unset), SectionAlignment(-1), @@ -1206,7 +1206,8 @@ VCLinkerTool::VCLinkerTool() AllowIsolation(unset), AssemblyDebug(unset), CLRUnmanagedCodeCheck(unset), - DelaySign(unset) + DelaySign(unset), + GenerateWindowsMetadata(unset) { } @@ -1654,11 +1655,12 @@ bool VCLinkerTool::parseOption(const char* option) StackCommitSize = both[1].toLongLong(); } break; - case 0x75AA4D8: // /SAFESH:{NO} - { + case 0x75AA4D8: // /SAFESEH:{NO} + if (config->CompilerVersion >= NET2010) + ImageHasSafeExceptionHandlers = (option[8] == ':') ? _False : _True; + else AdditionalOptions += option; - break; - } + break; case 0x9B3C00D: case 0x78dc00d: // /SUBSYSTEM:{CONSOLE|EFI_APPLICATION|EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|NATIVE|POSIX|WINDOWS|WINDOWSCE}[,major[.minor]] { @@ -2119,9 +2121,9 @@ VCPreLinkEventTool::VCPreLinkEventTool() // VCConfiguration -------------------------------------------------- VCConfiguration::VCConfiguration() - : ATLMinimizesCRunTimeLibraryUsage(unset), - WinRT(false), + : WinRT(false), WinPhone(false), + ATLMinimizesCRunTimeLibraryUsage(unset), BuildBrowserInformation(unset), CharacterSet(charSetNotSet), ConfigurationType(typeApplication), @@ -2859,7 +2861,7 @@ void VCProjectWriter::outputFilter(VCProject &project, XmlOutput &xml, const QSt root = new TreeNode; QString name, extfilter, guid; - triState parse; + triState parse = unset; for (int i = 0; i < project.SingleProjects.count(); ++i) { VCFilter filter; diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 4e19a43a8c..58b528301c 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -615,6 +615,7 @@ public: QStringList IgnoreDefaultLibraryNames; triState IgnoreEmbeddedIDL; triState IgnoreImportLibrary; + triState ImageHasSafeExceptionHandlers; QString ImportLibrary; addressAwarenessType LargeAddressAware; triState LinkDLL; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index a30129fa27..934902fd4a 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -124,17 +124,17 @@ DotNET which_dotnet_version() // Fallback to .NET 2002 current_version = NET2002; - QStringList warnPath; + const DotNetCombo *lowestInstalledVersion = 0; QHash<DotNET, QString> installPaths; int installed = 0; int i = 0; for(; dotNetCombo[i].version; ++i) { QString path = qt_readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey); if (!path.isEmpty() && installPaths.value(dotNetCombo[i].version) != path) { - installPaths.insert(dotNetCombo[i].version, path); + lowestInstalledVersion = &dotNetCombo[i]; + installPaths.insert(lowestInstalledVersion->version, path); ++installed; - current_version = dotNetCombo[i].version; - warnPath += QString("%1").arg(dotNetCombo[i].versionStr); + current_version = lowestInstalledVersion->version; } } @@ -143,35 +143,20 @@ DotNET which_dotnet_version() // More than one version installed, search directory path QString paths = qgetenv("PATH"); - QStringList pathlist = paths.toLower().split(";"); - - i = installed = 0; - for(; dotNetCombo[i].version; ++i) { - QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, dotNetCombo[i].regKey).toLower(); - if (productPath.isEmpty()) - continue; - QStringList::iterator it; - for(it = pathlist.begin(); it != pathlist.end(); ++it) { - if((*it).contains(productPath)) { - ++installed; - current_version = dotNetCombo[i].version; - warnPath += QString("%1 in path").arg(dotNetCombo[i].versionStr); - break; - } + const QStringList pathlist = paths.split(QLatin1Char(';')); + foreach (const QString &path, pathlist) { + for (i = 0; dotNetCombo[i].version; ++i) { + const QString productPath = installPaths.value(dotNetCombo[i].version); + if (productPath.isEmpty()) + continue; + if (path.startsWith(productPath, Qt::CaseInsensitive)) + return dotNetCombo[i].version; } } - switch(installed) { - case 1: - break; - case 0: - warn_msg(WarnLogic, "Generator: MSVC.NET: Found more than one version of Visual Studio, but" - " none in your path! Fallback to lowest version (%s)", warnPath.join(", ").toLatin1().data()); - break; - default: - warn_msg(WarnLogic, "Generator: MSVC.NET: Found more than one version of Visual Studio in" - " your path! Fallback to lowest version (%s)", warnPath.join(", ").toLatin1().data()); - break; - } + + warn_msg(WarnLogic, "Generator: MSVC.NET: Found more than one version of Visual Studio, but" + " none in your PATH. Falling back to lowest version (%s)", + qPrintable(lowestInstalledVersion->versionStr)); return current_version; #endif @@ -514,7 +499,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt // We want to store it as the .lib name. if (newDep->target.endsWith(".dll")) newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; - projGuids.insert(val.first, newDep->target); + projGuids.insert(newDep->orig_target, newDep->target); if (val.second.size()) { const ProStringList depends = val.second; diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 9cefbc8572..96de34fd14 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1590,11 +1590,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } case T_CACHE: { if (args.count() > 3) { - evalError(fL1S("cache(var, [set|add|sub] [transient] [super], [srcvar]) requires one to three arguments.")); + evalError(fL1S("cache(var, [set|add|sub] [transient] [super|stash], [srcvar]) requires one to three arguments.")); return ReturnFalse; } bool persist = true; - bool super = false; + enum { TargetStash, TargetCache, TargetSuper } target = TargetCache; enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet; ProKey srcvar; if (args.count() >= 2) { @@ -1603,7 +1603,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( if (m_tmp3 == QLatin1String("transient")) { persist = false; } else if (m_tmp3 == QLatin1String("super")) { - super = true; + target = TargetSuper; + } else if (m_tmp3 == QLatin1String("stash")) { + target = TargetStash; } else if (m_tmp3 == QLatin1String("set")) { mode = CacheSet; } else if (m_tmp3 == QLatin1String("add")) { @@ -1642,7 +1644,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( m_option->mutex.lock(); #endif QMakeBaseEnv *baseEnv = - m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, hostBuild)); + m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, m_stashfile, hostBuild)); #ifdef PROEVALUATOR_THREAD_SAFE // It's ok to unlock this before locking baseEnv, // as we have no intention to initialize the env. @@ -1675,21 +1677,23 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( removeEach(&newval, diffval); } if (oldval != newval) { - baseEval->valuesRef(dstvar) = newval; - if (super) { - do { - if (dstvar == QLatin1String("QMAKEPATH")) { - baseEval->m_qmakepath = newval.toQStringList(); - baseEval->updateMkspecPaths(); - } else if (dstvar == QLatin1String("QMAKEFEATURES")) { - baseEval->m_qmakefeatures = newval.toQStringList(); - } else { - break; - } - baseEval->updateFeaturePaths(); - if (hostBuild == m_hostBuild) - m_featureRoots = baseEval->m_featureRoots; - } while (false); + if (target != TargetStash || !m_stashfile.isEmpty()) { + baseEval->valuesRef(dstvar) = newval; + if (target == TargetSuper) { + do { + if (dstvar == QLatin1String("QMAKEPATH")) { + baseEval->m_qmakepath = newval.toQStringList(); + baseEval->updateMkspecPaths(); + } else if (dstvar == QLatin1String("QMAKEFEATURES")) { + baseEval->m_qmakefeatures = newval.toQStringList(); + } else { + break; + } + baseEval->updateFeaturePaths(); + if (hostBuild == m_hostBuild) + m_featureRoots = baseEval->m_featureRoots; + } while (false); + } } changed = true; } @@ -1720,16 +1724,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( varstr += QLatin1Char('\n'); } QString fn; - if (super) { + if (target == TargetSuper) { if (m_superfile.isEmpty()) { - m_superfile = m_outputDir + QLatin1String("/.qmake.super"); + m_superfile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.super")); printf("Info: creating super cache file %s\n", qPrintable(m_superfile)); valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); } fn = m_superfile; - } else { + } else if (target == TargetCache) { if (m_cachefile.isEmpty()) { - m_cachefile = m_outputDir + QLatin1String("/.qmake.cache"); + m_cachefile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.cache")); printf("Info: creating cache file %s\n", qPrintable(m_cachefile)); valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile); // We could update m_{source,build}Root and m_featureRoots here, or even @@ -1739,6 +1743,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( // The sub-projects will find the new cache all by themselves. } fn = m_cachefile; + } else { + fn = m_stashfile; + if (fn.isEmpty()) + fn = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.stash")); + if (!m_vfs->exists(fn)) { + printf("Info: creating stash file %s\n", qPrintable(fn)); + valuesRef(ProKey("_QMAKE_STASH_")) << ProString(fn); + } } return writeFile(fL1S("cache "), fn, QIODevice::Append, varstr); } diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index c4dca12900..f46eb75670 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -79,19 +79,19 @@ QT_BEGIN_NAMESPACE #define fL1S(s) QString::fromLatin1(s) -QMakeBaseKey::QMakeBaseKey(const QString &_root, bool _hostBuild) - : root(_root), hostBuild(_hostBuild) +QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild) + : root(_root), stash(_stash), hostBuild(_hostBuild) { } uint qHash(const QMakeBaseKey &key) { - return qHash(key.root) ^ (uint)key.hostBuild; + return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild; } bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two) { - return one.root == two.root && one.hostBuild == two.hostBuild; + return one.root == two.root && one.stash == two.stash && one.hostBuild == two.hostBuild; } QMakeBaseEnv::QMakeBaseEnv() @@ -982,6 +982,8 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString()); if (!m_option->qmake_abslocation.isEmpty()) vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation); + if (!m_option->qmake_args.isEmpty()) + vars[ProKey("QMAKE_ARGS")] = ProStringList(m_option->qmake_args); #if defined(Q_OS_WIN32) vars[ProKey("QMAKE_HOST.os")] << ProString("Windows"); @@ -1137,6 +1139,19 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) dir = qdfi.path(); } + dir = m_outputDir; + forever { + QString stashfile = dir + QLatin1String("/.qmake.stash"); + if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) { + m_stashfile = QDir::cleanPath(stashfile); + break; + } + QFileInfo qdfi(dir); + if (qdfi.isRoot()) + break; + dir = qdfi.path(); + } + return true; } @@ -1186,23 +1201,18 @@ bool QMakeEvaluator::loadSpec() QMakeEvaluator evaluator(m_option, m_parser, m_vfs, m_handler); evaluator.m_sourceRoot = m_sourceRoot; evaluator.m_buildRoot = m_buildRoot; - if (!m_superfile.isEmpty()) { - valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); - if (evaluator.evaluateFile( - m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) - return false; + + if (!m_superfile.isEmpty() && evaluator.evaluateFile( + m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { + return false; } - if (!m_conffile.isEmpty()) { - valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile); - if (evaluator.evaluateFile( - m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) - return false; + if (!m_conffile.isEmpty() && evaluator.evaluateFile( + m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { + return false; } - if (!m_cachefile.isEmpty()) { - valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile); - if (evaluator.evaluateFile( - m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) - return false; + if (!m_cachefile.isEmpty() && evaluator.evaluateFile( + m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { + return false; } if (qmakespec.isEmpty()) { if (!m_hostBuild) @@ -1236,19 +1246,31 @@ bool QMakeEvaluator::loadSpec() cool: m_qmakespec = QDir::cleanPath(qmakespec); - if (!m_superfile.isEmpty() - && evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) { - return false; + if (!m_superfile.isEmpty()) { + valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); + if (evaluateFile( + m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) + return false; } if (!loadSpecInternal()) return false; - if (!m_conffile.isEmpty() - && evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) { - return false; + if (!m_conffile.isEmpty()) { + valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile); + if (evaluateFile( + m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; } - if (!m_cachefile.isEmpty() - && evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) { - return false; + if (!m_cachefile.isEmpty()) { + valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile); + if (evaluateFile( + m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; + } + if (!m_stashfile.isEmpty() && m_vfs->exists(m_stashfile)) { + valuesRef(ProKey("_QMAKE_STASH_")) << ProString(m_stashfile); + if (evaluateFile( + m_stashfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; } return true; } @@ -1327,7 +1349,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( #ifdef PROEVALUATOR_THREAD_SAFE m_option->mutex.lock(); #endif - QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_hostBuild)]; + QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_stashfile, m_hostBuild)]; if (!*baseEnvPtr) *baseEnvPtr = new QMakeBaseEnv; QMakeBaseEnv *baseEnv = *baseEnvPtr; @@ -1354,6 +1376,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( baseEval->m_superfile = m_superfile; baseEval->m_conffile = m_conffile; baseEval->m_cachefile = m_cachefile; + baseEval->m_stashfile = m_stashfile; baseEval->m_sourceRoot = m_sourceRoot; baseEval->m_buildRoot = m_buildRoot; baseEval->m_hostBuild = m_hostBuild; diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index c1e7037762..de13033481 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -298,6 +298,7 @@ public: QString m_superfile; QString m_conffile; QString m_cachefile; + QString m_stashfile; QString m_sourceRoot; QString m_buildRoot; QStringList m_qmakepath; diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index b305b495bc..1f217138b4 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -66,9 +66,10 @@ class QMakeEvaluator; class QMakeBaseKey { public: - QMakeBaseKey(const QString &_root, bool _hostBuild); + QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild); QString root; + QString stash; bool hostBuild; }; @@ -117,6 +118,7 @@ public: QProcessEnvironment environment; #endif QString qmake_abslocation; + QStringList qmake_args; QString qmakespec, xqmakespec; QString user_template, user_template_prefix; diff --git a/qmake/main.cpp b/qmake/main.cpp index b1929e0d21..79e3739f56 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -106,7 +106,7 @@ static int doSed(int argc, char **argv) } } if (phase == 1 - && (c == QLatin1Char('+') || c == QLatin1Char('?') + && (c == QLatin1Char('+') || c == QLatin1Char('?') || c == QLatin1Char('|') || c == QLatin1Char('{') || c == QLatin1Char('}') || c == QLatin1Char('(') || c == QLatin1Char(')'))) { // translate sed rx to QRegExp @@ -133,6 +133,7 @@ static int doSed(int argc, char **argv) SedSubst subst; subst.from = QRegExp(phases.at(0)); subst.to = phases.at(1); + subst.to.replace("\\\\", "\\"); // QString::replace(rx, sub) groks \1, but not \\. substs << subst; } } else if (argv[i][0] == '-' && argv[i][1] != 0) { diff --git a/qmake/option.cpp b/qmake/option.cpp index da52542a7d..7b93144d82 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -82,7 +82,6 @@ char Option::field_sep; Option::QMAKE_MODE Option::qmake_mode = Option::QMAKE_GENERATE_NOTHING; //all modes -QStringList Option::qmake_args; int Option::warn_level = WarnLogic | WarnDeprecated; int Option::debug_level = 0; QFile Option::output; @@ -436,7 +435,7 @@ Option::init(int argc, char **argv) return ret; //return ret == QMAKE_CMDLINE_SHOW_USAGE ? usage(argv[0]) : false; } - Option::qmake_args = args; + globals->qmake_args = args; } globals->commitCommandLineArguments(cmdstate); globals->debugLevel = Option::debug_level; @@ -532,12 +531,11 @@ Option::fixString(QString string, uchar flags) string = QDir::cleanPath(string); } - bool localSep = (flags & Option::FixPathToLocalSeparators) != 0; - bool targetSep = (flags & Option::FixPathToTargetSeparators) != 0; - bool normalSep = (flags & Option::FixPathToNormalSeparators) != 0; - // either none or only one active flag - Q_ASSERT(localSep + targetSep + normalSep <= 1); + Q_ASSERT(((flags & Option::FixPathToLocalSeparators) != 0) + + ((flags & Option::FixPathToTargetSeparators) != 0) + + ((flags & Option::FixPathToNormalSeparators) != 0) <= 1); + //fix separators if (flags & Option::FixPathToNormalSeparators) { string = string.replace('\\', '/'); diff --git a/qmake/option.h b/qmake/option.h index af8e3b7ab8..d0436fe844 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -178,7 +178,6 @@ struct Option static QMAKE_MODE qmake_mode; //all modes - static QStringList qmake_args; static QFile output; static QString output_dir; static int debug_level; diff --git a/qmake/property.cpp b/qmake/property.cpp index 38d454cb5d..e50485ce19 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -81,7 +81,7 @@ static const struct { QMakeProperty::QMakeProperty() : settings(0) { - for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) { + for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) { QString name = QString::fromLatin1(propList[i].name); m_values[ProKey(name + "/src")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectiveSourcePaths); m_values[ProKey(name + "/get")] = QLibraryInfo::rawLocation(propList[i].loc, QLibraryInfo::EffectivePaths); @@ -155,7 +155,7 @@ QMakeProperty::exec() fprintf(stdout, "%s:%s\n", qPrintable(key), qPrintable(val)); } QStringList specialProps; - for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) + for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) specialProps.append(QString::fromLatin1(propList[i].name)); specialProps.append("QMAKE_VERSION"); #ifdef QT_VERSION_STR diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 5012bd0206..661b787a55 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -1,6 +1,3 @@ -SKIP_DEPENDS += qconfig.h qmodules.h -DEFINES += QT_NO_TEXTCODEC QT_NO_LIBRARY QT_NO_COMPRESS QT_NO_UNICODETABLES \ - QT_NO_GEOM_VARIANT QT_NO_DATASTREAM #qmake code SOURCES += project.cpp property.cpp main.cpp \ @@ -37,7 +34,6 @@ contains(QT_EDITION, OpenSource) { } bootstrap { #Qt code - DEFINES+=QT_NO_THREAD SOURCES+= \ qbitarray.cpp \ qbuffer.cpp \ @@ -160,7 +156,16 @@ bootstrap { #Qt code CFLAGS += -fhonor-std LFLAGS += -lcpp } - DEFINES *= QT_NO_QOBJECT QT_CRYPTOGRAPHICHASH_ONLY_SHA1 + + DEFINES += \ + QT_BOOTSTRAPPED \ + QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_NO_COMPONENT QT_NO_COMPRESS \ + QT_NO_THREAD QT_NO_QOBJECT QT_NO_GEOM_VARIANT QT_NO_DATASTREAM \ + QT_CRYPTOGRAPHICHASH_ONLY_SHA1 QT_JSON_READONLY + + INCLUDEPATH += \ + $$QT.core.includes $$QT.core_private.includes \ + $$shadowed(../src/corelib/global) } else { CONFIG += qt QT = core diff --git a/qmake/qmake.pro b/qmake/qmake.pro index e680942716..89d6ea5fc1 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -4,24 +4,21 @@ option(host_build) CONFIG += console bootstrap -CONFIG -= qt shared app_bundle uic -DEFINES += QT_BUILD_QMAKE QT_BOOTSTRAPPED \ +CONFIG -= qt +DEFINES += \ + QT_BUILD_QMAKE \ PROEVALUATOR_FULL -DESTDIR = ../bin/ -OBJECTS_DIR = . -MOC_DIR = . - -#guts -VPATH += $$QT_SOURCE_TREE/src/corelib/global \ - $$QT_SOURCE_TREE/src/corelib/tools \ - $$QT_SOURCE_TREE/src/corelib/kernel \ - $$QT_SOURCE_TREE/src/corelib/codecs \ - $$QT_SOURCE_TREE/src/corelib/plugin \ - $$QT_SOURCE_TREE/src/corelib/xml \ - $$QT_SOURCE_TREE/src/corelib/io \ - $$QT_SOURCE_TREE/src/corelib/json \ - $$QT_SOURCE_TREE/tools/shared/windows +VPATH += \ + ../src/corelib/global \ + ../src/corelib/tools \ + ../src/corelib/kernel \ + ../src/corelib/codecs \ + ../src/corelib/plugin \ + ../src/corelib/xml \ + ../src/corelib/io \ + ../src/corelib/json \ + ../tools/shared/windows INCLUDEPATH += . \ library \ @@ -30,11 +27,8 @@ INCLUDEPATH += . \ generators/win32 \ generators/mac \ generators/integrity \ - $$QT_SOURCE_TREE/include \ - $$QT_SOURCE_TREE/include/QtCore \ - $$QT_SOURCE_TREE/include/QtCore/$$QT_VERSION \ - $$QT_SOURCE_TREE/include/QtCore/$$QT_VERSION/QtCore \ - $$QT_SOURCE_TREE/tools/shared \ - $$QT_SOURCE_TREE/qmake + ../tools/shared include(qmake.pri) + +load(qt_app) diff --git a/qtbase.pro b/qtbase.pro index d3b03d1fba..9091fba4e0 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -103,10 +103,83 @@ prefix_build|!equals(PWD, $$OUT_PWD) { } +# Generate qfeatures.h +features = +lines = $$cat("src/corelib/global/qfeatures.txt", lines) +for (line, lines) { + t = $$replace(line, "^Feature: (\\S+)\\s*$", "\\1") + !isEqual(t, $$line) { + feature = $$t + features += $$t + } else { + t = $$replace(line, "^Requires: (.*)$", "\\1") + !isEqual(t, $$line) { + features.$${feature}.depends = $$replace(t, \\s+$, ) + } else { + t = $$replace(line, "^Name: (.*)$", "\\1") + !isEqual(t, $$line) { + features.$${feature}.name = $$replace(t, \\s+$, ) + } + } + } +} +features = $$sort_depends(features, features.) +features = $$reverse(features) +FEATURES_H = \ + "/*" \ + " * All feature dependencies." \ + " *" \ + " * This list is generated by qmake from <qtbase>/src/corelib/global/qfeatures.txt" \ + " */" +FEATURES_PRI = +for (ft, features) { + !isEmpty(features.$${ft}.depends) { + FEATURES_H += \ + "$${LITERAL_HASH}if !defined(QT_NO_$$ft) && ($$join($$list($$split(features.$${ft}.depends)), ") || defined(QT_NO_", "defined(QT_NO_", ")"))" \ + "$${LITERAL_HASH} define QT_NO_$$ft" \ + "$${LITERAL_HASH}endif" + FEATURES_PRI += \ + "contains(QT_DISABLED_FEATURES, "^($$lower($$join($$list($$replace(features.$${ft}.depends, _, -)), "|")))$"): \\" \ + " QT_DISABLED_FEATURES += $$lower($$replace(ft, _, -))" + } +} +write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error("Aborting.") +# Create forwarding header +FWD_FEATURES_H = \ + '$${LITERAL_HASH}include "../../src/corelib/global/qfeatures.h"' +write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.") + +no_features = +lines = $$cat($$absolute_path($$QT_QCONFIG_PATH, $$PWD/src/corelib/global), lines) +for (line, lines) { + # We ignore all defines that don't follow the #ifndef + indent pattern. + # This makes it possible to have unchecked defines which are no features. + t = $$replace(line, "^$${LITERAL_HASH} define QT_NO_(\\S+)\\s*$", "\\1") + !isEqual(t, $$line) { + isEmpty(features.$${t}.name): \ + error("$$QT_QCONFIG_PATH disables unknown feature $$t") + no_features += $$t + } +} +for (def, QT_NO_DEFINES) { + !isEmpty(features.$${def}.name): \ + no_features += $$def +} +no_features = $$unique(no_features) + +# Can't simply add these to QT_CONFIG, as e.g., contains(QT_CONFIG, accessibility) matches no-accessibililty. +FEATURES_PRI = \ + "$${LITERAL_HASH} Features disabled by configure:" \ + "QT_DISABLED_FEATURES =$$lower($$join($$list($$replace(no_features, _, -)), " ", " "))" \ + "$$escape_expand(\\n)$${LITERAL_HASH} Dependencies derived from <qtbase>/src/corelib/global/qfeatures.txt:" \ + $$FEATURES_PRI \ + "QT_DISABLED_FEATURES = \$\$unique(QT_DISABLED_FEATURES)" +write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.") + #mkspecs mkspecs.path = $$[QT_HOST_DATA]/mkspecs mkspecs.files = \ - $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri \ + $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qfeatures.pri \ $$files($$PWD/mkspecs/*) mkspecs.files -= $$PWD/mkspecs/modules INSTALLS += mkspecs diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp index abc6d7d3b9..ee8d4800ae 100644 --- a/src/3rdparty/angle/src/libEGL/Surface.cpp +++ b/src/3rdparty/angle/src/libEGL/Surface.cpp @@ -20,6 +20,8 @@ #include "libEGL/main.h" #include "libEGL/Display.h" +#include <algorithm> + #if defined(ANGLE_OS_WINRT) #include <windows.foundation.h> #include <windows.ui.core.h> diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h index 113b126a77..72d354dd64 100644 --- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h +++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h @@ -589,7 +589,7 @@ const unsigned long long noEventId = 0; class TraceID { public: explicit TraceID(const void* id, unsigned char* flags) : - m_data(static_cast<unsigned long long>(reinterpret_cast<unsigned long>(id))) + m_data(reinterpret_cast<unsigned long long>(id)) { *flags |= TRACE_EVENT_FLAG_MANGLE_ID; } diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c index 0432f1ab18..7bd442ef69 100755 --- a/src/3rdparty/sha3/KeccakF-1600-opt64.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c @@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/ typedef unsigned char UINT8; typedef unsigned long long int UINT64; +#if defined(UseSSE) || defined(UseXOP) #if defined(__GNUC__) #define ALIGN __attribute__ ((aligned(32))) #elif defined(_MSC_VER) #define ALIGN __declspec(align(32)) -#else -#define ALIGN +#endif +#endif + +#ifndef ALIGN +# define ALIGN #endif #if defined(UseSSE) diff --git a/src/3rdparty/sha3/KeccakSponge.h b/src/3rdparty/sha3/KeccakSponge.h index a545cacb30..8bb11a8a1d 100755 --- a/src/3rdparty/sha3/KeccakSponge.h +++ b/src/3rdparty/sha3/KeccakSponge.h @@ -19,12 +19,16 @@ http://creativecommons.org/publicdomain/zero/1.0/ #define KeccakMaximumRate 1536 #define KeccakMaximumRateInBytes (KeccakMaximumRate/8) +#if defined(UseSSE) || defined(UseXOP) #if defined(__GNUC__) #define ALIGN __attribute__ ((aligned(32))) #elif defined(_MSC_VER) #define ALIGN __declspec(align(32)) -#else -#define ALIGN +#endif +#endif + +#ifndef ALIGN +# define ALIGN #endif ALIGN typedef struct spongeStateStruct { diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h index 44b0a8d1ae..0180ec8b58 100644 --- a/src/3rdparty/xcb/include/xcb/xkb.h +++ b/src/3rdparty/xcb/include/xcb/xkb.h @@ -114,8 +114,8 @@ typedef enum xcb_xkb_control_t { XCB_XKB_CONTROL_GROUPS_WRAP = 134217728, XCB_XKB_CONTROL_INTERNAL_MODS = 268435456, XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912, - XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824, - XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648 + XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824u, + XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u } xcb_xkb_control_t; typedef enum xcb_xkb_axfb_opt_t { diff --git a/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch b/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch new file mode 100644 index 0000000000..240c20d2ac --- /dev/null +++ b/src/3rdparty/xcb/libxcb/fix_compiler_warning_on_32bit_systems.patch @@ -0,0 +1,15 @@ +diff --git a/src/3rdparty/xcb/include/xcb/xkb.h b/src/3rdparty/xcb/include/xcb/xkb.h +index 44b0a8d..0180ec8 100644 +--- a/src/3rdparty/xcb/include/xcb/xkb.h ++++ b/src/3rdparty/xcb/include/xcb/xkb.h +@@ -114,8 +114,8 @@ typedef enum xcb_xkb_control_t { + XCB_XKB_CONTROL_GROUPS_WRAP = 134217728, + XCB_XKB_CONTROL_INTERNAL_MODS = 268435456, + XCB_XKB_CONTROL_IGNORE_LOCK_MODS = 536870912, +- XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824, +- XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648 ++ XCB_XKB_CONTROL_PER_KEY_REPEAT = 1073741824u, ++ XCB_XKB_CONTROL_CONTROLS_ENABLED = 2147483648u + } xcb_xkb_control_t; + + typedef enum xcb_xkb_axfb_opt_t { diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri index 19501d7b29..5906231c73 100644 --- a/src/android/jar/jar.pri +++ b/src/android/jar/jar.pri @@ -9,6 +9,7 @@ JAVASOURCES += \ $$PATHPREFIX/QtEditText.java \ $$PATHPREFIX/QtInputConnection.java \ $$PATHPREFIX/QtLayout.java \ + $$PATHPREFIX/QtMessageDialogHelper.java \ $$PATHPREFIX/QtNative.java \ $$PATHPREFIX/QtNativeLibrariesDir.java \ $$PATHPREFIX/QtSurface.java diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 11af4d4280..3dcffeb07d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -42,13 +42,6 @@ package org.qtproject.qt5.android; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Iterator; - import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; @@ -57,6 +50,8 @@ import android.content.res.Configuration; import android.graphics.Rect; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.ResultReceiver; import android.text.method.MetaKeyKeyListener; import android.util.DisplayMetrics; import android.util.Log; @@ -66,11 +61,19 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; +import android.view.Surface; import android.view.View; +import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; -import android.view.Surface; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Iterator; public class QtActivityDelegate { @@ -109,8 +112,9 @@ public class QtActivityDelegate private boolean m_quitApp = true; private Process m_debuggerProcess = null; // debugger process - public boolean m_keyboardIsVisible = false; - public boolean m_keyboardIsHiding = false; + private boolean m_keyboardIsVisible = false; + public boolean m_backKeyPressedSent = false; + public QtLayout getQtLayout() { @@ -173,6 +177,13 @@ public class QtActivityDelegate private final int ApplicationInactive = 0x2; private final int ApplicationActive = 0x4; + public void setKeyboardVisibility(boolean visibility) + { + if (m_keyboardIsVisible == visibility) + return; + m_keyboardIsVisible = visibility; + QtNative.keyboardVisibilityChanged(m_keyboardIsVisible); + } public void resetSoftwareKeyboard() { if (m_imm == null) @@ -181,6 +192,7 @@ public class QtActivityDelegate @Override public void run() { m_imm.restartInput(m_editText); + m_editText.m_optionsChanged = false; } }, 5); } @@ -253,15 +265,25 @@ public class QtActivityDelegate m_editText.postDelayed(new Runnable() { @Override public void run() { - m_imm.showSoftInput(m_editText, 0); - m_keyboardIsVisible = true; - m_keyboardIsHiding = false; - m_editText.postDelayed(new Runnable() { + m_imm.showSoftInput(m_editText, 0, new ResultReceiver(new Handler()) { @Override - public void run() { - m_imm.restartInput(m_editText); + protected void onReceiveResult(int resultCode, Bundle resultData) { + switch (resultCode) { + case InputMethodManager.RESULT_SHOWN: + case InputMethodManager.RESULT_UNCHANGED_SHOWN: + setKeyboardVisibility(true); + break; + case InputMethodManager.RESULT_HIDDEN: + case InputMethodManager.RESULT_UNCHANGED_HIDDEN: + setKeyboardVisibility(false); + break; + } } - }, 25); + }); + if (m_editText.m_optionsChanged) { + m_imm.restartInput(m_editText); + m_editText.m_optionsChanged = false; + } } }, 15); } @@ -270,9 +292,21 @@ public class QtActivityDelegate { if (m_imm == null) return; - m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0); - m_keyboardIsVisible = false; - m_keyboardIsHiding = false; + m_imm.hideSoftInputFromWindow(m_editText.getWindowToken(), 0, new ResultReceiver( new Handler()){ + @Override + protected void onReceiveResult(int resultCode, Bundle resultData) { + switch (resultCode) { + case InputMethodManager.RESULT_SHOWN: + case InputMethodManager.RESULT_UNCHANGED_SHOWN: + setKeyboardVisibility(true); + break; + case InputMethodManager.RESULT_HIDDEN: + case InputMethodManager.RESULT_UNCHANGED_HIDDEN: + setKeyboardVisibility(false); + break; + } + } + }); } public boolean isSoftwareKeyboardVisible() @@ -362,7 +396,7 @@ public class QtActivityDelegate + "\tNECESSITAS_API_LEVEL=" + necessitasApiLevel + "\tHOME=" + m_activity.getFilesDir().getAbsolutePath() + "\tTMPDIR=" + m_activity.getFilesDir().getAbsolutePath(); - if (android.os.Build.VERSION.SDK_INT < 14) + if (Build.VERSION.SDK_INT < 14) additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Droid Sans;Droid Sans Fallback"; else additionalEnvironmentVariables += "\tQT_ANDROID_FONTS=Roboto;Droid Sans;Droid Sans Fallback"; @@ -378,6 +412,7 @@ public class QtActivityDelegate m_applicationParameters = loaderParams.getString(APPLICATION_PARAMETERS_KEY); else m_applicationParameters = ""; + setActionBarVisibility(false); return true; } @@ -585,9 +620,9 @@ public class QtActivityDelegate } m_layout = new QtLayout(m_activity); m_surface = new QtSurface(m_activity, 0); - m_editText = new QtEditText(m_activity); + m_editText = new QtEditText(m_activity, this); m_imm = (InputMethodManager)m_activity.getSystemService(Context.INPUT_METHOD_SERVICE); - m_layout.addView(m_surface,0); + m_layout.addView(m_surface, 0); m_activity.setContentView(m_layout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); @@ -717,8 +752,12 @@ public class QtActivityDelegate } m_lastChar = lc; - if (keyCode != KeyEvent.KEYCODE_BACK) - QtNative.keyDown(keyCode, c, event.getMetaState()); + if (keyCode == KeyEvent.KEYCODE_BACK) { + m_backKeyPressedSent = !m_keyboardIsVisible; + if (!m_backKeyPressedSent) + return true; + } + QtNative.keyDown(keyCode, c, event.getMetaState()); return true; } @@ -737,8 +776,9 @@ public class QtActivityDelegate } } - if (keyCode == KeyEvent.KEYCODE_BACK && m_keyboardIsVisible && !m_keyboardIsHiding) { + if (keyCode == KeyEvent.KEYCODE_BACK && !m_backKeyPressedSent) { hideSoftwareKeyboard(); + setKeyboardVisibility(false); return true; } @@ -775,7 +815,10 @@ public class QtActivityDelegate public boolean onPrepareOptionsMenu(Menu menu) { m_opionsMenuIsVisible = true; - return QtNative.onPrepareOptionsMenu(menu); + boolean res = QtNative.onPrepareOptionsMenu(menu); + if (!res || menu.size() == 0) + setActionBarVisibility(false); + return res; } public boolean onOptionsItemSelected(MenuItem item) @@ -791,8 +834,17 @@ public class QtActivityDelegate public void resetOptionsMenu() { - if (m_opionsMenuIsVisible) - m_activity.closeOptionsMenu(); + setActionBarVisibility(true); + if (Build.VERSION.SDK_INT > 10) { + try { + Activity.class.getMethod("invalidateOptionsMenu").invoke(m_activity); + } catch (Exception e) { + e.printStackTrace(); + } + } + else + if (m_opionsMenuIsVisible) + m_activity.closeOptionsMenu(); } private boolean m_contextMenuVisible = false; public void onCreateContextMenu(ContextMenu menu, @@ -833,4 +885,46 @@ public class QtActivityDelegate { m_activity.closeContextMenu(); } + + private boolean hasPermanentMenuKey() + { + try { + return Build.VERSION.SDK_INT < 11 || (Build.VERSION.SDK_INT >= 14 && + (Boolean)ViewConfiguration.class.getMethod("hasPermanentMenuKey").invoke(ViewConfiguration.get(m_activity))); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + private Object getActionBar() + { + try { + return Activity.class.getMethod("getActionBar").invoke(m_activity); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + private void setActionBarVisibility(boolean visible) + { + if (hasPermanentMenuKey() || !visible) { + if (Build.VERSION.SDK_INT > 10 && getActionBar() != null) { + try { + Class.forName("android.app.ActionBar").getMethod("hide").invoke(getActionBar()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } else { + if (Build.VERSION.SDK_INT > 10 && getActionBar() != null) + try { + Class.forName("android.app.ActionBar").getMethod("show").invoke(getActionBar()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java index b95e0c070c..593746aac9 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java @@ -50,33 +50,47 @@ import android.view.inputmethod.InputConnection; public class QtEditText extends View { - QtInputConnection m_inputConnection; int m_initialCapsMode = 0; int m_imeOptions = 0; int m_inputType = InputType.TYPE_CLASS_TEXT; + boolean m_optionsChanged = false; + QtActivityDelegate m_activityDelegate; public void setImeOptions(int m_imeOptions) { + if (m_imeOptions == this.m_imeOptions) + return; this.m_imeOptions = m_imeOptions; + m_optionsChanged = true; } public void setInitialCapsMode(int m_initialCapsMode) { + if (m_initialCapsMode == this.m_initialCapsMode) + return; this.m_initialCapsMode = m_initialCapsMode; + m_optionsChanged = true; } public void setInputType(int m_inputType) { + if (m_inputType == this.m_inputType) + return; this.m_inputType = m_inputType; + m_optionsChanged = true; } - public QtEditText(Context context) + public QtEditText(Context context, QtActivityDelegate activityDelegate) { super(context); setFocusable(true); setFocusableInTouchMode(true); - m_inputConnection = new QtInputConnection(this); + m_activityDelegate = activityDelegate; + } + public QtActivityDelegate getActivityDelegate() + { + return m_activityDelegate; } @Override @@ -86,8 +100,9 @@ public class QtEditText extends View outAttrs.imeOptions = m_imeOptions; outAttrs.initialCapsMode = m_initialCapsMode; outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI; - return m_inputConnection; + return new QtInputConnection(this); } + // // DEBUG CODE // @Override // protected void onDraw(Canvas canvas) { diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java index f251369737..4b2d50ca1f 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtInputConnection.java @@ -43,8 +43,6 @@ package org.qtproject.qt5.android; import android.content.Context; -import android.os.Build; -import android.view.View; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.ExtractedText; @@ -82,6 +80,22 @@ class QtNativeInputConnection static native boolean paste(); } +class HideKeyboardRunnable implements Runnable { + private QtInputConnection m_connection; + HideKeyboardRunnable(QtInputConnection connection) + { + m_connection = connection; + } + + @Override + public void run() { + if (m_connection.getInputState() == QtInputConnection.InputStates.Hiding) { + QtNative.activityDelegate().setKeyboardVisibility(false); + m_connection.reset(); + } + } +} + public class QtInputConnection extends BaseInputConnection { private static final int ID_SELECT_ALL = android.R.id.selectAll; @@ -92,67 +106,83 @@ public class QtInputConnection extends BaseInputConnection private static final int ID_SWITCH_INPUT_METHOD = android.R.id.switchInputMethod; private static final int ID_ADD_TO_DICTIONARY = android.R.id.addToDictionary; - View m_view; - boolean m_closing; - public QtInputConnection(View targetView) + + enum InputStates { Visible, FinishComposing, Hiding }; + + private QtEditText m_view = null; + private InputStates m_inputState = InputStates.Visible; + + public void reset() + { + m_inputState = InputStates.Visible; + } + + public InputStates getInputState() + { + return m_inputState; + } + + private void setClosing(boolean closing) + { + if (closing && m_inputState == InputStates.Hiding) + return; + + if (closing && m_inputState == InputStates.FinishComposing && m_view.getActivityDelegate().isSoftwareKeyboardVisible()) { + m_view.postDelayed(new HideKeyboardRunnable(this), 100); + m_inputState = InputStates.Hiding; + } else { + if (m_inputState == InputStates.Hiding) + QtNative.activityDelegate().setKeyboardVisibility(true); + m_inputState = closing ? InputStates.FinishComposing : InputStates.Visible; + } + } + + public QtInputConnection(QtEditText targetView) { super(targetView, true); m_view = targetView; - m_closing = false; } @Override public boolean beginBatchEdit() { - m_closing = false; + setClosing(false); return true; } @Override public boolean endBatchEdit() { - m_closing = false; +// setClosing(false); return true; } @Override public boolean commitCompletion(CompletionInfo text) { - m_closing = false; + setClosing(false); return QtNativeInputConnection.commitCompletion(text.getText().toString(), text.getPosition()); } @Override public boolean commitText(CharSequence text, int newCursorPosition) { - m_closing = false; + setClosing(false); return QtNativeInputConnection.commitText(text.toString(), newCursorPosition); } @Override public boolean deleteSurroundingText(int leftLength, int rightLength) { - m_closing = false; + setClosing(false); return QtNativeInputConnection.deleteSurroundingText(leftLength, rightLength); } @Override public boolean finishComposingText() { - if (m_closing) { - QtNative.activityDelegate().m_keyboardIsHiding = true; - m_view.postDelayed(new Runnable() { - @Override - public void run() { - if (QtNative.activityDelegate().m_keyboardIsHiding) - QtNative.activityDelegate().m_keyboardIsVisible=false; - } - }, 5000); // it seems finishComposingText comes musch faster than onKeyUp event, - // so we must delay hide notification - m_closing = false; - } else { - m_closing = true; - } + // on some/all android devices hide event is not coming, but instead finishComposingText() is called twice + setClosing(true); return QtNativeInputConnection.finishComposingText(); } @@ -234,18 +264,21 @@ public class QtInputConnection extends BaseInputConnection @Override public boolean setComposingText(CharSequence text, int newCursorPosition) { + setClosing(false); return QtNativeInputConnection.setComposingText(text.toString(), newCursorPosition); } @Override public boolean setComposingRegion(int start, int end) { + setClosing(false); return QtNativeInputConnection.setComposingRegion(start, end); } @Override public boolean setSelection(int start, int end) { + setClosing(false); return QtNativeInputConnection.setSelection(start, end); } } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java new file mode 100644 index 0000000000..6ee1304c12 --- /dev/null +++ b/src/android/jar/src/org/qtproject/qt5/android/QtMessageDialogHelper.java @@ -0,0 +1,425 @@ +/**************************************************************************** + ** + ** Copyright (C) 2013 BogDan Vatra <bogdan@kde.org> + ** Contact: http://www.qt-project.org/legal + ** + ** This file is part of the Android port of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and Digia. For licensing terms and + ** conditions see http://qt.digia.com/licensing. For further information + ** use the contact form at http://qt.digia.com/contact-us. + ** + ** 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, Digia gives you certain additional + ** rights. These rights are described in the Digia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU + ** General Public License version 3.0 as published by the Free Software + ** Foundation and appearing in the file LICENSE.GPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU General Public License version 3.0 requirements will be + ** met: http://www.gnu.org/copyleft/gpl.html. + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + + +package org.qtproject.qt5.android; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.text.ClipboardManager; +import android.util.TypedValue; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.ScrollView; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; + +class QtNativeDialogHelper +{ + static native void dialogResult(long handler, int buttonID); +} + +class ButtonStruct implements View.OnClickListener +{ + ButtonStruct(QtMessageDialogHelper dialog, int id, String text) + { + m_dialog = dialog; + m_id = id; + m_text = text; + } + QtMessageDialogHelper m_dialog; + private int m_id; + String m_text; + + @Override + public void onClick(View view) { + QtNativeDialogHelper.dialogResult(m_dialog.handler(), m_id); + } +} + +public class QtMessageDialogHelper +{ + + public QtMessageDialogHelper(Activity activity) + { + m_activity = activity; + } + + + public void setIcon(int icon) + { + m_icon = icon; + + } + + private Drawable getIconDrawable() + { + if (m_icon == 0) + return null; + + if (Build.VERSION.SDK_INT > 10) { + try { + TypedValue typedValue = new TypedValue(); + m_theme.resolveAttribute(Class.forName("android.R$attr").getDeclaredField("alertDialogIcon").getInt(null), typedValue, true); + return m_activity.getResources().getDrawable(typedValue.resourceId); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // Information, Warning, Critical, Question + switch (m_icon) + { + case 1: // Information + try { + return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_info").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + break; + case 2: // Warning +// try { +// return Class.forName("android.R$drawable").getDeclaredField("stat_sys_warning").getInt(null); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// break; + case 3: // Critical + try { + return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_dialog_alert").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + break; + case 4: // Question + try { + return m_activity.getResources().getDrawable(Class.forName("android.R$drawable").getDeclaredField("ic_menu_help").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + break; + } + return null; + } + + public void setTile(String title) + { + m_title = title; + } + + public void setText(String text) + { + m_text = text; + } + + public void setInformativeText(String informativeText) + { + m_informativeText = informativeText; + } + + public void setDetailedText(String text) + { + m_detailedText = text; + } + + public void addButton(int id, String text) + { + if (m_buttonsList == null) + m_buttonsList = new ArrayList<ButtonStruct>(); + m_buttonsList.add(new ButtonStruct(this, id, text)); + } + + private void setTextAppearance(TextView view, String attr, String style) + { + try { + int[] attrs = (int[]) Class.forName("android.R$styleable").getDeclaredField("TextAppearance").get(null); + final TypedArray a = m_theme.obtainStyledAttributes(null, + attrs, + Class.forName("android.R$attr").getDeclaredField(attr).getInt(null), + Class.forName("android.R$style").getDeclaredField(style).getInt(null)); + final int textSize = a.getDimensionPixelSize( + Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textSize").getInt(null), 0); + if (textSize != 0) + view.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); + + final int textColor = a.getColor( + Class.forName("android.R$styleable").getDeclaredField("TextAppearance_textColor").getInt(null), 0x3138); + if (textColor != 0x3138) + view.setTextColor(textColor); + + a.recycle(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private Drawable getStyledDrawable(String drawable) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException + { + int[] attrs = {Class.forName("android.R$attr").getDeclaredField(drawable).getInt(null)}; + final TypedArray a = m_theme.obtainStyledAttributes(attrs); + Drawable d = a.getDrawable(0); + a.recycle(); + return d; + } + + + public void show(long handler) + { + m_handler = handler; + m_activity.runOnUiThread( new Runnable() { + @Override + public void run() { + if (m_dialog != null && m_dialog.isShowing()) + m_dialog.dismiss(); + + m_dialog = new AlertDialog.Builder(m_activity).create(); + m_theme = m_dialog.getWindow().getContext().getTheme(); + + if (m_title != null) + m_dialog.setTitle(m_title); + m_dialog.setOnCancelListener( new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialogInterface) { + QtNativeDialogHelper.dialogResult(handler(), -1); + } + }); + m_dialog.setCancelable(m_buttonsList == null); + m_dialog.setCanceledOnTouchOutside(m_buttonsList == null); + m_dialog.setIcon(getIconDrawable()); + ScrollView scrollView = new ScrollView(m_activity); + RelativeLayout dialogLayout = new RelativeLayout(m_activity); + int id = 1; + View lastView = null; + View.OnLongClickListener copyText = new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + TextView tv = (TextView)view; + if (tv != null) { + ClipboardManager cm = (android.text.ClipboardManager) m_activity.getSystemService(Context.CLIPBOARD_SERVICE); + cm.setText(tv.getText()); + } + return true; + } + }; + if (m_text != null) + { + TextView view = new TextView(m_activity); + view.setId(id++); + view.setOnLongClickListener(copyText); + view.setLongClickable(true); + + view.setText(m_text); + setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium"); + + RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layout.setMargins(16, 8, 16, 8); + layout.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(view, layout); + lastView = view; + } + + if (m_informativeText != null) + { + TextView view= new TextView(m_activity); + view.setId(id++); + view.setOnLongClickListener(copyText); + view.setLongClickable(true); + + view.setText(m_informativeText); + setTextAppearance(view, "textAppearanceMedium", "TextAppearance_Medium"); + + RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layout.setMargins(16, 8, 16, 8); + if (lastView != null) + layout.addRule(RelativeLayout.BELOW, lastView.getId()); + else + layout.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(view, layout); + lastView = view; + } + + if (m_detailedText != null) + { + TextView view= new TextView(m_activity); + view.setId(id++); + view.setOnLongClickListener(copyText); + view.setLongClickable(true); + + view.setText(m_detailedText); + setTextAppearance(view, "textAppearanceSmall", "TextAppearance_Small"); + + RelativeLayout.LayoutParams layout = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layout.setMargins(16, 8, 16, 8); + if (lastView != null) + layout.addRule(RelativeLayout.BELOW, lastView.getId()); + else + layout.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(view, layout); + lastView = view; + } + + if (m_buttonsList != null) + { + LinearLayout buttonsLayout = new LinearLayout(m_activity); + buttonsLayout.setOrientation(LinearLayout.HORIZONTAL); + buttonsLayout.setId(id++); + boolean firstButton = true; + for (ButtonStruct button: m_buttonsList) + { + Button bv; + if (Build.VERSION.SDK_INT > 10) { + try { + bv = new Button(m_activity, null, Class.forName("android.R$attr").getDeclaredField("borderlessButtonStyle").getInt(null)); + } catch (Exception e) { + bv = new Button(m_activity); + e.printStackTrace(); + } + } else { + bv = new Button(m_activity); + } + + bv.setText(button.m_text); + bv.setOnClickListener(button); + if (!firstButton) // first button + { + LinearLayout.LayoutParams layout = null; + View spacer = new View(m_activity); + if (Build.VERSION.SDK_INT > 10) { + try { + layout = new LinearLayout.LayoutParams(1, RelativeLayout.LayoutParams.MATCH_PARENT); + spacer.setBackgroundDrawable(getStyledDrawable("dividerVertical")); + buttonsLayout.addView(spacer, layout); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + LinearLayout.LayoutParams layout = null; + layout = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT, 1.0f); + buttonsLayout.addView(bv, layout); + firstButton = false; + } + + if (Build.VERSION.SDK_INT > 10) { + try { + View horizontalDevider = new View(m_activity); + horizontalDevider.setId(id++); + horizontalDevider.setBackgroundDrawable(getStyledDrawable("dividerHorizontal")); + RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 1); + relativeParams.setMargins(0, 10, 0, 0); + if (lastView != null) { + relativeParams.addRule(RelativeLayout.BELOW, lastView.getId()); + } + else + relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); + dialogLayout.addView(horizontalDevider, relativeParams); + lastView = horizontalDevider; + } catch (Exception e) { + e.printStackTrace(); + } + } + RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + if (lastView != null) { + relativeParams.addRule(RelativeLayout.BELOW, lastView.getId()); + } + else + relativeParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); + if (Build.VERSION.SDK_INT < 11) + relativeParams.setMargins(2, 12, 2, 4); + else + relativeParams.setMargins(2, 0, 2, 0); + dialogLayout.addView(buttonsLayout, relativeParams); + } + scrollView.addView(dialogLayout); + m_dialog.setView(scrollView); + m_dialog.show(); + } + }); + } + + public void hide() + { + m_activity.runOnUiThread( new Runnable() { + @Override + public void run() { + if (m_dialog != null && m_dialog.isShowing()) + m_dialog.dismiss(); + reset(); + } + }); + } + + public long handler() + { + return m_handler; + } + + public void reset() + { + m_icon = 0; + m_title = null; + m_text = null; + m_informativeText = null; + m_detailedText = null; + m_buttonsList = null; + m_dialog = null; + m_handler = 0; + } + + private Activity m_activity; + private int m_icon = 0; + private String m_title, m_text, m_informativeText, m_detailedText; + private ArrayList<ButtonStruct> m_buttonsList; + private AlertDialog m_dialog; + private long m_handler = 0; + private Resources.Theme m_theme; +} diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 1385c90e3e..57f3642b56 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -50,7 +50,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.Build; import android.text.ClipboardManager; import android.util.Log; import android.view.ContextMenu; @@ -110,9 +109,13 @@ public class QtNative public static void openURL(String url) { - Uri uri = Uri.parse(url); - Intent intent = new Intent(Intent.ACTION_VIEW, uri); - activity().startActivity(intent); + try { + Uri uri = Uri.parse(url); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + activity().startActivity(intent); + } catch (Exception e) { + e.printStackTrace(); + } } // this method loads full path libs @@ -419,30 +422,21 @@ public class QtNative private static boolean isSoftwareKeyboardVisible() { - Semaphore semaphore = new Semaphore(1); - Boolean ret = false; - class RunnableRes implements Runnable { - @SuppressWarnings("unused") - Boolean returnValue = null; - Semaphore semaphore = null; - RunnableRes(Boolean ret, Semaphore sem) { - semaphore = sem; - returnValue = ret; - } + final Semaphore semaphore = new Semaphore(0); + final Boolean[] ret = {false}; + runAction(new Runnable() { @Override public void run() { - returnValue = m_activityDelegate.isSoftwareKeyboardVisible(); + ret[0] = m_activityDelegate.isSoftwareKeyboardVisible(); semaphore.release(); } - } - - runAction(new RunnableRes(ret, semaphore)); + }); try { semaphore.acquire(); } catch (Exception e) { e.printStackTrace(); } - return ret; + return ret[0]; } private static void setFullScreen(final boolean fullScreen) @@ -458,7 +452,7 @@ public class QtNative private static void registerClipboardManager() { - final Semaphore semaphore = new Semaphore(1); + final Semaphore semaphore = new Semaphore(0); runAction(new Runnable() { @Override public void run() { @@ -569,6 +563,7 @@ public class QtNative // keyboard methods public static native void keyDown(int key, int unicode, int modifier); public static native void keyUp(int key, int unicode, int modifier); + public static native void keyboardVisibilityChanged(boolean visibility); // keyboard methods // surface methods diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index cd0bddf2c8..c499dc3898 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -117,21 +117,23 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback // Initialize Accessibility // The accessibility code depends on android API level 16, so dynamically resolve it - try { - final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate"; - Class<?> qtDelegateClass = Class.forName(a11yDelegateClassName); - Constructor constructor = qtDelegateClass.getConstructor(Class.forName("android.view.View")); - m_accessibilityDelegate = constructor.newInstance(this); - - Class a11yDelegateClass = Class.forName("android.view.View$AccessibilityDelegate"); - Method setDelegateMethod = this.getClass().getMethod("setAccessibilityDelegate", a11yDelegateClass); - setDelegateMethod.invoke(this, m_accessibilityDelegate); - } catch (ClassNotFoundException e) { - // Class not found is fine since we are compatible with Android API < 16, but the function will - // only be available with that API level. - } catch (Exception e) { - // Unknown exception means something went wrong. - Log.w("Qt A11y", "Unknown exception: " + e.toString()); + if (android.os.Build.VERSION.SDK_INT >= 16) { + try { + final String a11yDelegateClassName = "org.qtproject.qt5.android.accessibility.QtAccessibilityDelegate"; + Class<?> qtDelegateClass = Class.forName(a11yDelegateClassName); + Constructor constructor = qtDelegateClass.getConstructor(Class.forName("android.view.View")); + m_accessibilityDelegate = constructor.newInstance(this); + + Class a11yDelegateClass = Class.forName("android.view.View$AccessibilityDelegate"); + Method setDelegateMethod = this.getClass().getMethod("setAccessibilityDelegate", a11yDelegateClass); + setDelegateMethod.invoke(this, m_accessibilityDelegate); + } catch (ClassNotFoundException e) { + // Class not found is fine since we are compatible with Android API < 16, but the function will + // only be available with that API level. + } catch (Exception e) { + // Unknown exception means something went wrong. + Log.w("Qt A11y", "Unknown exception: " + e.toString()); + } } } diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index 6463793e0b..cfad4553ee 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='utf-8'?> -<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1"> +<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> <application android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> - <activity android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden|navigation|screenSize" + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" android:screenOrientation="unspecified"> @@ -34,8 +34,10 @@ <!-- Splash screen --> </activity> </application> - <!-- %%INSERT_USES_SDK%% --> + <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/> <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> + <!-- %%INSERT_PERMISSIONS --> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <!-- %%INSERT_FEATURES --> </manifest> diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index 9c7b57a4f5..7c741edfda 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -56,6 +56,7 @@ import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; @@ -79,6 +80,7 @@ import android.view.ActionMode; import android.view.ActionMode.Callback; //@ANDROID-11 + public class QtActivity extends Activity { private final static int MINISTRO_INSTALL_REQUEST_CODE = 0xf3ee; // request code used to know when Ministro instalation is finished @@ -113,28 +115,37 @@ public class QtActivity extends Activity // for more details. private static final String REPOSITORY_KEY = "repository"; // use this key to overwrite the default ministro repsitory + private static final String ANDROID_THEMES_KEY = "android.themes"; // themes that your application uses + - private static final String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application, + public String APPLICATION_PARAMETERS = null; // use this variable to pass any parameters to your application, // the parameters must not contain any white spaces // and must be separated with "\t" // e.g "-param1\t-param2=value2\t-param3\tvalue3" - private String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\t"; + public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_STYLE=1\tQT_USE_ANDROID_NATIVE_DIALOGS=1\t"; // use this variable to add any environment variables to your application. // the env vars must be separated with "\t" // e.g. "ENV_VAR1=1\tENV_VAR2=2\t" // Currently the following vars are used by the android plugin: - // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available, - // note that the android style plugin in Qt 5.1 is not fully functional. - - private static final String QT_ANDROID_THEME = "light"; // sets the default theme to light. Possible values are: - // * "" - for the device default dark theme - // * "light" - for the device default light theme - // * "holo" - for the holo dark theme - // * "holo_light" - for the holo light theme + // * QT_USE_ANDROID_NATIVE_STYLE - 1 to use the android widget style if available. + // * QT_USE_ANDROID_NATIVE_DIALOGS -1 to use the android native dialogs. + + public String[] QT_ANDROID_THEMES = null; // A list with all themes that your application want to use. + // The name of the theme must be the same with any theme from + // http://developer.android.com/reference/android/R.style.html + // The most used themes are: + // * "Theme" - (fallback) check http://developer.android.com/reference/android/R.style.html#Theme + // * "Theme_Black" - check http://developer.android.com/reference/android/R.style.html#Theme_Black + // * "Theme_Light" - (default for API <=10) check http://developer.android.com/reference/android/R.style.html#Theme_Light + // * "Theme_Holo" - check http://developer.android.com/reference/android/R.style.html#Theme_Holo + // * "Theme_Holo_Light" - (default for API 11-13) check http://developer.android.com/reference/android/R.style.html#Theme_Holo_Light + // * "Theme_DeviceDefault" - check http://developer.android.com/reference/android/R.style.html#Theme_DeviceDefault + // * "Theme_DeviceDefault_Light" - (default for API 14+) check http://developer.android.com/reference/android/R.style.html#Theme_DeviceDefault_Light + + public String QT_ANDROID_DEFAULT_THEME = null; // sets the default theme. private static final int INCOMPATIBLE_MINISTRO_VERSION = 1; // Incompatible Ministro version. Ministro needs to be upgraded. - private static final String DISPLAY_DPI_KEY = "display.dpi"; private static final int BUFFER_SIZE = 1024; private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings @@ -153,6 +164,21 @@ public class QtActivity extends Activity // this repository is used to push Qt snapshots. private String[] m_qtLibs = null; // required qt libs + public QtActivity() + { + if (Build.VERSION.SDK_INT <= 10) { + QT_ANDROID_THEMES = new String[] {"Theme_Light"}; + QT_ANDROID_DEFAULT_THEME = "Theme_Light"; + } + else if (Build.VERSION.SDK_INT >= 11 && Build.VERSION.SDK_INT <= 13) { + QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"}; + QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light"; + } else { + QT_ANDROID_THEMES = new String[] {"Theme_DeviceDefault_Light"}; + QT_ANDROID_DEFAULT_THEME = "Theme_DeviceDefault_Light"; + } + } + // this function is used to load and start the loader private void loadApplication(Bundle loaderParams) { @@ -237,23 +263,24 @@ public class QtActivity extends Activity private ServiceConnection m_ministroConnection=new ServiceConnection() { private IMinistro m_service = null; - @Override + @Override public void onServiceConnected(ComponentName name, IBinder service) { m_service = IMinistro.Stub.asInterface(service); try { - if (m_service!=null) { - Bundle parameters= new Bundle(); + if (m_service != null) { + Bundle parameters = new Bundle(); parameters.putStringArray(REQUIRED_MODULES_KEY, m_qtLibs); parameters.putString(APPLICATION_TITLE_KEY, (String)QtActivity.this.getTitle()); parameters.putInt(MINIMUM_MINISTRO_API_KEY, MINISTRO_API_LEVEL); parameters.putInt(MINIMUM_QT_VERSION_KEY, QT_VERSION); parameters.putString(ENVIRONMENT_VARIABLES_KEY, ENVIRONMENT_VARIABLES); - if (null!=APPLICATION_PARAMETERS) + if (APPLICATION_PARAMETERS != null) parameters.putString(APPLICATION_PARAMETERS_KEY, APPLICATION_PARAMETERS); parameters.putStringArray(SOURCES_KEY, m_sources); parameters.putString(REPOSITORY_KEY, m_repository); - parameters.putInt(DISPLAY_DPI_KEY, QtActivity.this.getResources().getDisplayMetrics().densityDpi); + if (QT_ANDROID_THEMES != null) + parameters.putStringArray(ANDROID_THEMES_KEY, QT_ANDROID_THEMES); m_service.requestLoader(m_ministroCallback, parameters); } } catch (RemoteException e) { @@ -261,19 +288,19 @@ public class QtActivity extends Activity } } - private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() { - // this function is called back by Ministro. - @Override - public void loaderReady(final Bundle loaderParams) throws RemoteException { - runOnUiThread(new Runnable() { - @Override - public void run() { - unbindService(m_ministroConnection); - loadApplication(loaderParams); - } - }); - } - }; + private IMinistroCallback m_ministroCallback = new IMinistroCallback.Stub() { + // this function is called back by Ministro. + @Override + public void loaderReady(final Bundle loaderParams) throws RemoteException { + runOnUiThread(new Runnable() { + @Override + public void run() { + unbindService(m_ministroConnection); + loadApplication(loaderParams); + } + }); + } + }; @Override public void onServiceDisconnected(ComponentName name) { @@ -683,13 +710,30 @@ public class QtActivity extends Activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + try { + setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + + if (Build.VERSION.SDK_INT > 10) { + try { + requestWindowFeature(Window.class.getField("FEATURE_ACTION_BAR").getInt(null)); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + requestWindowFeature(Window.FEATURE_NO_TITLE); + } + if (QtApplication.m_delegateObject != null && QtApplication.onCreate != null) { QtApplication.invokeDelegateMethod(QtApplication.onCreate, savedInstanceState); return; } - ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_THEME + + ENVIRONMENT_VARIABLES += "\tQT_ANDROID_THEME=" + QT_ANDROID_DEFAULT_THEME + "/\tQT_ANDROID_THEME_DISPLAY_DPI=" + getResources().getDisplayMetrics().densityDpi + "\t"; - requestWindowFeature(Window.FEATURE_NO_TITLE); + try { m_activityInfo = getPackageManager().getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); } catch (NameNotFoundException e) { diff --git a/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch new file mode 100644 index 0000000000..cf32a20d46 --- /dev/null +++ b/src/angle/patches/0001-ANGLE-Fix-compilation-with-MSVC2013.patch @@ -0,0 +1,28 @@ +From 4863cf64cd332a5fcefe453634c3c5ef62cb758c Mon Sep 17 00:00:00 2001 +From: Friedemann Kleint <Friedemann.Kleint@digia.com> +Date: Thu, 24 Oct 2013 12:49:59 +0300 +Subject: [PATCH] ANGLE: Fix compilation with MSVC2013. + +Add missing include for std::min(), std::max(). + +Change-Id: I740e5db94f9f958ac65de8dd7baab7e203482637 +--- + src/3rdparty/angle/src/libEGL/Surface.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp +index b47a7bc..83fbbf5 100644 +--- a/src/3rdparty/angle/src/libEGL/Surface.cpp ++++ b/src/3rdparty/angle/src/libEGL/Surface.cpp +@@ -20,6 +20,8 @@ + #include "libEGL/main.h" + #include "libEGL/Display.h" + ++#include <algorithm> ++ + namespace egl + { + +-- +1.8.3.msysgit.0 + diff --git a/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch b/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch new file mode 100644 index 0000000000..0420694c91 --- /dev/null +++ b/src/angle/patches/0001-Fix-compilation-with-MinGW-gcc-64-bit.patch @@ -0,0 +1,35 @@ +From 821c28d387b332bf16b6ea35ec22a77d3ba41632 Mon Sep 17 00:00:00 2001 +From: Kai Koehne <kai.koehne@digia.com> +Date: Mon, 28 Oct 2013 10:27:53 +0100 +Subject: [PATCH] Fix compilation with MinGW gcc 64 bit + +Fix compilation of ANGLE with gcc 4.8.0 64 bit: The + + reinterpret_cast<unsigned long>(void*) + +was causing + + error: cast from 'const void*' to 'long unsigned int' loses precision + +Task-number: QTBUG-34395 +Change-Id: Ibde75dd4b5536f3827bdf0ab02a15e93a1a8a4f0 +--- + src/3rdparty/angle/src/third_party/trace_event/trace_event.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h +index 113b126..72d354d 100644 +--- a/src/3rdparty/angle/src/third_party/trace_event/trace_event.h ++++ b/src/3rdparty/angle/src/third_party/trace_event/trace_event.h +@@ -589,7 +589,7 @@ const unsigned long long noEventId = 0; + class TraceID { + public: + explicit TraceID(const void* id, unsigned char* flags) : +- m_data(static_cast<unsigned long long>(reinterpret_cast<unsigned long>(id))) ++ m_data(reinterpret_cast<unsigned long long>(id)) + { + *flags |= TRACE_EVENT_FLAG_MANGLE_ID; + } +-- +1.8.3.msysgit.0 + diff --git a/src/angle/src/common/common.pri b/src/angle/src/common/common.pri index 12e26a9a68..58ad88673a 100644 --- a/src/angle/src/common/common.pri +++ b/src/angle/src/common/common.pri @@ -4,10 +4,10 @@ INCLUDEPATH += \ $$ANGLE_DIR/src \ $$ANGLE_DIR/include -LIBS = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI +LIBS_PRIVATE = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI # DirectX is included in the Windows 8 Kit, but everything else requires the DX SDK. -win32-msvc2012|winrt { +win32-msvc2012|win32-msvc2013|winrt { FXC = fxc.exe } else { DX_DIR = $$(DXSDK_DIR) @@ -36,7 +36,7 @@ win32-msvc2012|winrt { # Similarly we want the MinGW linker to use the import libraries shipped with the compiler # instead of those from the SDK which cause a crash on startup. - LIBS += -L\"$$DXLIB_DIR\" + LIBS_PRIVATE += -L\"$$DXLIB_DIR\" } } diff --git a/src/angle/src/libEGL/libEGL.pro b/src/angle/src/libEGL/libEGL.pro index 3781bd7868..b5854189f9 100644 --- a/src/angle/src/libEGL/libEGL.pro +++ b/src/angle/src/libEGL/libEGL.pro @@ -4,11 +4,11 @@ TARGET = $$qtLibraryTarget(libEGL) include(../common/common.pri) angle_d3d11 { - LIBS += -ld3d11 + LIBS_PRIVATE += -ld3d11 } else { - LIBS += -ld3d9 + LIBS_PRIVATE += -ld3d9 } -LIBS += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2) +LIBS_PRIVATE += -ldxguid -L$$QT_BUILD_TREE/lib -l$$qtLibraryTarget(libGLESv2) HEADERS += \ $$ANGLE_DIR/src/libEGL/Config.h \ diff --git a/src/angle/src/libGLESv2/libGLESv2.pro b/src/angle/src/libGLESv2/libGLESv2.pro index b39ce781e1..5b3a49ed56 100644 --- a/src/angle/src/libGLESv2/libGLESv2.pro +++ b/src/angle/src/libGLESv2/libGLESv2.pro @@ -8,18 +8,18 @@ INCLUDEPATH += $$OUT_PWD/.. $$ANGLE_DIR/src/libGLESv2 # Remember to adapt tools/configure/configureapp.cpp if the Direct X version changes. angle_d3d11 { - LIBS += -ldxgi -ld3d11 + LIBS_PRIVATE += -ldxgi -ld3d11 } else { - LIBS += -ld3d9 + LIBS_PRIVATE += -ld3d9 } -LIBS += -ldxguid +LIBS_PRIVATE += -ldxguid STATICLIBS = translator_common translator_hlsl preprocessor for(libname, STATICLIBS) { # Appends 'd' to the library for debug builds and builds up the fully # qualified path to pass to the linker. staticlib = $$QT_BUILD_TREE/lib/$${QMAKE_PREFIX_STATICLIB}$$qtLibraryTarget($$libname).$${QMAKE_EXTENSION_STATICLIB} - LIBS += $$staticlib + LIBS_PRIVATE += $$staticlib PRE_TARGETDEPS += $$staticlib } diff --git a/src/concurrent/concurrent.pro b/src/concurrent/concurrent.pro index 53b6bd0472..2b8fef2d6a 100644 --- a/src/concurrent/concurrent.pro +++ b/src/concurrent/concurrent.pro @@ -39,5 +39,5 @@ HEADERS += \ HEADERS += \ contains(QT_CONFIG, clock-gettime) { - linux-*|hpux-*|solaris-*:LIBS *= -lrt + linux-*|hpux-*|solaris-*: LIBS_PRIVATE *= -lrt } diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf index 9d89192946..e45047cb51 100644 --- a/src/concurrent/doc/qtconcurrent.qdocconf +++ b/src/concurrent/doc/qtconcurrent.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtConcurrent description = Qt Concurrent Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtconcurrent +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = qtconcurrent diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp index 7160f80b34..9afcdc9740 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp @@ -136,7 +136,7 @@ bool QString::contains(const QRegExp ®exp) const; //! [10] -boost::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace +std::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace //! [10] @@ -147,7 +147,7 @@ bool contains(const QString &string) //! [12] QStringList strings = ...; -boost::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." )); +std::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." )); //! [12] //! [13] diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp index 756ca3902c..634c03e808 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp @@ -149,7 +149,7 @@ QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const; //! [11] -boost::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation) +std::bind(&QImage::scaledToWidth, 100, Qt::SmoothTransformation) //! [11] @@ -160,7 +160,7 @@ QImage scaledToWith(const QImage &image) //! [13] QList<QImage> images = ...; -QFuture<QImage> thumbnails = QtConcurrent::mapped(images, boost::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation)); +QFuture<QImage> thumbnails = QtConcurrent::mapped(images, std::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation)); //! [13] //! [14] diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp index 7288fc642b..8922e41f34 100644 --- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp +++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentrun.cpp @@ -93,6 +93,6 @@ future.waitForFinished(); //! [6] void someFunction(int arg1, double arg2); -QFuture<void> future = QtConcurrent::run(boost::bind(someFunction, 1, 2.0)); +QFuture<void> future = QtConcurrent::run(std::bind(someFunction, 1, 2.0)); ... //! [6] diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp index 22a1243c18..ab0227983d 100644 --- a/src/concurrent/qtconcurrentfilter.cpp +++ b/src/concurrent/qtconcurrentfilter.cpp @@ -40,15 +40,10 @@ ****************************************************************************/ /*! - \headerfile <QtConcurrentFilter> + \page qtconcurrentfilter.html \title Concurrent Filter and Filter-Reduce \ingroup thread - \brief The <QtConcurrentFilter> header provides concurrent Filter and - Filter-Reduce. - - These functions are a part of the \l {Qt Concurrent} framework. - The QtConcurrent::filter(), QtConcurrent::filtered() and QtConcurrent::filteredReduced() functions filter items in a sequence such as a QList or a QVector in parallel. QtConcurrent::filter() modifies a @@ -56,6 +51,8 @@ containing the filtered content, and QtConcurrent::filteredReduced() returns a single result. + These functions are a part of the \l {Qt Concurrent} framework. + Each of the above functions have a blocking variant that returns the final result instead of a QFuture. You use them in the same way as the asynchronous variants. @@ -155,15 +152,11 @@ \section2 Using Bound Function Arguments - Note that Qt does not provide support for bound functions. This is - provided by 3rd party libraries like - \l{http://www.boost.org/libs/bind/bind.html}{Boost} or - \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {C++ TR1 Library Extensions}. - If you want to use a filter function takes more than one argument, you can - use boost::bind() or std::tr1::bind() to transform it onto a function that - takes one argument. + use std::bind() to transform it onto a function that takes one argument. If + C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} + {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} + {std::tr1::bind()} are suitable replacements. As an example, we use QString::contains(): @@ -177,7 +170,7 @@ \snippet code/src_concurrent_qtconcurrentfilter.cpp 10 - The return value from boost::bind() is a function object (functor) with + The return value from std::bind() is a function object (functor) with the following signature: \snippet code/src_concurrent_qtconcurrentfilter.cpp 11 @@ -190,7 +183,6 @@ /*! \fn QFuture<void> QtConcurrent::filter(Sequence &sequence, FilterFunction filterFunction) - \relates <QtConcurrentFilter> Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true, the item is kept in \a sequence; @@ -199,7 +191,6 @@ /*! \fn QFuture<T> QtConcurrent::filtered(const Sequence &sequence, FilterFunction filterFunction) - \relates <QtConcurrentFilter> Calls \a filterFunction once for each item in \a sequence and returns a new Sequence of kept items. If \a filterFunction returns \c true, a copy of @@ -209,7 +200,6 @@ /*! \fn QFuture<T> QtConcurrent::filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction) - \relates <QtConcurrentFilter> Calls \a filterFunction once for each item from \a begin to \a end and returns a new Sequence of kept items. If \a filterFunction returns \c true, a @@ -219,7 +209,6 @@ /*! \fn QFuture<T> QtConcurrent::filteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates <QtConcurrentFilter> Calls \a filterFunction once for each item in \a sequence. If \a filterFunction returns \c true for an item, that item is then passed to @@ -236,7 +225,6 @@ /*! \fn QFuture<T> QtConcurrent::filteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates <QtConcurrentFilter> Calls \a filterFunction once for each item from \a begin to \a end. If \a filterFunction returns \c true for an item, that item is then passed to diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index da2a601ae2..fc904a4d59 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -68,14 +68,10 @@ */ /*! - \headerfile <QtConcurrentMap> + \page qtconcurrentmap.html \title Concurrent Map and Map-Reduce \ingroup thread - \brief The <QtConcurrentMap> header provides concurrent Map and MapReduce. - - These functions are a part of the \l {Qt Concurrent} framework. - The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on the items in a sequence such as a QList or a QVector. QtConcurrent::map() @@ -83,6 +79,8 @@ sequence containing the modified content, and QtConcurrent::mappedReduced() returns a single result. + These functions are a part of the \l {Qt Concurrent} framework. + Each of the above functions has a blocking variant that returns the final result instead of a QFuture. You use them in the same way as the asynchronous variants. @@ -204,15 +202,11 @@ \section2 Using Bound Function Arguments - Note that Qt does not provide support for bound functions. This is - provided by 3rd party libraries like - \l{http://www.boost.org/libs/bind/bind.html}{Boost} or - \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf}{C++ - TR1 Library Extensions}. - If you want to use a map function that takes more than one argument you can - use boost::bind() or std::tr1::bind() to transform it onto a function that - takes one argument. + use std::bind() to transform it onto a function that takes one argument. If + C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} + {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} + {std::tr1::bind()} are suitable replacements. As an example, we'll use QImage::scaledToWidth(): @@ -226,7 +220,7 @@ \snippet code/src_concurrent_qtconcurrentmap.cpp 11 - The return value from boost::bind() is a function object (functor) with + The return value from std::bind() is a function object (functor) with the following signature: \snippet code/src_concurrent_qtconcurrentmap.cpp 12 @@ -239,7 +233,6 @@ /*! \fn QFuture<void> QtConcurrent::map(Sequence &sequence, MapFunction function) - \relates <QtConcurrentMap> Calls \a function once for each item in \a sequence. The \a function is passed a reference to the item, so that any modifications done to the item @@ -248,7 +241,6 @@ /*! \fn QFuture<void> QtConcurrent::map(Iterator begin, Iterator end, MapFunction function) - \relates <QtConcurrentMap> Calls \a function once for each item from \a begin to \a end. The \a function is passed a reference to the item, so that any modifications @@ -257,7 +249,6 @@ /*! \fn QFuture<T> QtConcurrent::mapped(const Sequence &sequence, MapFunction function) - \relates <QtConcurrentMap> Calls \a function once for each item in \a sequence and returns a future with each mapped item as a result. You can use QFuture::const_iterator or @@ -266,7 +257,6 @@ /*! \fn QFuture<T> QtConcurrent::mapped(ConstIterator begin, ConstIterator end, MapFunction function) - \relates <QtConcurrentMap> Calls \a function once for each item from \a begin to \a end and returns a future with each mapped item as a result. You can use @@ -278,8 +268,6 @@ MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates <QtConcurrentMap> - Calls \a mapFunction once for each item in \a sequence. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -293,8 +281,6 @@ ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates <QtConcurrentMap> - Calls \a mapFunction once for each item from \a begin to \a end. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -361,8 +347,6 @@ /*! \fn T QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates <QtConcurrentMap> - Calls \a mapFunction once for each item in \a sequence. The return value of each \a mapFunction is passed to \a reduceFunction. @@ -378,8 +362,6 @@ /*! \fn T QtConcurrent::blockingMappedReduced(ConstIterator begin, ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions) - \relates <QtConcurrentMap> - Calls \a mapFunction once for each item from \a begin to \a end. The return value of each \a mapFunction is passed to \a reduceFunction. diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h index 29342e6402..b39b3ed32b 100644 --- a/src/concurrent/qtconcurrentmedian.h +++ b/src/concurrent/qtconcurrentmedian.h @@ -90,7 +90,7 @@ public: dirty = true; } - values[currentIndex] = qMove(value); + values[currentIndex] = value; } bool isMedianValid() const @@ -105,7 +105,7 @@ public: QVector<T> copy = values; typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end(); std::nth_element(begin, mid, end); - currentMedian = qMove(*mid); + currentMedian = *mid; } return currentMedian; } diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index 4398e1a91f..c71fc9048f 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -40,19 +40,15 @@ ****************************************************************************/ /*! - \headerfile <QtConcurrentRun> - \title Asynchronous Run - - \brief The <QtConcurrentRun> header provides a way to run a function in a - separate thread. - + \page qtconcurrentrun.html + \title Concurrent Run \ingroup thread - This function is a part of the \l {Qt Concurrent} framework. - The QtConcurrent::run() function runs a function in a separate thread. The return value of the function is made available through the QFuture API. + This function is a part of the \l {Qt Concurrent} framework. + \section1 Running a Function in a Separate Thread To run a function in another thread, use QtConcurrent::run(): @@ -110,15 +106,12 @@ \section2 Using Bound Function Arguments - Note that Qt does not provide support for bound functions. This is - provided by 3rd party libraries like - \l{http://www.boost.org/libs/bind/bind.html}{Boost} or - \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {C++ TR1 Library Extensions}. + You can use std::bind() to \e bind a number of arguments to a function when + called. If C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} + {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} + {std::tr1::bind()} are suitable replacements. - You can use boost::bind() or std::tr1::bind() to \e bind a number of - arguments to a function when called. There are number of reasons for doing - this: + There are number of reasons for binding: \list \li To call a function that takes more than 5 arguments. @@ -136,7 +129,6 @@ /*! \fn QFuture<T> QtConcurrent::run(Function function, ...); - \relates <QtConcurrentRun> Runs \a function in a separate thread. The thread is taken from the global QThreadPool. Note that the function may not run immediately; the function diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 2d87783107..9bda70ec07 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -51,8 +51,9 @@ set(Qt5Core_MOC_EXECUTABLE Qt5::moc) set(Qt5Core_RCC_EXECUTABLE Qt5::rcc) set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_MAJOR_VERSION 5) +set_property(TARGET Qt5::Core PROPERTY INTERFACE_QT_COORD_TYPE $$QT_COORD_TYPE) set_property(TARGET Qt5::Core APPEND PROPERTY - COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION + COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION QT_COORD_TYPE ) include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5CoreConfigExtrasMkspecDir.cmake\") @@ -80,6 +81,12 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) !!ENDIF +!!IF !isEmpty(CMAKE_DISABLED_FEATURES) +set(Qt5_DISABLED_FEATURES + $$CMAKE_DISABLED_FEATURES +) +!!ENDIF + set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) !!IF contains(QT_CONFIG, reduce_exports) diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 42debea782..1c84e3dbc9 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -303,8 +303,6 @@ QPauseAnimation *QSequentialAnimationGroup::insertPause(int index, int msecs) /*! \property QSequentialAnimationGroup::currentAnimation Returns the animation in the current time. - - \sa currentAnimationChanged() */ QAbstractAnimation *QSequentialAnimationGroup::currentAnimation() const { diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 1ed55bb0c8..b513149e7c 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -20,8 +20,7 @@ ANDROID_JAR_DEPENDENCIES = \ jar/QtAndroid.jar \ jar/QtAndroidAccessibility.jar ANDROID_LIB_DEPENDENCIES = \ - plugins/platforms/android/libqtforandroid.so \ - libs/libgnustl_shared.so + plugins/platforms/android/libqtforandroid.so ANDROID_BUNDLED_JAR_DEPENDENCIES = \ jar/QtAndroid-bundled.jar \ jar/QtAndroidAccessibility-bundled.jar @@ -49,7 +48,7 @@ mac|darwin { LIBS_PRIVATE += -framework CoreServices } LIBS_PRIVATE += -framework CoreFoundation - LIBS += -framework Foundation + LIBS_PRIVATE += -framework Foundation } win32:DEFINES-=QT_NO_CAST_TO_ASCII DEFINES += $$MODULE_DEFINES @@ -80,6 +79,9 @@ cmake_umbrella_config_version_file.input = $$PWD/../../mkspecs/features/data/cma cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion.cmake load(cmake_functions) +load(qfeatures) + +CMAKE_DISABLED_FEATURES = $$join(QT_DISABLED_FEATURES, "$$escape_expand(\\n) ") CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA/src], $$[QT_INSTALL_PREFIX]) contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_HOST_DATA_DIR) { diff --git a/src/corelib/doc/images/thread_clock.png b/src/corelib/doc/images/thread_clock.png Binary files differdeleted file mode 100644 index b8a8aa0a39..0000000000 --- a/src/corelib/doc/images/thread_clock.png +++ /dev/null diff --git a/src/corelib/doc/images/threadsandobjects.png b/src/corelib/doc/images/threadsandobjects.png Binary files differdeleted file mode 100644 index 8357d2532a..0000000000 --- a/src/corelib/doc/images/threadsandobjects.png +++ /dev/null diff --git a/src/corelib/doc/images/threadvisual-example.png b/src/corelib/doc/images/threadvisual-example.png Binary files differdeleted file mode 100644 index 2a49874719..0000000000 --- a/src/corelib/doc/images/threadvisual-example.png +++ /dev/null diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index fdd46995c5..9ab66c6645 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtCore description = Qt Core Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtcore +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = core @@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner +depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml headerdirs += .. diff --git a/src/corelib/doc/snippets/code/doc_src_resources.cpp b/src/corelib/doc/snippets/code/doc_src_resources.cpp index 482c25a222..8ac7b0e970 100644 --- a/src/corelib/doc/snippets/code/doc_src_resources.cpp +++ b/src/corelib/doc/snippets/code/doc_src_resources.cpp @@ -44,11 +44,24 @@ QResource::registerResource("/path/to/myresource.rcc"); //! [5] +MyClass::MyClass() : BaseClass() +{ + Q_INIT_RESOURCE(resources); + + QFile file("qrc:/myfile.dat"); + ... +} +//! [5] + + +//! [6] int main(int argc, char *argv[]) { QApplication app(argc, argv); Q_INIT_RESOURCE(graphlib); + + QFile file("qrc:/graph.png"); ... return app.exec(); } -//! [5] +//! [6] diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp index 003fce580b..9210d2737f 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qbytearray.cpp @@ -416,7 +416,7 @@ text.data(); // returns "Qt is great!" //! [46] QString tmp = "test"; QByteArray text = tmp.toLocal8Bit(); -char *data = new char[text.size()] +char *data = new char[text.size()]; strcpy(data, text.data()); delete [] data; //! [46] @@ -424,7 +424,7 @@ delete [] data; //! [47] QString tmp = "test"; QByteArray text = tmp.toLocal8Bit(); -char *data = new char[text.size() + 1] +char *data = new char[text.size() + 1]; strcpy(data, text.data()); delete [] data; //! [47] diff --git a/src/corelib/doc/snippets/qtracer/ftracer.cpp b/src/corelib/doc/snippets/qtracer/ftracer.cpp deleted file mode 100644 index b12e3ed9c3..0000000000 --- a/src/corelib/doc/snippets/qtracer/ftracer.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> - -#include <QCoreApplication> -#include <QLoggingCategory> - - -//![1] -QLoggingCategory theFooArea("foo"); -QLoggingCategory theBarArea("bar"); -QLoggingCategory theBazArea("baz"); -//![1] - -// Note: These locations are Ubuntu specific. - -// Note: To make the example work with user permissions, make sure -// the files are user-writable and the path leading there accessible. - -const char traceSwitch[] = "/sys/kernel/debug/tracing/tracing_on"; -const char traceSink[] = "/sys/kernel/debug/tracing/trace_marker"; - -// The base class only serves as a facility to share code -// between the "single line" data logging aspect and the -// scoped "measuring" aspect. - -// Both aspects and the base class could be combined into -// a single tracer serving both purposes, but are split -// here for clarity. - -// Error handling is left as an exercise. - -//![2] -class MyTracerBase : public QTracer -{ -public: - MyTracerBase() { - enable = ::open(traceSwitch, O_WRONLY); - marker = ::open(traceSink, O_WRONLY); - } - - ~MyTracerBase() { - ::close(enable); - ::close(marker); - } - -protected: - int enable; - int marker; -}; -//![2] - - -//![2] -class MyTracer : public MyTracerBase -{ -public: - void start() { ::write(marker, "B", 1); } - void end() { ::write(marker, "E", 1); } -}; -//![2] - - -//![3] -class MyDataLogger : public MyTracerBase -{ -public: - MyDataLogger() { - buf[0] = 0; - pos = 0; - } - - void record(int i) { pos += sprintf(buf + pos, "%d", i); } - void record(const char *msg) { pos += sprintf(buf + pos, "%s", msg); } - void end() { ::write(marker, buf, pos); pos = 0; } - -private: - char buf[100]; - int pos; -}; -//![3] - -// Simplest possible example for "measuring". -//![4] -int foo(int i) -{ - qCTraceGuard(theFooArea); - // Here could be some lengthy code. - return i * i; -} -//![4] - -// We can switch on/off tracing dynamically. -// The tracer will be temporarily switched off at the third call -// and re-enabled at the eighth. -//![5] -int bar(int i) -{ - static int n = 0; - ++n; - if (n == 3) - theBarArea.setEnabled(QtTraceMsg, false); - if (n == 8) - theBarArea.setEnabled(QtTraceMsg, true); - - qCTraceGuard(theBarArea); - return i * i; -} -//![5] - -// An example to create "complex" log messages. -//![6] -int baz(int i) -{ - qCTrace(theBazArea) << 32 << "some stuff"; - - return i * i; -} -//![6] - - - -//![7] -namespace { -static struct Init -{ - Init() { - tracer.addToCategory(theFooArea); - tracer.addToCategory(theBarArea); - logger.addToCategory(theBazArea); - } - - MyTracer tracer; - MyDataLogger logger; - -} initializer; -} -//![7] diff --git a/src/corelib/doc/snippets/qtracer/main.cpp b/src/corelib/doc/snippets/qtracer/main.cpp deleted file mode 100644 index 758a2bbdb8..0000000000 --- a/src/corelib/doc/snippets/qtracer/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -int foo(int i); -int bar(int i); -int baz(int i); - -int main() -{ - int s = 0; - for (int i = 0; i != 10; ++i) - s += foo(i); - - for (int i = 0; i != 10; ++i) - s += bar(i); - - for (int i = 0; i != 10; ++i) - s += baz(i); - - return s; -} - diff --git a/src/corelib/doc/snippets/qtracer/qtracer.pro b/src/corelib/doc/snippets/qtracer/qtracer.pro deleted file mode 100644 index 254e22be76..0000000000 --- a/src/corelib/doc/snippets/qtracer/qtracer.pro +++ /dev/null @@ -1,2 +0,0 @@ - -SOURCES += ftracer.cpp main.cpp diff --git a/src/corelib/doc/src/custom-types.qdoc b/src/corelib/doc/src/custom-types.qdoc index cbf347a2f7..ed846aee83 100644 --- a/src/corelib/doc/src/custom-types.qdoc +++ b/src/corelib/doc/src/custom-types.qdoc @@ -155,10 +155,9 @@ The Q_DECLARE_METATYPE() macro and qRegisterMetaType() function documentation contain more detailed information about their uses and limitations. - The \l{Custom Type Example}{Custom Type}, - \l{Custom Type Sending Example}{Custom Type Sending} - and \l{Queued Custom Type Example}{Queued Custom Type} examples show how to - implement a custom type with the features outlined in this document. + The \l{Custom Type Example}{Custom Type} and \l{Queued Custom Type Example} + {Queued Custom Type} examples show how to implement a custom type with the + features outlined in this document. The \l{Debugging Techniques} document provides an overview of the debugging mechanisms discussed above. diff --git a/src/corelib/doc/src/objectmodel/object.qdoc b/src/corelib/doc/src/objectmodel/object.qdoc index 89a781da39..8d24096b7a 100644 --- a/src/corelib/doc/src/objectmodel/object.qdoc +++ b/src/corelib/doc/src/objectmodel/object.qdoc @@ -46,7 +46,8 @@ \li queryable and designable \l{Qt's Property System}{object properties} \li powerful \l{The Event System}{events and event filters} - \li contextual \l{i18n}{string translation for internationalization} + \li contextual \l{Internationalization with Qt}{string translation for + internationalization} \li sophisticated interval driven \l {Timers}{timers} that make it possible to elegantly integrate many tasks in an event-driven GUI \li hierarchical and queryable \l{Object Trees & Ownership}{object diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc index dd93b80cae..e894d547d0 100644 --- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc +++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc @@ -275,7 +275,7 @@ and slot members, as well as pointers to these functions. The meta-object contains additional information such as the - object's \l{QObject::className()}{class name}. You can + object's \l{QMetaObject::className()}{class name}. You can also check if an object \l{QObject::inherits()}{inherits} a specific class, for example: diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc index 2dbf1f8141..7565d610cc 100644 --- a/src/corelib/doc/src/plugins-howto.qdoc +++ b/src/corelib/doc/src/plugins-howto.qdoc @@ -35,10 +35,7 @@ These \l{Qt Core} classes deal with shared libraries, (e.g. .so and DLL files), and with Qt plugins. - See the \l{How to Create Qt Plugins} page for more information.. - - See also the \l{ActiveQt framework} for Windows. - + See the \l{How to Create Qt Plugins} page for more information. */ /*! diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 5ef6bb285c..91ce8afcf8 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -184,15 +184,39 @@ path list is empty at startup; call QDir::addSearchPath() to add paths to it. - If you have resources in a static library, you might need to - force initialization of your resources by calling \l - Q_INIT_RESOURCE() with the base name of the \c .qrc file. For - example: + \section1 Using Resources in a Library + + If you have resources in a library, you need to force initialization + of your resources by calling \l Q_INIT_RESOURCE() with the base name + of the \c .qrc file. For example: \snippet code/doc_src_resources.cpp 5 + This ensures that the resources are linked into the final application + binary in the case of static linking. You should put the initialization + code close to where the resources are used in your library, so that + clients of your library will only link in the resources if they use + the feature of the library that depends on them. + + Note: As the resource initializers generated by rcc are declared in the + global namespace, your calls to \l Q_INIT_RESOURCE() also need to be done + outside of any namespace. + + If the library includes resources that are not used internally, but + instead exposed to clients of the library, the initialization needs + to happen in the application code. For example: + + \snippet code/doc_src_resources.cpp 6 + + As before, this ensures that the resources are linked into the final + application binary in the case of static linking, but also triggers + loading of the library in the case of dynamic linking, such as plugins. + Similarly, if you must unload a set of resources explicitly (because a plugin is being unloaded or the resources are not valid any longer), you can force removal of your resources by calling - Q_CLEANUP_RESOURCE() with the same base name as above. + \l Q_CLEANUP_RESOURCE() with the same base name as above. + + Note: The use of \l Q_INIT_RESOURCE() and \l Q_CLEANUP_RESOURCE() is + not necessary when the resource is built as part of the application. */ diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc deleted file mode 100644 index 4f381421b4..0000000000 --- a/src/corelib/doc/src/threads-basics.qdoc +++ /dev/null @@ -1,365 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page thread-basics.html - \ingroup tutorials - \startpage {index.html}{Qt Reference Documentation} - - \title Threading Basics - \brief An introduction to threads - - \section1 What Are Threads? - - Threads are about doing things in parallel, just like processes. So how do - threads differ from processes? While you are making calculations on a - spreadsheet, there may also be a media player running on the same desktop - playing your favorite song. Here is an example of two processes working in - parallel: one running the spreadsheet program; one running a media player. - Multitasking is a well known term for this. A closer look at the media - player reveals that there are again things going on in parallel within one - single process. While the media player is sending music to the audio driver, - the user interface with all its bells and whistles is being constantly - updated. This is what threads are for -- concurrency within one single - process. - - So how is concurrency implemented? Parallel work on single core CPUs is an - illusion which is somewhat similar to the illusion of moving images in - cinema. - For processes, the illusion is produced by interrupting the processor's - work on one process after a very short time. Then the processor moves on to - the next process. In order to switch between processes, the current program - counter is saved and the next processor's program counter is loaded. This - is not sufficient because the same needs to be done with registers and - certain architecture and OS specific data. - - Just as one CPU can power two or more processes, it is also possible to let - the CPU run on two different code segments of one single process. When a - process starts, it always executes one code segment and therefore the - process is said to have one thread. However, the program may decide to - start a second thread. Then, two different code sequences are processed - simultaneously inside one process. Concurrency is achieved on single core - CPUs by repeatedly saving program counters and registers then loading the - next thread's program counters and registers. No cooperation from the - program is required to cycle between the active threads. A thread may be in - any state when the switch to the next thread occurs. - - The current trend in CPU design is to have several cores. A typical - single-threaded application can make use of only one core. However, a - program with multiple threads can be assigned to multiple cores, making - things happen in a truly concurrent way. As a result, distributing work - to more than one thread can make a program run much faster on multicore - CPUs because additional cores can be used. - - \section2 GUI Thread and Worker Thread - - As mentioned, each program has one thread when it is started. This thread - is called the "main thread" (also known as the "GUI thread" in Qt - applications). The Qt GUI must run in this thread. All widgets and several - related classes, for example QPixmap, don't work in secondary threads. - A secondary thread is commonly referred to as a "worker thread" because it - is used to offload processing work from the main thread. - - \section2 Simultaneous Access to Data - - Each thread has its own stack, which means each thread has its own call - history and local variables. Unlike processes, threads share the same - address space. The following diagram shows how the building blocks of - threads are located in memory. Program counter and registers of inactive - threads are typically kept in kernel space. There is a shared copy of the - code and a separate stack for each thread. - - \image threadvisual-example.png "Thread visualization" - - If two threads have a pointer to the same object, it is possible that both - threads will access that object at the same time and this can potentially - destroy the object's integrity. It's easy to imagine the many things that - can go wrong when two methods of the same object are executed - simultaneously. - - Sometimes it is necessary to access one object from different threads; - for example, when objects living in different threads need to communicate. - Since threads use the same address space, it is easier and faster for - threads to exchange data than it is for processes. Data does not have to be - serialized and copied. Passing pointers is possible, but there must be a - strict coordination of what thread touches which object. Simultaneous - execution of operations on one object must be prevented. There are several - ways of achieving this and some of them are described below. - - So what can be done safely? All objects created in a thread can be used - safely within that thread provided that other threads don't have references - to them and objects don't have implicit coupling with other threads. Such - implicit coupling may happen when data is shared between instances as with - static members, singletons or global data. Familiarize yourself with the - concept of \l{Reentrancy and Thread-Safety}{thread safe and reentrant} - classes and functions. - - \section1 Using Threads - - There are basically two use cases for threads: - - \list - \li Make processing faster by making use of multicore processors. - \li Keep the GUI thread or other time critical threads responsive by - offloading long lasting processing or blocking calls to other threads. - \endlist - - \section2 When to Use Alternatives to Threads - - Developers need to be very careful with threads. It is easy to start other - threads, but very hard to ensure that all shared data remains consistent. - Problems are often hard to find because they may only show up once in a - while or only on specific hardware configurations. Before creating threads - to solve certain problems, possible alternatives should be considered. - - \table - \header - \li Alternative - \li Comment - \row - \li QEventLoop::processEvents() - \li Calling QEventLoop::processEvents() repeatedly during a - time-consuming calculation prevents GUI blocking. However, this - solution doesn't scale well because the call to processEvents() may - occur too often, or not often enough, depending on hardware. - \row - \li QTimer - \li Background processing can sometimes be done conveniently using a - timer to schedule execution of a slot at some point in the future. - A timer with an interval of 0 will time out as soon as there are no - more events to process. - \row - \li QSocketNotifier QNetworkAccessManager QIODevice::readyRead() - \li This is an alternative to having one or multiple threads, each with - a blocking read on a slow network connection. As long as the - calculation in response to a chunk of network data can be executed - quickly, this reactive design is better than synchronous waiting in - threads. Reactive design is less error prone and energy efficient - than threading. In many cases there are also performance benefits. - \endtable - - In general, it is recommended to only use safe and tested paths and to - avoid introducing ad-hoc threading concepts. The QtConcurrent module provides an easy - interface for distributing work to all of the processor's cores. The - threading code is completely hidden in the QtConcurrent framework, so you - don't have to take care of the details. However, QtConcurrent can't be used - when communication with the running thread is needed, and it shouldn't be - used to handle blocking operations. - - \section2 Which Qt Thread Technology Should You Use? - - See the \l{Multithreading Technologies in Qt} page for an introduction to the - different approaches to multithreading to Qt, and for guidelines on how to - choose among them. - - - \section1 Qt Thread Basics - - The following sections describe how QObjects interact with threads, how - programs can safely access data from multiple threads, and how asynchronous - execution produces results without blocking a thread. - - \section2 QObject and Threads - - As mentioned above, developers must always be careful when calling objects' - methods from other threads. \l{QObject#Thread Affinity}{Thread affinity} - does not change this situation. - Qt documentation marks several methods as thread-safe. - \l{QCoreApplication::}{postEvent()} is a noteworthy example. A thread-safe - method may be called from different threads simultaneously. - - In cases where there is usually no concurrent access to methods, calling - non-thread-safe methods of objects in other threads may work thousands - of times before a concurrent access occurs, causing unexpected behavior. - Writing test code does not entirely ensure thread correctness, but it is - still important. - On Linux, Valgrind and Helgrind can help detect threading errors. - - \section2 Protecting the Integrity of Data - - When writing a multithread application, extra care must be taken to avoid - data corruption. See \l{Synchronizing Threads} for a discussion on how to - use threads safely. - - \section2 Dealing with Asynchronous Execution - - One way to obtain a worker thread's result is by waiting for the thread - to terminate. In many cases, however, a blocking wait isn't acceptable. The - alternative to a blocking wait are asynchronous result deliveries with - either posted events or queued signals and slots. This generates a certain - overhead because an operation's result does not appear on the next source - line, but in a slot located somewhere else in the source file. Qt - developers are used to working with this kind of asynchronous behavior - because it is much similar to the kind of event-driven programming used in - GUI applications. - - \section1 Examples - - This tutorial comes with examples for Qt's three basic ways of working with - threads. Two more examples show how to communicate with a running thread - and how a QObject can be placed in another thread, providing service to the - main thread. - - \list - \li Using QThread as shown \l{Qt thread basics}{above} - \li \l{Example 1: Using the Thread Pool}{Using the global QThreadPool} - \li \l{Example 2: Using QtConcurrent}{Using QtConcurrent} - \li \l{Example 3: Clock}{Communication with the GUI thread} - \li \l{Example 4: A Permanent Thread}{A permanent QObject in another thread - provides service to the main thread} - \endlist - - The following examples can all be compiled and run independently. The source can - be found in the examples directory: examples/tutorials/threads/ - - \section2 Example 1: Using the Thread Pool - - Creating and destroying threads frequently can be expensive. To avoid the - cost of thread creation, a thread pool can be used. A thread pool is a - place where threads can be parked and fetched. We can write the same - "hello thread" program as \l{Qt Thread Basics}{above} using the global - thread pool. We derive a class from QRunnable. The code we want to run in - another thread needs to be placed in the reimplemented QRunnable::run() - method. - - \snippet ../widgets/tutorials/threads/hellothreadpool/hellothreadpool.cpp 1 - - We instantiate Work in main(), locate the global thread pool and use the - QThreadPool::start() method. Now the thread pool runs our worker in another - thread. Using the thread pool has a performance advantage because threads - are not destroyed after they have finished running. They are kept in a pool - and wait to be used again later. - - \section2 Example 2: Using QtConcurrent - - \snippet ../widgets/tutorials/threads/helloconcurrent/helloconcurrent.cpp 1 - - We write a global function hello() to implement the work. QtConcurrent::run() - is used to run the function in another thread. The result is a QFuture. - QFuture provides a method called \l{QFuture::}{waitForFinished()}, which - blocks until the calculation is completed. The real power of QtConcurrent - becomes visible when data can be made available in a container. QtConcurrent - provides several functions that are able to process itemized data on all - available cores simultaneously. The use of QtConcurrent is very similar to - applying an STL algorithm to an STL container. - \l{examples-threadandconcurrent.html}{QtConcurrent Map} is a very short and - clear example about how a container of images can be scaled on all available - cores. The image scaling example uses the blocking variants of the functions - used. For every blocking function there is also a non-blocking, asynchronous - counterpart. Getting results asynchronously is implemented with QFuture and - QFutureWatcher. - - \section2 Example 3: Clock - - \image thread_clock.png "clock" - - We want to produce a clock application. The application has a GUI and a - worker thread. The worker thread checks every 10 milliseconds what time it - is. If the formatted time has changed, the result will be sent to the GUI - thread where it is displayed. - - Of course, this is an overly complicated way of designing a clock and, - actually, a separate thread is unnecessary. We would be better off placing - the timer in the main thread because the calculation made in the timer slot - is very short-lived. This example is purely for instructional use and shows - how to communicate from a worker thread to a GUI thread. Note that - communication in this direction is easy. We only need to add a signal - to QThread and make a queued signal/slot connection to the main thread. - Communication from the GUI to the worker thread is shown in the next - example. - - \snippet ../widgets/tutorials/threads/clock/main.cpp 1 - - We've connected the \c clockThread with the label. The connection must be a - queued signal-slot connection because we want to put the call in the event - loop. - - \snippet ../widgets/tutorials/threads/clock/clockthread.h 1 - - We have derived a class from QThread and declared the \c sendTime() signal. - - \snippet ../widgets/tutorials/threads/clock/clockthread.cpp 1 - - The trickiest part of this example is that the timer is connected to its - slot via a direct connection. A default connection would produce a queued - signal-slot connection because the connected objects live in different - threads; remember that QThread does not live in the thread it creates. - - Still it is safe to access ClockThread::timerHit() from the worker thread - because ClockThread::timerHit() is private and only touches local variables - and a private member that isn't touched by public methods. - QDateTime::currentDateTime() isn't marked as thread-safe in Qt - documentation, however we can get away with using it in this small - example because we know that the QDateTime::currentDateTime() static - method isn't used in any other threads. - - \section2 Example 4: A Permanent Thread - - This example shows how it is possible to have a QObject in a worker thread - that accepts requests from the GUI thread, does polling using a timer and - continuously reports results back to the GUI thread. The actual work - including the polling must be implemented in a class derived from QObject. - We have called this class \c WorkerObject in the code shown below. The - thread-specific code is hidden in a class called \c Thread, derived from - QThread. - \c Thread has two additional public members. The \c launchWorker() member - takes the worker object and moves it to another thread with a started event - loop. - The call blocks for a very short moment until the thread creation operation - is completed, allowing the worker object to be used again on the next line. - The \c Thread class's code is short but somewhat involved, so we only show - how to use the class. - - \snippet ../widgets/tutorials/threads/movedobject/main.cpp 1 - - QMetaObject::invokeMethod() calls a slot via the event loop. The worker - object's methods should not be called directly after the object has been - moved to another thread. We let the worker thread do some work and polling, - and use a timer to shut the application down after 3 seconds. Shutting the - worker down needs some care. We call \c{Thread::stop()} to exit the event - loop. We wait for the thread to terminate and, after this has occurred, we - delete the worker. - - \section1 Digging Deeper - - Threading is a very complicated subject. Qt offers more classes for - threading than we have presented in this tutorial. The following materials - can help you go into the subject in more depth: - - \list - \li Good video tutorials about threads with Qt can be found in the material - from the \l{Training Day at Qt Developer Days 2009}. - \li The \l{Thread Support in Qt} document is a good starting point into - the reference documentation. - \li Qt comes with several additional examples for - \l{Threading and Concurrent Programming Examples}{QThread and QtConcurrent}. - \li Several good books describe how to work with Qt threads. The most - extensive coverage can be found in \e{Advanced Qt Programming} by Mark - Summerfield, Prentice Hall - roughly 70 of 500 pages cover QThread and - QtConcurrent. - \endlist -*/ diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc deleted file mode 100644 index 890fd9f6ff..0000000000 --- a/src/corelib/doc/src/threads.qdoc +++ /dev/null @@ -1,828 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \group thread - \title Threading Classes - - These \l{Qt Core} classes provide threading support to applications. - The \l{Thread Support in Qt} page covers how to use these classes. -*/ - -/*! - \page threads.html - \title Thread Support in Qt - \ingroup qt-basic-concepts - \brief A detailed discussion of thread handling in Qt. - - \ingroup frameworks-technologies - - \nextpage Multithreading Technologies in Qt - - Qt provides thread support in the form of platform-independent - threading classes, a thread-safe way of posting events, and - signal-slot connections across threads. This makes it easy to - develop portable multithreaded Qt applications and take advantage - of multiprocessor machines. Multithreaded programming is also a - useful paradigm for performing time-consuming operations without - freezing the user interface of an application. - - Earlier versions of Qt offered an option to build the library - without thread support. Since Qt 4.0, threads are always enabled. - - \section1 Topics: - - \list - \li \l{Recommended Reading} - \li \l{The Threading Classes} - \li \l{Multithreading Technologies in Qt} - \li \l{Synchronizing Threads} - \li \l{Reentrancy and Thread-Safety} - \li \l{Threads and QObjects} - \li \l{Thread-Support in Qt Modules} - \endlist - - \section1 Recommended Reading - - This document is intended for an audience that has knowledge of, - and experience with, multithreaded applications. If you are new - to threading see our Recommended Reading list: - - \list - \li \l {http://www.amazon.com/Threads-Primer-Guide-Multithreaded-Programming/dp/0134436989}{Threads Primer: A Guide to Multithreaded Programming} - \li \l {http://www.amazon.com/Thread-Time-MultiThreaded-Programming-Guide/dp/0131900676}{Thread Time: The Multithreaded Programming Guide} - \li \l {http://www.amazon.com/Pthreads-Programming-Standard-Multiprocessing-Nutshell/dp/1565921151a}{Pthreads Programming: A POSIX Standard for Better Multiprocessing} - \li \l {http://www.amazon.com/WIN32-Multithreaded-Programming-Aaron-Cohen/dp/1565922964}{Win32 Multithreaded Programming} - \endlist - - \section1 The Threading Classes - - These classes are relevant to threaded applications. - - \annotatedlist thread - -\omit - \list - \li QThread provides the means to start a new thread. - \li QThreadStorage provides per-thread data storage. - \li QThreadPool manages a pool of threads that run QRunnable objects. - \li QRunnable is an abstract class representing a runnable object. - \li QMutex provides a mutual exclusion lock, or mutex. - \li QMutexLocker is a convenience class that automatically locks - and unlocks a QMutex. - \li QReadWriteLock provides a lock that allows simultaneous read access. - \li QReadLocker and QWriteLocker are convenience classes that automatically - lock and unlock a QReadWriteLock. - \li QSemaphore provides an integer semaphore (a generalization of a mutex). - \li QWaitCondition provides a way for threads to go to sleep until - woken up by another thread. - \li QAtomicInt provides atomic operations on integers. - \li QAtomicPointer provides atomic operations on pointers. - \endlist -\endomit - - \note Qt's threading classes are implemented with native threading APIs; - e.g., Win32 and pthreads. Therefore, they can be used with threads of the - same native API. -*/ - -/*! - \page threads-technologies.html - \title Multithreading Technologies in Qt - \ingroup qt-basic-concepts - \brief An overview and comparison of different ways to use threads in Qt. - - \ingroup frameworks-technologies - - \contentspage Thread Support in Qt - \previouspage Thread Support in Qt - \nextpage Synchronizing Threads - - Qt offers many classes and functions for working with threads. Below are - four different approaches that Qt programmers can use to implement - multithreaded applications. - - - \section1 QThread: Low-Level API with Optional Event Loops - - QThread is the foundation of all thread control in Qt. Each QThread - instance represents and controls one thread. - - QThread can either be instantiated directly or subclassed. Instantiating a - QThread provides a parallel event loop, allowing QObject slots to be invoked - in a secondary thread. Subclassing a QThread allows the application to initialize - the new thread before starting its event loop, or to run parallel code - without an event loop. - - See the \l{QThread}{QThread class reference} and the \l{Threading and - Concurrent Programming Examples}{threading examples} for demonstrations on - how to use QThread. - - - \section1 QThreadPool and QRunnable: Reusing Threads - - Creating and destroying threads frequently can be expensive. To reduce this - overhead, existing threads can be reused for new tasks. QThreadPool is a - collection of reuseable QThreads. - - To run code in one of a QThreadPool's threads, reimplement QRunnable::run() - and instantiate the subclassed QRunnable. Use QThreadPool::start() to put - the QRunnable in the QThreadPool's run queue. When a thread becomes available, - the code within QRunnable::run() will execute in that thread. - - Each Qt application has a global thread pool, which is accessible through - QThreadPool::globalInstance(). This global thread pool automatically maintains - an optimal number of threads based on the number of cores in the CPU. However, - a separate QThreadPool can be created and managed explicitly. - - - \section1 Qt Concurrent: Using a High-level API - - The \l{Qt Concurrent} module provides high-level functions that deal with some - common parallel computation patterns: map, filter, and reduce. Unlike using - QThread and QRunnable, these functions never require the use of \l{Synchronizing - Threads#Low-Level Synchronization Primitives}{low-level threading primitives} - such as mutexes or semaphores. Instead, they return a QFuture object which can - be used to retrieve the functions' results when they are ready. QFuture can - also be used to query computation progress and to pause/resume/cancel the - computation. For convenience, QFutureWatcher enables interactions with - \l{QFuture}s via signals and slots. - - \l{Qt Concurrent}'s map, filter and reduce algorithms automatically distribute - computation across all available processor cores, so applications written today - will continue to scale when deployed later on a system with more cores. - - This module also provides the QtConcurrent::run() function, which can run any - function in another thread. However, QtConcurrent::run() only supports a subset - of features available to the map, filter and reduce functions. The QFuture - can be used to retrieve the function's return value and to check if the thread - is running. However, a call to QtConcurrent::run() uses one thread only, cannot - be paused/resumed/canceled, and cannot be queried for progress. - - See the \l{Qt Concurrent} module documentation for details on the individual functions. - - - \section1 WorkerScript: Threading in QML - - The WorkerScript QML type lets JavaScript code run in parallel with the GUI - thread. - - Each WorkerScript instance can have one \c{.js} script attached to it. When - WorkerScript::sendMessage() is called, the script will run in a separate thread - (and a separate \l{QQmlContext}{QML context}). When the script finishes - running, it can send a reply back to the GUI thread which will invoke the - WorkerScript::onMessage() signal handler. - - Using a WorkerScript is similar to using a worker QObject that has been moved - to another thread. Data is transferred between threads via signals. - - See the WorkerScript documentation for details on how to implement the script, - and for a list of data types that can be passed between threads. - - - \section1 Choosing an Appropriate Approach - - As demonstrated above, Qt provides different solutions for developing threaded - applications. The right solution for a given application depends on the purpose - of the new thread and the thread's lifetime. Below is a comparison of Qt's - threading technologies, followed by recommended solutions for some example use cases. - - \section2 Comparison of Solutions - - \table - \header - \li Feature - \li QThread - \li QRunnable and QThreadPool - \li QtConcurrent::run() - \li Qt Concurrent (Map, Filter, Reduce) - \li WorkerScript - \row - \li API - \li C++ - \li C++ - \li C++ - \li C++ - \li QML - \row - \li Thread priority can be specified - \li Yes - \li Yes - \li - \li - \li - \row - \li Thread can run an event loop - \li Yes - \li - \li - \li - \li - \row - \li Thread can receive data updates through signals - \li Yes (received by a worker QObject) - \li - \li - \li - \li Yes (received by WorkerScript) - \row - \li Thread can be controlled using signals - \li Yes (received by QThread) - \li - \li - \li Yes (received by QFutureWatcher) - \li - \row - \li Thread can be monitored through a QFuture - \li - \li - \li Partially - \li Yes - \li - \row - \li Built-in ability to pause/resume/cancel - \li - \li - \li - \li Yes - \li - \endtable - - - \section2 Example Use Cases - - \table - \header - \li Lifetime of thread - \li Operation - \li Solution - \row - \li One call - \li Run a new linear function within another thread, optionally with progress - updates during the run. - \li Qt provides different solutions: - \list - \li Place the function in a reimplementation of QThread::run() and - start the QThread. Emit signals to update progress. OR - \li Place the function in a reimplementation of QRunnable::run() and - add the QRunnable to a QThreadPool. Write to a \l{Synchronizing - Threads}{thread-safe variable} to update progress. OR - \li Run the function using QtConcurrent::run(). Write to a \l{Synchronizing - Threads}{thread-safe variable} to update progress. - \endlist - \row - \li One call - \li Run an existing function within another thread and get its return value. - \li Run the function using QtConcurrent::run(). Have a QFutureWatcher emit - the \l{QFutureWatcher::}{finished()} signal when the function has - returned, and call QFutureWatcher::result() to get the function's return - value. - \row - \li One call - \li Perform an operation on all items of a container, using all available - cores. For example, producing thumbnails from a list of images. - \li Use Qt Concurrent's \l{QtConcurrent::}{filter()} function to select - container elements, and the \l{QtConcurrent::}{map()} function to apply - an operation to each element. To fold the output into a single result, - use \l{QtConcurrent::}{filteredReduced()} and - \l{QtConcurrent::}{mappedReduced()} instead. - \row - \li One call/Permanent - \li Perfrom a long computation in a pure QML application, and update the GUI - when the results are ready. - \li Place the computation code in a \c{.js} script and attach it to a - WorkerScript instance. Call \l{WorkerScript::}{sendMessage()} to start the - computation in a new thread. Let the script call WorkerScript::sendMessage() - too, to pass the result back to the GUI thread. Handle the result in - \l{WorkerScript::}{onMessage} and update the GUI there. - \row - \li Permanent - \li Have an object living in another thread that can perform different - tasks upon request and/or can receive new data to work with. - \li Subclass a QObject to create a worker. Instantiate this worker object - and a QThread. Move the worker to the new thread. Send commands or - data to the worker object over queued signal-slot connections. - \row - \li Permanent - \li Repeatedly perform an expensive operation in another thread, where the - thread does not need to receive any signals or events. - \li Write the infinite loop directly within a reimplementation of QThread::run(). - Start the thread without an event loop. Let the thread emit signals to - send data back to the GUI thread. - \endtable -*/ - -/*! - \page threads-synchronizing.html - \title Synchronizing Threads - - \previouspage Multithreading Technologies in Qt - \contentspage Thread Support in Qt - \nextpage Reentrancy and Thread-Safety - - While the purpose of threads is to allow code to run in parallel, - there are times where threads must stop and wait for other - threads. For example, if two threads try to write to the same - variable simultaneously, the result is undefined. The principle of - forcing threads to wait for one another is called \e{mutual exclusion}. - It is a common technique for protecting shared resources such as data. - - Qt provides low-level primitives as well as high-level mechanisms - for synchronizing threads. - - \section1 Low-Level Synchronization Primitives - - QMutex is the basic class for enforcing mutual exclusion. A thread - locks a mutex in order to gain access to a shared resource. If a second - thread tries to lock the mutex while it is already locked, the second - thread will be put to sleep until the first thread completes its task - and unlocks the mutex. - - QReadWriteLock is similar to QMutex, except that it distinguishes - between "read" and "write" access. When a piece of data is not being - written to, it is safe for multiple threads to read from it simultaneously. - A QMutex forces multiple readers to take turns to read shared data, but a - QReadWriteLock allows simultaneous reading, thus improving parallelism. - - QSemaphore is a generalization of QMutex that protects a certain - number of identical resources. In contrast, a QMutex protects - exactly one resource. The \l{Semaphores Example} shows a typical application - of semaphores: synchronizing access to a circular buffer between a producer - and a consumer. - - QWaitCondition synchronizes threads not by enforcing mutual exclusion but by - providing a \e{condition variable}. While the other primitives make threads - wait until a resource is unlocked, QWaitCondition makes threads wait until a - particular condition has been met. To allow the waiting threads to proceed, - call \l{QWaitCondition::wakeOne()}{wakeOne()} to wake one randomly - selected thread or \l{QWaitCondition::wakeAll()}{wakeAll()} to wake them all - simultaneously. The \l{Wait Conditions Example} shows how to solve the - producer-consumer problem using QWaitCondition instead of QSemaphore. |