diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-13 13:22:21 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-13 13:22:21 (GMT) |
commit | f15352c51625688ec445c73125a2e25327377d49 (patch) | |
tree | 0d7d82d8ea8ffeff5cf042cd70af3200ec6f1925 | |
parent | c8c5becc81679eb8a9a0f8baa454bc43fd3cccf9 (diff) | |
parent | 0a74bc2ce91e8c7a10ae54fd0f80814902fa5de9 (diff) | |
download | Qt-f15352c51625688ec445c73125a2e25327377d49.zip Qt-f15352c51625688ec445c73125a2e25327377d49.tar.gz Qt-f15352c51625688ec445c73125a2e25327377d49.tar.bz2 |
Merge commit 'qt/master'
566 files changed, 11989 insertions, 17185 deletions
diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index b5afa18..ff51c91 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -14,6 +14,8 @@ shift 7 LFLAGS="" INCLUDEPATH="" CXXFLAGS="" +MAC_ARCH_CXXFLAGS="" +MAC_ARCH_LFLAGS="" while [ "$#" -gt 0 ]; do PARAM=$1 case $PARAM in @@ -21,6 +23,11 @@ while [ "$#" -gt 0 ]; do LFLAGS="$LFLAGS -framework \"$2\"" shift ;; + -arch) + MAC_ARCH_CXXFLAGS="$MAC_ARCH_CXXFLAGS -arch $2" + MAC_ARCH_LFLAGS="$MAC_ARCH_LFLAGS -arch $2" + shift + ;; -F*|-m*|-x*) LFLAGS="$LFLAGS $PARAM" CXXFLAGS="$CXXFLAGS $PARAM" @@ -53,7 +60,7 @@ test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" cd "$OUTDIR/$TEST" make distclean >/dev/null 2>&1 -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then make @@ -279,7 +279,7 @@ if [ "$COMMERCIAL_USER" = "ask" ]; then if [ "$commercial" = "c" ]; then COMMERCIAL_USER="yes" break - else [ "$commercial" = "o" ]; + elif [ "$commercial" = "o" ]; then COMMERCIAL_USER="no" break fi @@ -668,6 +668,7 @@ CFG_INOTIFY=auto CFG_RPATH=yes CFG_FRAMEWORK=auto CFG_MAC_ARCHS= +MAC_ARCHS_COMMANDLINE= CFG_MAC_DWARF2=auto CFG_MAC_XARCH=auto CFG_MAC_CARBON=yes @@ -2699,8 +2700,9 @@ if [ "$QT_CROSS_COMPILE" = "yes" ]; then fi fi -# check -arch arguments for validity. +# process CFG_MAC_ARCHS if [ "$PLATFORM_MAC" = "yes" ]; then +# check -arch arguments for validity. ALLOWED="x86 ppc x86_64 ppc64 i386" for i in $CFG_MAC_ARCHS do @@ -2712,6 +2714,13 @@ if [ "$PLATFORM_MAC" = "yes" ]; then # replace "i386" with "x86" to support configuring with -arch i386 as an alias for x86. CFG_MAC_ARCHS="${CFG_MAC_ARCHS/i386/x86}" + +# Build commmand line arguments we can pass to the compiler during configure tests +# by prefixing each arch with "-arch". + CFG_MAC_ARCHS_GCC_FORMAT="${CFG_MAC_ARCHS/x86/i386}" + for ARCH in $CFG_MAC_ARCHS_GCC_FORMAT; do + MAC_ARCHS_COMMANDLINE="$MAC_ARCHS_COMMANDLINE -arch $ARCH" + done fi # find the default framework value @@ -4250,7 +4259,7 @@ if [ "$CFG_ZLIB" = "no" ]; then ZLIB_FORCED=yes fi if [ "$CFG_ZLIB" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_ZLIB=system else CFG_ZLIB=yes @@ -4267,7 +4276,7 @@ if [ "$CFG_JPEG" = "auto" ]; then fi # detect jpeg if [ "$CFG_LIBJPEG" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_LIBJPEG=system else CFG_LIBJPEG=qt @@ -4294,7 +4303,7 @@ fi # detect tiff if [ "$CFG_LIBTIFF" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_LIBTIFF=system else CFG_LIBTIFF=qt @@ -4311,7 +4320,7 @@ if [ "$CFG_MNG" = "auto" ]; then fi # detect mng if [ "$CFG_LIBMNG" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_LIBMNG=system else CFG_LIBMNG=qt @@ -4320,7 +4329,7 @@ fi # detect png if [ "$CFG_LIBPNG" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_LIBPNG=system else CFG_LIBPNG=qt @@ -4359,13 +4368,13 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do QT_CFLAGS_MYSQL="" fi else - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql_r "MySQL (thread-safe)" $QT_LFLAGS_MYSQL_R $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then QMakeVar add CONFIG use_libmysqlclient_r if [ "$CFG_SQL_mysql" = "auto" ]; then CFG_SQL_mysql=plugin fi QT_LFLAGS_MYSQL="$QT_LFLAGS_MYSQL_R" - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS; then + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mysql "MySQL (thread-unsafe)" $QT_LFLAGS_MYSQL $L_FLAGS $QT_CFLAGS_MYSQL $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_mysql" = "auto" ]; then CFG_SQL_mysql=plugin fi @@ -4394,7 +4403,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do fi [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL" [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL" - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/psql "PostgreSQL" $QT_LFLAGS_PSQL $L_FLAGS $QT_CFLAGS_PSQL $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_psql" = "auto" ]; then CFG_SQL_psql=plugin fi @@ -4415,7 +4424,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; odbc) if [ "$CFG_SQL_odbc" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_odbc" = "auto" ]; then CFG_SQL_odbc=plugin fi @@ -4434,7 +4443,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; oci) if [ "$CFG_SQL_oci" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/oci "OCI" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_oci" = "auto" ]; then CFG_SQL_oci=plugin fi @@ -4453,7 +4462,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; tds) if [ "$CFG_SQL_tds" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_tds" = "auto" ]; then CFG_SQL_tds=plugin fi @@ -4472,7 +4481,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; db2) if [ "$CFG_SQL_db2" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/db2 "DB2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_db2" = "auto" ]; then CFG_SQL_db2=plugin fi @@ -4491,7 +4500,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; ibase) if [ "$CFG_SQL_ibase" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ibase "InterBase" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_ibase" = "auto" ]; then CFG_SQL_ibase=plugin fi @@ -4510,7 +4519,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; sqlite2) if [ "$CFG_SQL_sqlite2" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite2 "SQLite2" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_sqlite2" = "auto" ]; then CFG_SQL_sqlite2=plugin fi @@ -4535,7 +4544,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null` QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null` fi - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_SQL_sqlite" = "auto" ]; then CFG_SQL_sqlite=plugin fi @@ -4572,7 +4581,7 @@ done # auto-detect NIS support if [ "$CFG_NIS" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/nis "NIS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_NIS=yes else if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then @@ -4589,7 +4598,7 @@ fi # auto-detect CUPS support if [ "$CFG_CUPS" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/cups "Cups" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_CUPS=yes else if [ "$CFG_CUPS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then @@ -4608,9 +4617,9 @@ fi if [ "$CFG_ICONV" != "no" ]; then if [ "$PLATFORM_QWS" = "yes" ]; then CFG_ICONV=no - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS; then + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_ICONV=yes - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS; then + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/gnu-libiconv" "GNU libiconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_ICONV=gnu else if [ "$CFG_ICONV" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then @@ -4631,7 +4640,7 @@ if [ "$CFG_DBUS" != "no" ]; then QT_CFLAGS_DBUS=`$PKG_CONFIG --cflags dbus-1 2>/dev/null` QT_LIBS_DBUS=`$PKG_CONFIG --libs dbus-1 2>/dev/null` fi - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/dbus "D-Bus" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DBUS $QT_LIBS_DBUS $MAC_ARCHS_COMMANDLINE; then [ "$CFG_DBUS" = "auto" ] && CFG_DBUS=yes QMakeVar set QT_CFLAGS_DBUS "$QT_CFLAGS_DBUS" QMakeVar set QT_LIBS_DBUS "$QT_LIBS_DBUS" @@ -4664,7 +4673,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then QT_CFLAGS_GLIB=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0 2>/dev/null` QT_LIBS_GLIB=`$PKG_CONFIG --libs glib-2.0 gthread-2.0 2>/dev/null` fi - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB $X11TESTS_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/glib "Glib" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_GLIB $QT_LIBS_GLIB $X11TESTS_FLAGS ; then CFG_GLIB=yes QMakeVar set QT_CFLAGS_GLIB "$QT_CFLAGS_GLIB" QMakeVar set QT_LIBS_GLIB "$QT_LIBS_GLIB" @@ -5153,6 +5162,9 @@ if [ "$PLATFORM_QWS" = "yes" ]; then QMakeVar set QT_CFLAGS_DIRECTFB "$QT_CFLAGS_DIRECTFB" QMakeVar set QT_LIBS_DIRECTFB "$QT_LIBS_DIRECTFB" fi + if [ "$CFG_QT3SUPPORT" = "yes" ]; then + QMakeVar set QT_DEFINES_DIRECTFB "QT3_SUPPORT" + fi if ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qws/directfb "DirectFB" $L_FLAGS $I_FLAGS $l_FLAGS $QT_CFLAGS_DIRECTFB $QT_LIBS_DIRECTFB; then echo "The DirectFB screen driver functionality test failed!" @@ -5191,7 +5203,7 @@ fi # QWS [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE" [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no if [ "$CFG_LIBFREETYPE" = "auto" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS ; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_LIBFREETYPE=system else CFG_LIBFREETYPE=yes @@ -5308,7 +5320,7 @@ fi # find if the platform supports IPv6 if [ "$CFG_IPV6" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then CFG_IPV6=yes else if [ "$CFG_IPV6" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then @@ -5439,7 +5451,7 @@ fi # detect OpenSSL if [ "$CFG_OPENSSL" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_ARCHS_COMMANDLINE; then if [ "$CFG_OPENSSL" = "auto" ]; then CFG_OPENSSL=yes fi @@ -6007,10 +6019,11 @@ if [ "$CFG_EXCEPTIONS" = "no" ]; then QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off" fi -# On Mac, set the minimum deployment target using Xarch when that is supported (10.5 and up). -# On 10.4 the deployment version is set to 10.3 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET env. variable -# "-cocoa" on the command line means Cocoa is used in 32-bit mode also, in this case fall back on -# QMAKE_MACOSX_DEPLOYMENT_TARGET which will be set to 10.5. +# On Mac, set the minimum deployment target for the different architechtures +# using the Xarch compiler option when supported (10.5 and up). On 10.4 the +# deployment version is set to 10.3 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET +# env. variable. "-cocoa" on the command line means Cocoa is used in 32-bit mode also, +# in this case fall back on QMAKE_MACOSX_DEPLOYMENT_TARGET which will be set to 10.5. if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] && [ "$COMMANDLINE_MAC_COCOA" != "yes" ]; then if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" diff --git a/demos/spreadsheet/spreadsheet.cpp b/demos/spreadsheet/spreadsheet.cpp index 742855e..d740aee 100644 --- a/demos/spreadsheet/spreadsheet.cpp +++ b/demos/spreadsheet/spreadsheet.cpp @@ -481,7 +481,7 @@ void SpreadSheet::setupContents() table->setItem(3, 0, new SpreadSheetItem("Lunch")); table->setItem(4, 0, new SpreadSheetItem("Flight (LA)")); table->setItem(5, 0, new SpreadSheetItem("Taxi")); - table->setItem(6, 0, new SpreadSheetItem("Diinner")); + table->setItem(6, 0, new SpreadSheetItem("Dinner")); table->setItem(7, 0, new SpreadSheetItem("Hotel")); table->setItem(8, 0, new SpreadSheetItem("Flight (Oslo)")); table->setItem(9, 0, new SpreadSheetItem("Total:")); diff --git a/doc/src/datastreamformat.qdoc b/doc/src/datastreamformat.qdoc index 3c651fb..15ac062 100644 --- a/doc/src/datastreamformat.qdoc +++ b/doc/src/datastreamformat.qdoc @@ -69,6 +69,10 @@ the application happens to be running on. \table + \row \o bool + \o \list + \o boolean + \endlist \row \o qint8 \o \list \o signed byte @@ -297,6 +301,10 @@ \o \list \o Milliseconds since midnight (quint32) \endlist + \row \o QUrl + \o \list + \o Holds an URL (QString) + \endlist \row \o QVariant \o \list \o The type of the data (quint32) diff --git a/doc/src/designer-manual.qdoc b/doc/src/designer-manual.qdoc index 97713b1..2706182 100644 --- a/doc/src/designer-manual.qdoc +++ b/doc/src/designer-manual.qdoc @@ -344,10 +344,14 @@ of a QLineEdit or the width and height of item view widgets. This is where the widget size constraints -- \l{QWidget::minimumSize()}{minimumSize} and \l{QWidget::maximumSize()}{maximumSize} constraints come into play. These - are properties you can set in the property editor. Alternatively, to use - the current size as a size constraint value, choose one of the - \gui{Size Constraint} options from the widget's context menu. The layout - will then ensure that those constraints are met. + are properties you can set in the property editor. For example, to override + the default \l{QWidget::}{sizeHint()}, simply set + \l{QWidget::minimumSize()}{minimumSize} and \l{QWidget::maximumSize()} + {maximumSize} to the same value. Alternatively, to use the current size as + a size constraint value, choose one of the \gui{Size Constraint} options + from the widget's context menu. The layout will then ensure that those + constraints are met. To control the size of your widgets via code, you can + reimplement \l{QWidget::}{sizeHint()} in your code. The screenshot below shows the breakdown of a basic user interface designed using a grid. The coordinates on the screenshot show the position of each diff --git a/doc/src/examples/fancybrowser.qdoc b/doc/src/examples/fancybrowser.qdoc index 9001c20..631aff9 100644 --- a/doc/src/examples/fancybrowser.qdoc +++ b/doc/src/examples/fancybrowser.qdoc @@ -40,12 +40,109 @@ ****************************************************************************/ /*! - \example webkit/fancybrowser - \title Fancy Browser Example + \example webkit/fancybrowser + \title Fancy Browser Example The Fancy Browser example shows how to use jQuery with QtWebKit to - make a web browser with some special effects and content manipulation. + create a web browser with special effects and content + manipulation. \image fancybrowser-example.png + The application makes use of QWebFrame::evaluateJavaScript to + evaluate the jQuery JavaScript code. A QMainWindow with a QWebView + as central widget builds up the browser itself. + + \section1 MainWindow Class Definition + + The \c MainWindow class inherits QMainWindow. It implements a number of + slots to perform actions on both the application and on the web content. + + \snippet examples/webkit/fancybrowser/mainwindow.h 1 + + We also declare a QString that contains the jQuery, a QWebView + that displays the web content, and a QLineEdit that acts as the + address bar. + + \section1 MainWindow Class Implementation + + We start by implementing the constructor. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 1 + + The first part of the constructor sets the value of \c progress to + 0. This value will be used later in the code to visualize the + loading of a webpage. + + Next, the jQuery library is loaded using a QFile and reading the file + content. The jQuery library is a JavaScript library that provides different + functions for manipulating HTML. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 2 + + The second part of the constructor creates a QWebView and connects + slots to the views signals. Furthermore, we create a QLineEdit as + the browsers address bar. We then set the horizontal QSizePolicy + to fill the available area in the browser at all times. We add the + QLineEdit to a QToolbar together with a set of navigation actions + from QWebView::pageAction. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 3 + + The third and last part of the constructor implements two QMenus and assigns + a set of actions to them. The last line sets the QWebView as the central + widget in the QMainWindow. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 4 + + When the page is loaded, \c adjustLocation() updates the address + bar; \c adjustLocation() is triggered by the \c loadFinished() + signal in QWebView. In \c changeLocation() we create a QUrl + object, and then use it to load the page into the QWebView. When + the new web page has finished loading, \c adjustLocation() will be + run once more to update the address bar. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 5 + + \c adjustTitle() sets the window title and displays the loading + progress. This slot is triggered by the \c titleChanged() signal + in QWebView. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 6 + + When a web page has loaded, \c finishLoading() is triggered by the + \c loadFinished() signal in QWebView. \c finishLoading() then updates the + progress in the title bar and calls \c evaluateJavaScript() to evaluate the + jQuery library. This evaluates the JavaScript against the current web page. + What that means is that the JavaScript can be viewed as part of the content + loaded into the QWebView, and therefore needs to be loaded every time a new + page is loaded. Once the jQuery library is loaded, we can start executing + the different jQuery functions in the browser. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 7 + + The first jQuery-based function, \c highlightAllLinks(), is designed to + highlight all links in the current webpage. The JavaScript code looks + for web elements named \e {a}, which is the tag for a hyperlink. + For each such element, the background color is set to be yellow by + using CSS. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 8 + + The \c rotateImages() function rotates the images on the current + web page. Webkit supports CSS transforms and this JavaScript code + looks up all \e {img} elements and rotates the images 180 degrees + and then back again. + + \snippet examples/webkit/fancybrowser/mainwindow.cpp 9 + + The remaining four methods remove different elements from the current web + page. \c removeGifImages() removes all Gif images on the page by looking up + the \e {src} attribute of all the elements on the web page. Any element with + a \e {gif} file as its source is removed. \c removeInlineFrames() removes all + \e {iframe} or inline elements. \c removeObjectElements() removes all + \e {object} elements, and \c removeEmbeddedElements() removes any elements + such as plugins embedded on the page using the \e {embed} tag. + */ + diff --git a/doc/src/examples/flowlayout.qdoc b/doc/src/examples/flowlayout.qdoc index 5fdafe2..3e7ec22 100644 --- a/doc/src/examples/flowlayout.qdoc +++ b/doc/src/examples/flowlayout.qdoc @@ -53,7 +53,7 @@ The Flowlayout class mainly uses QLayout and QWidgetItem, while the Window uses QWidget and QLabel. We will only document the definition - and implementation of \cFlowLayout below. + and implementation of \c FlowLayout below. \section1 FlowLayout Class Definition @@ -156,4 +156,4 @@ the parent is a QLayout, will be determined by querying the spacing of the parent layout. -*/
\ No newline at end of file +*/ diff --git a/doc/src/exportedfunctions.qdoc b/doc/src/exportedfunctions.qdoc index f67950c..f051ddc 100644 --- a/doc/src/exportedfunctions.qdoc +++ b/doc/src/exportedfunctions.qdoc @@ -129,6 +129,9 @@ on Mac OS X or be part of the main window. This feature is on by default. + In Qt 4.6, this is equivalent to + \c { QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar); }. + \section1 void qt_mac_set_press_and_hold_context(bool \e{enable}) Turns emulation of the right mouse button by clicking and holding diff --git a/doc/src/porting4.qdoc b/doc/src/porting4.qdoc index c8a9e2b..b93e139 100644 --- a/doc/src/porting4.qdoc +++ b/doc/src/porting4.qdoc @@ -457,6 +457,7 @@ \row \o QToolButton::offIconSet \o Use the \l{QIcon::Off}{off component} of QAbstractButton::icon instead. \row \o QToolButton::onIconSet \o Use the \l{QIcon::On}{on component} of QAbstractButton::icon instead. \row \o QWidget::microFocusHint \o N/A + \row \o QMimeSource::serialNumber () \o N/A \endtable \omit diff --git a/doc/src/properties.qdoc b/doc/src/properties.qdoc index 0775b12..d934f13 100644 --- a/doc/src/properties.qdoc +++ b/doc/src/properties.qdoc @@ -89,7 +89,12 @@ and QWidget::setCursor(), and it also has a \c RESET function, QWidget::unsetCursor(), since no call to QWidget::setCursor() can mean \e {reset to the context specific cursor}. The \c RESET - function musrt return void and take no parameters. + function must return void and take no parameters. + + \o A \c NOTIFY signal is optional. If defined, the signal will be + emitted whenever the value of the property changes. The signal must + take one parameter, which must be of the same type as the property; the + parameter will take the new value of the property. \o The \c DESIGNABLE attribute indicates whether the property should be visible in the property editor of GUI design tool (e.g., diff --git a/doc/src/qmake-manual.qdoc b/doc/src/qmake-manual.qdoc index 39581a2..172bc60 100644 --- a/doc/src/qmake-manual.qdoc +++ b/doc/src/qmake-manual.qdoc @@ -932,6 +932,7 @@ \o \l{qmake Variable Reference#QT}{QT} \o \l{qmake Variable Reference#RCC_DIR}{RCC_DIR} \o \l{qmake Variable Reference#REQUIRES}{REQUIRES} + \o \l{qmake Variable Reference#RESOURCES}{RESOURCES} \o \l{qmake Variable Reference#SOURCES}{SOURCES} \o \l{qmake Variable Reference#SUBDIRS}{SUBDIRS} \o \l{qmake Variable Reference#TARGET}{TARGET} @@ -2420,6 +2421,12 @@ This is mainly used in Qt's build system for building the examples. + \section1 RESOURCES + + This variable contains the name of the resource collection file (qrc) + for the application. Further information about the resource collection + file can be found at \l{The Qt Resource System}. + \section1 RES_FILE This variable contains the name of the resource file for the application. diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index 9ea6b52..fc4310b 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -146,10 +146,24 @@ widgets stay non-native unless specifically set by the Qt::WA_NativeWindow attribute. - \value AA_MacPluginApplication Stops the a Qt mac application from doing + \value AA_MacPluginApplication Stops the Qt mac application from doing specific initializations that do not necessarily make sense when using Qt to author a plugin. This includes avoiding loading our nib for the main - menu and not taking possession of the native menu bar. + menu and not taking possession of the native menu bar. When setting this + attribute to true will also set the AA_DontUseNativeMenuBar attribute + to true. + + \value AA_DontUseNativeMenuBar All menubars created while this attribute is + set to true won't be used as a native menubar (e.g, the menubar at + the top of the main screen on Mac OS X or at the bottom in Windows CE). + + \value AA_MacDontSwapCtrlAndMeta On Mac OS X by default, Qt swaps the + Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt + sends Meta and whenever Meta is pressed Control is sent. When this + attribute is true, Qt will not do the flip. QKeySequence::StandardShortcuts + will also flip accordingly (i.e., QKeySequence::Copy will be + Command+C on the keyboard regardless of the value set, though what is output for + QKeySequence::toString(QKeySequence::PortableText) will be different). \omitvalue AA_AttributeCount */ diff --git a/doc/src/qset.qdoc b/doc/src/qset.qdoc index 9795123..2d12661 100644 --- a/doc/src/qset.qdoc +++ b/doc/src/qset.qdoc @@ -447,7 +447,7 @@ \fn QSet::const_iterator QSet::insert(const T &value) Inserts item \a value into the set, if \a value isn't already - in the set, and returns an iterator positioned at the inserted + in the set, and returns an iterator pointing at the inserted item. \sa operator<<(), remove(), contains() diff --git a/doc/src/snippets/code/doc_src_properties.qdoc b/doc/src/snippets/code/doc_src_properties.qdoc index ba7f79b..377cc9c 100644 --- a/doc/src/snippets/code/doc_src_properties.qdoc +++ b/doc/src/snippets/code/doc_src_properties.qdoc @@ -3,6 +3,7 @@ Q_PROPERTY(type name READ getFunction [WRITE setFunction] [RESET resetFunction] + [NOTIFY notifySignal] [DESIGNABLE bool] [SCRIPTABLE bool] [STORED bool] diff --git a/doc/src/snippets/sqldatabase/sqldatabase.cpp b/doc/src/snippets/sqldatabase/sqldatabase.cpp index ae176ac..06afa0c 100644 --- a/doc/src/snippets/sqldatabase/sqldatabase.cpp +++ b/doc/src/snippets/sqldatabase/sqldatabase.cpp @@ -524,7 +524,7 @@ protected: bool fetchLast() { return false; } int size() { return 0; } int numRowsAffected() { return 0; } - QSqlRecord record() { return QSqlRecord(); } + QSqlRecord record() const { return QSqlRecord(); } }; //! [47] diff --git a/examples/assistant/simpletextviewer/mainwindow.cpp b/examples/assistant/simpletextviewer/mainwindow.cpp index cc2f3c0..f7c7098 100644 --- a/examples/assistant/simpletextviewer/mainwindow.cpp +++ b/examples/assistant/simpletextviewer/mainwindow.cpp @@ -101,11 +101,11 @@ void MainWindow::open() void MainWindow::createActions() { assistantAct = new QAction(tr("Help Contents"), this); - assistantAct->setShortcut(tr("F1")); + assistantAct->setShortcuts(QKeySequence::HelpContents); connect(assistantAct, SIGNAL(triggered()), this, SLOT(assistant())); openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); clearAct = new QAction(tr("&Clear"), this); @@ -113,7 +113,7 @@ void MainWindow::createActions() connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/draganddrop/puzzle/mainwindow.cpp b/examples/draganddrop/puzzle/mainwindow.cpp index f998882..9035442 100644 --- a/examples/draganddrop/puzzle/mainwindow.cpp +++ b/examples/draganddrop/puzzle/mainwindow.cpp @@ -120,10 +120,10 @@ void MainWindow::setupMenus() QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit")); - exitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); diff --git a/examples/graphicsview/diagramscene/mainwindow.cpp b/examples/graphicsview/diagramscene/mainwindow.cpp index b536a7a..78fac30 100644 --- a/examples/graphicsview/diagramscene/mainwindow.cpp +++ b/examples/graphicsview/diagramscene/mainwindow.cpp @@ -401,7 +401,7 @@ void MainWindow::createActions() this, SLOT(deleteItem())); exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+X")); + exitAction->setShortcuts(QKeySequence::Quit); exitAction->setStatusTip(tr("Quit Scenediagram example")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); diff --git a/examples/help/simpletextviewer/mainwindow.cpp b/examples/help/simpletextviewer/mainwindow.cpp index fc9af58..33092ca 100644 --- a/examples/help/simpletextviewer/mainwindow.cpp +++ b/examples/help/simpletextviewer/mainwindow.cpp @@ -102,12 +102,12 @@ void MainWindow::open() void MainWindow::createActions() { assistantAct = new QAction(tr("Help Contents"), this); - assistantAct->setShortcut(tr("F1")); + assistantAct->setShortcut(QKeySequence::HelpContents); connect(assistantAct, SIGNAL(triggered()), this, SLOT(showDocumentation())); //! [4] openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcut(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); clearAct = new QAction(tr("&Clear"), this); @@ -115,7 +115,7 @@ void MainWindow::createActions() connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/itemviews/chart/mainwindow.cpp b/examples/itemviews/chart/mainwindow.cpp index 208a465..d065558 100644 --- a/examples/itemviews/chart/mainwindow.cpp +++ b/examples/itemviews/chart/mainwindow.cpp @@ -48,11 +48,11 @@ MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); QAction *saveAction = fileMenu->addAction(tr("&Save As...")); - saveAction->setShortcut(QKeySequence(tr("Ctrl+S"))); + saveAction->setShortcuts(QKeySequence::SaveAs); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + quitAction->setShortcuts(QKeySequence::Quit); setupModel(); setupViews(); diff --git a/examples/itemviews/pixelator/mainwindow.cpp b/examples/itemviews/pixelator/mainwindow.cpp index a2b98cf..80cfc5c 100644 --- a/examples/itemviews/pixelator/mainwindow.cpp +++ b/examples/itemviews/pixelator/mainwindow.cpp @@ -79,14 +79,14 @@ MainWindow::MainWindow() QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); printAction = fileMenu->addAction(tr("&Print...")); printAction->setEnabled(false); - printAction->setShortcut(QKeySequence(tr("Ctrl+P"))); + printAction->setShortcut(QKeySequence::Print); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + quitAction->setShortcuts(QKeySequence::Quit); QMenu *helpMenu = new QMenu(tr("&Help"), this); QAction *aboutAction = helpMenu->addAction(tr("&About")); diff --git a/examples/itemviews/puzzle/mainwindow.cpp b/examples/itemviews/puzzle/mainwindow.cpp index c6088f6..a5ba236 100644 --- a/examples/itemviews/puzzle/mainwindow.cpp +++ b/examples/itemviews/puzzle/mainwindow.cpp @@ -107,10 +107,10 @@ void MainWindow::setupMenus() QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit")); - exitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); diff --git a/examples/itemviews/simpledommodel/mainwindow.cpp b/examples/itemviews/simpledommodel/mainwindow.cpp index ac96899..73626b1 100644 --- a/examples/itemviews/simpledommodel/mainwindow.cpp +++ b/examples/itemviews/simpledommodel/mainwindow.cpp @@ -50,9 +50,9 @@ MainWindow::MainWindow() : QMainWindow(), model(0) { fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), - QKeySequence(tr("Ctrl+O"))); + QKeySequence::Open); fileMenu->addAction(tr("E&xit"), this, SLOT(close()), - QKeySequence(tr("Ctrl+Q"))); + QKeySequence::Quit); model = new DomModel(QDomDocument(), this); view = new QTreeView(this); diff --git a/examples/linguist/arrowpad/mainwindow.cpp b/examples/linguist/arrowpad/mainwindow.cpp index a167cc2..37b9362 100644 --- a/examples/linguist/arrowpad/mainwindow.cpp +++ b/examples/linguist/arrowpad/mainwindow.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow() //! [1] exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); //! [1] diff --git a/examples/mainwindows/application/mainwindow.cpp b/examples/mainwindows/application/mainwindow.cpp index 9a22254..cf36332 100644 --- a/examples/mainwindows/application/mainwindow.cpp +++ b/examples/mainwindows/application/mainwindow.cpp @@ -174,7 +174,7 @@ void MainWindow::createActions() //! [20] exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); //! [20] exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); diff --git a/examples/mainwindows/dockwidgets/mainwindow.cpp b/examples/mainwindows/dockwidgets/mainwindow.cpp index 1683034..4ccd2f1 100644 --- a/examples/mainwindows/dockwidgets/mainwindow.cpp +++ b/examples/mainwindows/dockwidgets/mainwindow.cpp @@ -242,7 +242,7 @@ void MainWindow::createActions() connect(undoAct, SIGNAL(triggered()), this, SLOT(undo())); quitAct = new QAction(tr("&Quit"), this); - quitAct->setShortcut(tr("Ctrl+Q")); + quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp index 49f9b21..e6e3e6e 100644 --- a/examples/mainwindows/mdi/mainwindow.cpp +++ b/examples/mainwindows/mdi/mainwindow.cpp @@ -235,7 +235,7 @@ void MainWindow::createActions() //! [0] exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); //! [0] diff --git a/examples/mainwindows/menus/mainwindow.cpp b/examples/mainwindows/menus/mainwindow.cpp index 4c10f73..08a3c31 100644 --- a/examples/mainwindows/menus/mainwindow.cpp +++ b/examples/mainwindows/menus/mainwindow.cpp @@ -219,7 +219,7 @@ void MainWindow::createActions() connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); @@ -240,7 +240,7 @@ void MainWindow::createActions() connect(cutAct, SIGNAL(triggered()), this, SLOT(cut())); copyAct = new QAction(tr("&Copy"), this); - copyAct->setShortcut(tr("Ctrl+C")); + copyAct->setShortcuts(QKeySequence::Copy); copyAct->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), this, SLOT(copy())); @@ -253,7 +253,7 @@ void MainWindow::createActions() boldAct = new QAction(tr("&Bold"), this); boldAct->setCheckable(true); - boldAct->setShortcut(tr("Ctrl+B")); + boldAct->setShortcut(QKeySequence::Bold); boldAct->setStatusTip(tr("Make the text bold")); connect(boldAct, SIGNAL(triggered()), this, SLOT(bold())); @@ -263,7 +263,7 @@ void MainWindow::createActions() italicAct = new QAction(tr("&Italic"), this); italicAct->setCheckable(true); - italicAct->setShortcut(tr("Ctrl+I")); + italicAct->setShortcut(QKeySequence::Italic); italicAct->setStatusTip(tr("Make the text italic")); connect(italicAct, SIGNAL(triggered()), this, SLOT(italic())); diff --git a/examples/mainwindows/recentfiles/mainwindow.cpp b/examples/mainwindows/recentfiles/mainwindow.cpp index c8c2f88..5746863 100644 --- a/examples/mainwindows/recentfiles/mainwindow.cpp +++ b/examples/mainwindows/recentfiles/mainwindow.cpp @@ -132,7 +132,7 @@ void MainWindow::createActions() } exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); diff --git a/examples/mainwindows/sdi/mainwindow.cpp b/examples/mainwindows/sdi/mainwindow.cpp index 61d63b3..e7e05ee 100644 --- a/examples/mainwindows/sdi/mainwindow.cpp +++ b/examples/mainwindows/sdi/mainwindow.cpp @@ -180,7 +180,7 @@ void MainWindow::createActions() connect(closeAct, SIGNAL(triggered()), this, SLOT(close())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); diff --git a/examples/opengl/grabber/mainwindow.cpp b/examples/opengl/grabber/mainwindow.cpp index 7e878f9..9e27023 100644 --- a/examples/opengl/grabber/mainwindow.cpp +++ b/examples/opengl/grabber/mainwindow.cpp @@ -136,7 +136,7 @@ void MainWindow::createActions() connect(clearPixmapAct, SIGNAL(triggered()), this, SLOT(clearPixmap())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro index 7459456..3168743 100644 --- a/examples/opengl/hellogl_es/hellogl_es.pro +++ b/examples/opengl/hellogl_es/hellogl_es.pro @@ -20,11 +20,13 @@ HEADERS += bubble.h RESOURCES += texture.qrc QT += opengl -contains(QT_CONFIG,opengles1) { - QMAKE_LIBS += "libGLES_CM.lib" -} -contains(QT_CONFIG,opengles1cl) { - QMAKE_LIBS += "libGLES_CL.lib" +wince*:{ + contains(QT_CONFIG,opengles1) { + QMAKE_LIBS += "libGLES_CM.lib" + } + contains(QT_CONFIG,opengles1cl) { + QMAKE_LIBS += "libGLES_CL.lib" + } } # install diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro index 92b4224..d5ad4b8 100644 --- a/examples/opengl/hellogl_es2/hellogl_es2.pro +++ b/examples/opengl/hellogl_es2/hellogl_es2.pro @@ -25,3 +25,9 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es2.pro sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl_es2 INSTALLS += target sources + + +wince*: { + QMAKE_LIBS += "libGLESv2.lib" + +}
\ No newline at end of file diff --git a/examples/painting/svgviewer/mainwindow.cpp b/examples/painting/svgviewer/mainwindow.cpp index 22393eb..64f35ed 100644 --- a/examples/painting/svgviewer/mainwindow.cpp +++ b/examples/painting/svgviewer/mainwindow.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow() QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + quitAction->setShortcuts(QKeySequence::Quit); menuBar()->addMenu(fileMenu); diff --git a/examples/phonon/README b/examples/phonon/README index d0f4462..51213cb 100644 --- a/examples/phonon/README +++ b/examples/phonon/README @@ -1,4 +1,4 @@ -Qt usese the Phonon cross-platform multimedia framework to play common +Qt uses the Phonon cross-platform multimedia framework to play common multimedia formats. Applications can be written to take advantage of the native multimedia diff --git a/examples/phonon/musicplayer/mainwindow.cpp b/examples/phonon/musicplayer/mainwindow.cpp index f50a2bd..30c6d05 100644 --- a/examples/phonon/musicplayer/mainwindow.cpp +++ b/examples/phonon/musicplayer/mainwindow.cpp @@ -261,7 +261,7 @@ void MainWindow::setupActions() addFilesAction = new QAction(tr("Add &Files"), this); addFilesAction->setShortcut(tr("Ctrl+F")); exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+X")); + exitAction->setShortcuts(QKeySequence::Quit); aboutAction = new QAction(tr("A&bout"), this); aboutAction->setShortcut(tr("Ctrl+B")); aboutQtAction = new QAction(tr("About &Qt"), this); diff --git a/examples/richtext/orderform/mainwindow.cpp b/examples/richtext/orderform/mainwindow.cpp index e5cffe3..7e460b7 100644 --- a/examples/richtext/orderform/mainwindow.cpp +++ b/examples/richtext/orderform/mainwindow.cpp @@ -49,12 +49,12 @@ MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *newAction = fileMenu->addAction(tr("&New...")); - newAction->setShortcut(tr("Ctrl+N")); + newAction->setShortcuts(QKeySequence::New); printAction = fileMenu->addAction(tr("&Print..."), this, SLOT(printFile())); - printAction->setShortcut(tr("Ctrl+P")); + printAction->setShortcuts(QKeySequence::Print); printAction->setEnabled(false); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(tr("Ctrl+Q")); + quitAction->setShortcuts(QKeySequence::Quit); menuBar()->addMenu(fileMenu); letters = new QTabWidget; diff --git a/examples/richtext/syntaxhighlighter/mainwindow.cpp b/examples/richtext/syntaxhighlighter/mainwindow.cpp index a6312f9..0d1b41f 100644 --- a/examples/richtext/syntaxhighlighter/mainwindow.cpp +++ b/examples/richtext/syntaxhighlighter/mainwindow.cpp @@ -110,14 +110,13 @@ void MainWindow::setupFileMenu() menuBar()->addMenu(fileMenu); fileMenu->addAction(tr("&New"), this, SLOT(newFile()), - QKeySequence(tr("Ctrl+N", - "File|New"))); + QKeySequence::New); + fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), - QKeySequence(tr("Ctrl+O", - "File|Open"))); + QKeySequence::Open); + fileMenu->addAction(tr("E&xit"), qApp, SLOT(quit()), - QKeySequence(tr("Ctrl+Q", - "File|Exit"))); + QKeySequence::Quit); } void MainWindow::setupHelpMenu() diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp index 67825d6..5bf4cb9 100644 --- a/examples/sql/masterdetail/mainwindow.cpp +++ b/examples/sql/masterdetail/mainwindow.cpp @@ -362,7 +362,7 @@ void MainWindow::createMenuBar() addAction->setShortcut(tr("Ctrl+A")); deleteAction->setShortcut(tr("Ctrl+D")); - quitAction->setShortcut(tr("Ctrl+Q")); + quitAction->setShortcuts(QKeySequence::Quit); QMenu *fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(addAction); diff --git a/examples/tools/codecs/mainwindow.cpp b/examples/tools/codecs/mainwindow.cpp index 1e6fa69..5d3b7ac 100644 --- a/examples/tools/codecs/mainwindow.cpp +++ b/examples/tools/codecs/mainwindow.cpp @@ -156,7 +156,7 @@ void MainWindow::findCodecs() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); foreach (QTextCodec *codec, codecs) { @@ -169,7 +169,7 @@ void MainWindow::createActions() } exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/tools/plugandpaint/mainwindow.cpp b/examples/tools/plugandpaint/mainwindow.cpp index 224bc71..f61359b 100644 --- a/examples/tools/plugandpaint/mainwindow.cpp +++ b/examples/tools/plugandpaint/mainwindow.cpp @@ -179,15 +179,15 @@ void MainWindow::aboutPlugins() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); brushColorAct = new QAction(tr("&Brush Color..."), this); diff --git a/examples/tools/settingseditor/mainwindow.cpp b/examples/tools/settingseditor/mainwindow.cpp index 0f48a5c..0321b55 100644 --- a/examples/tools/settingseditor/mainwindow.cpp +++ b/examples/tools/settingseditor/mainwindow.cpp @@ -122,7 +122,7 @@ void MainWindow::about() void MainWindow::createActions() { openSettingsAct = new QAction(tr("&Open Application Settings..."), this); - openSettingsAct->setShortcut(tr("Ctrl+O")); + openSettingsAct->setShortcuts(QKeySequence::Open); connect(openSettingsAct, SIGNAL(triggered()), this, SLOT(openSettings())); openIniFileAct = new QAction(tr("Open I&NI File..."), this); @@ -146,7 +146,7 @@ void MainWindow::createActions() connect(refreshAct, SIGNAL(triggered()), settingsTree, SLOT(refresh())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); autoRefreshAct = new QAction(tr("&Auto-Refresh"), this); diff --git a/examples/tools/undoframework/mainwindow.cpp b/examples/tools/undoframework/mainwindow.cpp index f912ff2..bf0aa41 100644 --- a/examples/tools/undoframework/mainwindow.cpp +++ b/examples/tools/undoframework/mainwindow.cpp @@ -101,16 +101,14 @@ void MainWindow::createActions() //! [5] undoAction = undoStack->createUndoAction(this, tr("&Undo")); - undoAction->setShortcut(tr("Ctrl+Z")); + undoAction->setShortcuts(QKeySequence::Undo); redoAction = undoStack->createRedoAction(this, tr("&Redo")); - QList<QKeySequence> redoShortcuts; - redoShortcuts << tr("Ctrl+Y") << tr("Shift+Ctrl+Z"); - redoAction->setShortcuts(redoShortcuts); + redoAction->setShortcuts(QKeySequence::Redo); //! [5] exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+Q")); + exitAction->setShortcuts(QKeySequence::Quit); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); aboutAction = new QAction(tr("&About"), this); diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index bf61f9c..e24f6cf 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -43,6 +43,8 @@ #include <QtWebKit> #include "mainwindow.h" +//! [1] + MainWindow::MainWindow() { progress = 0; @@ -52,7 +54,9 @@ MainWindow::MainWindow() file.open(QIODevice::ReadOnly); jQuery = file.readAll(); file.close(); +//! [1] +//! [2] view = new QWebView(this); view->load(QUrl("http://www.google.com/ncr")); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); @@ -70,7 +74,9 @@ MainWindow::MainWindow() toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); +//! [2] +//! [3] QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); @@ -89,7 +95,9 @@ MainWindow::MainWindow() setCentralWidget(view); } +//! [3] +//! [4] void MainWindow::adjustLocation() { locationEdit->setText(view->url().toString()); @@ -98,11 +106,12 @@ void MainWindow::adjustLocation() void MainWindow::changeLocation() { QUrl url = QUrl(locationEdit->text()); - locationEdit->setText(url.toString()); view->load(url); view->setFocus(); } +//! [4] +//! [5] void MainWindow::adjustTitle() { if (progress <= 0 || progress >= 100) @@ -116,20 +125,26 @@ void MainWindow::setProgress(int p) progress = p; adjustTitle(); } +//! [5] +//! [6] void MainWindow::finishLoading(bool) { progress = 100; adjustTitle(); view->page()->mainFrame()->evaluateJavaScript(jQuery); } +//! [6] +//! [7] void MainWindow::highlightAllLinks() { QString code = "$('a').each( function () { $(this).css('background-color', 'yellow') } )"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [7] +//! [8] void MainWindow::rotateImages(bool toggle) { QString code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s') } )"; @@ -140,7 +155,9 @@ void MainWindow::rotateImages(bool toggle) code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(0deg)') } )"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [8] +//! [9] void MainWindow::removeGifImages() { QString code = "$('[src*=gif]').remove()"; @@ -164,4 +181,5 @@ void MainWindow::removeEmbeddedElements() QString code = "$('embed').remove()"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [9] diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index 9362ca7..2e1068c 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -39,13 +39,14 @@ ** ****************************************************************************/ -#include <QMainWindow> +#include <QtGui> QT_BEGIN_NAMESPACE class QWebView; class QLineEdit; QT_END_NAMESPACE +//! [1] class MainWindow : public QMainWindow { Q_OBJECT @@ -73,4 +74,5 @@ private: QWebView *view; QLineEdit *locationEdit; int progress; +//! [1] }; diff --git a/examples/webkit/formextractor/mainwindow.cpp b/examples/webkit/formextractor/mainwindow.cpp index 222d9b2..ec4d043 100644 --- a/examples/webkit/formextractor/mainwindow.cpp +++ b/examples/webkit/formextractor/mainwindow.cpp @@ -54,7 +54,7 @@ void MainWindow::createActions() { exitAct = new QAction(tr("E&xit"), this); exitAct->setStatusTip(tr("Exit the application")); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/webkit/previewer/mainwindow.cpp b/examples/webkit/previewer/mainwindow.cpp index abe7941..1e20ed3 100644 --- a/examples/webkit/previewer/mainwindow.cpp +++ b/examples/webkit/previewer/mainwindow.cpp @@ -61,7 +61,7 @@ MainWindow::MainWindow() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing HTML file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); @@ -72,13 +72,13 @@ void MainWindow::createActions() //! [1] saveAct = new QAction(tr("&Save"), this); - saveAct->setShortcut(tr("Ctrl+S")); + saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the HTML file to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); exitAct = new QAction(tr("E&xit"), this); exitAct->setStatusTip(tr("Exit the application")); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/widgets/icons/mainwindow.cpp b/examples/widgets/icons/mainwindow.cpp index 00ce8b0..db42710 100644 --- a/examples/widgets/icons/mainwindow.cpp +++ b/examples/widgets/icons/mainwindow.cpp @@ -369,7 +369,7 @@ void MainWindow::createActions() this, SLOT(removeAllImages())); exitAct = new QAction(tr("&Quit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); styleActionGroup = new QActionGroup(this); diff --git a/examples/widgets/scribble/mainwindow.cpp b/examples/widgets/scribble/mainwindow.cpp index ad1a837..c4b05fe 100644 --- a/examples/widgets/scribble/mainwindow.cpp +++ b/examples/widgets/scribble/mainwindow.cpp @@ -141,7 +141,7 @@ void MainWindow::createActions() //! [13] //! [14] { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); foreach (QByteArray format, QImageWriter::supportedImageFormats()) { @@ -157,7 +157,7 @@ void MainWindow::createActions() connect(printAct, SIGNAL(triggered()), scribbleArea, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); penColorAct = new QAction(tr("&Pen Color..."), this); diff --git a/examples/widgets/tablet/mainwindow.cpp b/examples/widgets/tablet/mainwindow.cpp index 56a10cd..10490bf 100644 --- a/examples/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/tablet/mainwindow.cpp @@ -212,17 +212,17 @@ void MainWindow::createActions() this, SLOT(lineWidthActionTriggered(QAction *))); exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+X")); + exitAction->setShortcuts(QKeySequence::Quit); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); loadAction = new QAction(tr("&Open..."), this); - loadAction->setShortcut(tr("Ctrl+O")); + loadAction->setShortcuts(QKeySequence::Open); connect(loadAction, SIGNAL(triggered()), this, SLOT(loadAct())); saveAction = new QAction(tr("&Save As..."), this); - saveAction->setShortcut(tr("Ctrl+S")); + saveAction->setShortcuts(QKeySequence::SaveAs); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAct())); diff --git a/examples/xml/dombookmarks/mainwindow.cpp b/examples/xml/dombookmarks/mainwindow.cpp index 6b0c101..7efe6ff 100644 --- a/examples/xml/dombookmarks/mainwindow.cpp +++ b/examples/xml/dombookmarks/mainwindow.cpp @@ -113,15 +113,15 @@ void MainWindow::about() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp index 2cba559..9247eb7 100644 --- a/examples/xml/saxbookmarks/mainwindow.cpp +++ b/examples/xml/saxbookmarks/mainwindow.cpp @@ -128,15 +128,15 @@ void MainWindow::about() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/xml/streambookmarks/mainwindow.cpp b/examples/xml/streambookmarks/mainwindow.cpp index 2136b4b..c6f991b 100644 --- a/examples/xml/streambookmarks/mainwindow.cpp +++ b/examples/xml/streambookmarks/mainwindow.cpp @@ -141,15 +141,15 @@ void MainWindow::about() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.cpp b/examples/xmlpatterns/trafficinfo/mainwindow.cpp index 1f754d5..393e33c 100644 --- a/examples/xmlpatterns/trafficinfo/mainwindow.cpp +++ b/examples/xmlpatterns/trafficinfo/mainwindow.cpp @@ -55,7 +55,7 @@ MainWindow::MainWindow() : QWidget(0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) { QAction *quitAction = new QAction(tr("E&xit"), this); - quitAction->setShortcut(tr("Ctrl+Q")); + quitAction->setShortcuts(QKeySequence::Quit); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QAction *configAction = new QAction(tr("&Select station..."), this); diff --git a/mkspecs/common/mac-g++.conf b/mkspecs/common/mac-g++.conf index b764b26..dca2e2f 100644 --- a/mkspecs/common/mac-g++.conf +++ b/mkspecs/common/mac-g++.conf @@ -9,7 +9,7 @@ QMAKE_CFLAGS += -pipe QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -Os +QMAKE_CFLAGS_RELEASE += -O2 QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC @@ -46,10 +46,10 @@ QMAKE_CXXFLAGS_DWARF2 += $$QMAKE_CFLAGS_DWARF2 QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX +QMAKE_LINK_C = $$QMAKE_CC +QMAKE_LINK_C_SHLIB = $$QMAKE_CC QMAKE_LFLAGS += -headerpad_max_install_names QMAKE_LFLAGS_RELEASE += QMAKE_LFLAGS_DEBUG += diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf index 64ef801..4355073 100644 --- a/mkspecs/macx-g++/qmake.conf +++ b/mkspecs/macx-g++/qmake.conf @@ -12,9 +12,9 @@ CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/mac-g++.conf) - QMAKE_CC = gcc QMAKE_CXX = g++ +include(../common/mac-g++.conf) + load(qt_config) diff --git a/mkspecs/macx-g++42/qmake.conf b/mkspecs/macx-g++42/qmake.conf index e6a3120..06bbdcb 100644 --- a/mkspecs/macx-g++42/qmake.conf +++ b/mkspecs/macx-g++42/qmake.conf @@ -12,10 +12,9 @@ CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -include(../common/mac-g++.conf) - - QMAKE_CC = gcc-4.2 QMAKE_CXX = g++-4.2 +include(../common/mac-g++.conf) + load(qt_config) diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 02ff38e..9147ee8 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -79,7 +79,6 @@ bootstrap { #Qt code qfile.h \ qabstractfileengine.h \ qfileinfo.h \ - qfileinfo_p.h \ qglobal.h \ qnumeric.h \ qhash.h \ diff --git a/src/3rdparty/README b/src/3rdparty/README index 2be1036..ef05674 100644 --- a/src/3rdparty/README +++ b/src/3rdparty/README @@ -20,3 +20,8 @@ have been removed: Some patches are applied from time to time. Recent patches can be found in the patches subdirectory. + + +The pvr2d.h & wsegl.h in the powervr directory are required for building +the PowerVR plugin on Qt for Embedded Linux. These headers are for SGX +based SoCs, but may also work on MBX SoCs. diff --git a/src/3rdparty/phonon/phonon/phononnamespace.h b/src/3rdparty/phonon/phonon/phononnamespace.h index 0bbf4f4..2492ee6 100644 --- a/src/3rdparty/phonon/phonon/phononnamespace.h +++ b/src/3rdparty/phonon/phonon/phononnamespace.h @@ -25,6 +25,11 @@ #include "phonon_export.h" +#ifdef __QT_SYNCQT__ +// Tell syncqt to create a "Global" header here +#pragma qt_class(Phonon::Global) +#endif + /** * Helper macro that can be used like * \code diff --git a/src/3rdparty/powervr/pvr2d.h b/src/3rdparty/powervr/pvr2d.h new file mode 100644 index 0000000..07f28c7 --- /dev/null +++ b/src/3rdparty/powervr/pvr2d.h @@ -0,0 +1,502 @@ +/*!**************************************************************************** +@File pvr2d.h +@Title PVR2D external header file +@Author Imagination Technologies +@Copyright Copyright (c) by Imagination Technologies Limited. + This specification is protected by copyright laws and contains + material proprietary to Imagination Technologies Limited. + You may use and distribute this specification free of charge for implementing + the functionality therein, without altering or removing any trademark, copyright, + or other notice from the specification. +@Platform Generic +@Description PVR2D definitions for PVR2D clients +******************************************************************************/ + + +/****************************************************************************** +Modifications :- +$Log: pvr2d.h $ +******************************************************************************/ + +#ifndef _PVR2D_H_ +#define _PVR2D_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* PVR2D Platform-specific definitions */ +#define PVR2D_EXPORT +#define PVR2D_IMPORT + + +#define PVR2D_REV_MAJOR 2 +#define PVR2D_REV_MINOR 1 + +typedef enum +{ + PVR2D_FALSE = 0, + PVR2D_TRUE +} PVR2D_BOOL; + + +/* error codes */ +typedef enum +{ + PVR2D_OK = 0, + PVR2DERROR_INVALID_PARAMETER = -1, + PVR2DERROR_DEVICE_UNAVAILABLE = -2, + PVR2DERROR_INVALID_CONTEXT = -3, + PVR2DERROR_MEMORY_UNAVAILABLE = -4, + PVR2DERROR_DEVICE_NOT_PRESENT = -5, + PVR2DERROR_IOCTL_ERROR = -6, + PVR2DERROR_GENERIC_ERROR = -7, + PVR2DERROR_BLT_NOTCOMPLETE = -8, + PVR2DERROR_HW_FEATURE_NOT_SUPPORTED = -9, + PVR2DERROR_NOT_YET_IMPLEMENTED = -10, + PVR2DERROR_MAPPING_FAILED = -11 +}PVR2DERROR; + + +/* pixel formats */ +typedef enum +{ + PVR2D_1BPP = 0, + PVR2D_RGB565, + PVR2D_ARGB4444, + PVR2D_RGB888, + PVR2D_ARGB8888, + PVR2D_ARGB1555, + PVR2D_ALPHA8, + PVR2D_ALPHA4, + PVR2D_PAL2, + PVR2D_PAL4, + PVR2D_PAL8, + PVR2D_VGAEMU + +}PVR2DFORMAT; + + +/* wrap surface type */ +typedef enum +{ + PVR2D_WRAPFLAG_NONCONTIGUOUS = 0, + PVR2D_WRAPFLAG_CONTIGUOUS = 1, + +}PVR2DWRAPFLAGS; + +/* flags for control information of additional blits */ +typedef enum +{ + PVR2D_BLIT_DISABLE_ALL = 0x0000, /* disable all additional controls */ + PVR2D_BLIT_CK_ENABLE = 0x0001, /* enable colour key */ + PVR2D_BLIT_GLOBAL_ALPHA_ENABLE = 0x0002, /* enable standard global alpha */ + PVR2D_BLIT_PERPIXEL_ALPHABLEND_ENABLE = 0x0004, /* enable per-pixel alpha bleding */ + PVR2D_BLIT_PAT_SURFACE_ENABLE = 0x0008, /* enable pattern surf (disable fill) */ + PVR2D_BLIT_FULLY_SPECIFIED_ALPHA_ENABLE = 0x0010, /* enable fully specified alpha */ + PVR2D_BLIT_ROT_90 = 0x0020, /* apply 90 degree rotation to the blt */ + PVR2D_BLIT_ROT_180 = 0x0040, /* apply 180 degree rotation to the blt */ + PVR2D_BLIT_ROT_270 = 0x0080, /* apply 270 degree rotation to the blt */ + PVR2D_BLIT_COPYORDER_TL2BR = 0x0100, /* copy order overrides */ + PVR2D_BLIT_COPYORDER_BR2TL = 0x0200, + PVR2D_BLIT_COPYORDER_TR2BL = 0x0400, + PVR2D_BLIT_COPYORDER_BL2TR = 0x0800, + PVR2D_BLIT_COLKEY_SOURCE = 0x1000, /* Key colour is on the source surface */ + PVR2D_BLIT_COLKEY_DEST = 0x2000 /* Key colour is on the destination surface */ + +} PVR2DBLITFLAGS; + +/* standard alpha-blending functions, AlphaBlendingFunc field of PVR2DBLTINFO */ +typedef enum +{ + PVR2D_ALPHA_OP_SRC_DSTINV = 1, /* source alpha : Cdst = Csrc*Asrc + Cdst*(1-Asrc) */ + PVR2D_ALPHA_OP_SRCP_DSTINV = 2 /* premultiplied source alpha : Cdst = Csrc + Cdst*(1-Asrc) */ +} PVR2D_ALPHABLENDFUNC; + +/* blend ops for fully specified alpha */ +typedef enum +{ + PVR2D_BLEND_OP_ZERO = 0, + PVR2D_BLEND_OP_ONE = 1, + PVR2D_BLEND_OP_SRC = 2, + PVR2D_BLEND_OP_DST = 3, + PVR2D_BLEND_OP_GLOBAL = 4, + PVR2D_BLEND_OP_SRC_PLUS_GLOBAL = 5, + PVR2D_BLEND_OP_DST_PLUS_GLOBAL = 6 +}PVR2D_BLEND_OP; + + +typedef void* PVR2D_HANDLE; + + +/* Fully specified alpha blend : pAlpha field of PVR2DBLTINFO structure */ +/* a fully specified Alpha Blend operation is defined as */ +/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (ALPHA_3 * DST (ALPHA)) */ +/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (ALPHA_4 * DST (RGB)) */ +/* if the pre-multiplication stage is enabled then the equations become the following: */ +/* PRE_MUL = ((SRC(A)) * (Global Alpha Value)) */ +/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (PRE_MUL * DST (ALPHA)) */ +/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (PRE_MUL * DST (RGB)) */ +/* if the transparent source alpha stage is enabled then a source alpha of zero forces the */ +/* source to be transparent for that pixel regardless of the blend equation being used. */ +typedef struct _PVR2D_ALPHABLT +{ + PVR2D_BLEND_OP eAlpha1; + PVR2D_BOOL bAlpha1Invert; + PVR2D_BLEND_OP eAlpha2; + PVR2D_BOOL bAlpha2Invert; + PVR2D_BLEND_OP eAlpha3; + PVR2D_BOOL bAlpha3Invert; + PVR2D_BLEND_OP eAlpha4; + PVR2D_BOOL bAlpha4Invert; + PVR2D_BOOL bPremulAlpha; /* enable pre-multiplication stage */ + PVR2D_BOOL bTransAlpha; /* enable transparent source alpha stage */ + PVR2D_BOOL bUpdateAlphaLookup; /* enable and update the 1555-Lookup alpha table */ + unsigned char uAlphaLookup0; /* 8 bit alpha when A=0 in a 1555-Lookup surface */ + unsigned char uAlphaLookup1; /* 8 bit alpha when A=1 in a 1555-Lookup surface */ + unsigned char uGlobalRGB; /* Global Alpha Value for RGB, 0=transparent 255=opaque */ + unsigned char uGlobalA; /* Global Alpha Value for Alpha */ + +} PVR2D_ALPHABLT, *PPVR2D_ALPHABLT; + + +/* surface memory info structure */ +typedef struct _PVR2DMEMINFO +{ + void *pBase; + unsigned long ui32MemSize; + unsigned long ui32DevAddr; + unsigned long ulFlags; + void *hPrivateData; + void *hPrivateMapData; + +}PVR2DMEMINFO, *PPVR2DMEMINFO; + + +#define PVR2D_MAX_DEVICE_NAME 20 + +typedef struct _PVR2DDEVICEINFO +{ + unsigned long ulDevID; + char szDeviceName[PVR2D_MAX_DEVICE_NAME]; +}PVR2DDEVICEINFO; + + +typedef struct _PVR2DISPLAYINFO +{ + unsigned long ulMaxFlipChains; + unsigned long ulMaxBuffersInChain; + PVR2DFORMAT eFormat; + unsigned long ulWidth; + unsigned long ulHeight; + long lStride; + unsigned long ulMinFlipInterval; + unsigned long ulMaxFlipInterval; + +}PVR2DDISPLAYINFO; + + +typedef struct _PVR2DBLTINFO +{ + unsigned long CopyCode; /* rop code */ + unsigned long Colour; /* fill colour */ + unsigned long ColourKey; /* colour key */ + unsigned char GlobalAlphaValue; /* global alpha blending */ + unsigned char AlphaBlendingFunc; /* per-pixel alpha-blending function */ + + PVR2DBLITFLAGS BlitFlags; /* additional blit control information */ + + PVR2DMEMINFO *pDstMemInfo; /* destination memory */ + unsigned long DstOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */ + long DstStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */ + long DstX, DstY; /* pixel offset from start of dest surface to start of blt rectangle */ + long DSizeX,DSizeY; /* blt size */ + PVR2DFORMAT DstFormat; /* dest format */ + unsigned long DstSurfWidth; /* size of dest surface in pixels */ + unsigned long DstSurfHeight; /* size of dest surface in pixels */ + + PVR2DMEMINFO *pSrcMemInfo; /* source mem, (source fields are also used for patterns) */ + unsigned long SrcOffset; /* byte offset from start of allocation to src/pat surface pixel 0,0 */ + long SrcStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */ + long SrcX, SrcY; /* pixel offset from start of surface to start of source rectangle */ + /* for patterns this is the start offset within the pattern */ + long SizeX,SizeY; /* source rectangle size or pattern size in pixels */ + PVR2DFORMAT SrcFormat; /* source/pattern format */ + PVR2DMEMINFO *pPalMemInfo; /* source/pattern palette memory containing argb8888 colour table */ + unsigned long PalOffset; /* byte offset from start of allocation to start of palette */ + unsigned long SrcSurfWidth; /* size of source surface in pixels */ + unsigned long SrcSurfHeight; /* size of source surface in pixels */ + + PVR2DMEMINFO *pMaskMemInfo; /* mask memory, 1bpp format implied */ + unsigned long MaskOffset; /* byte offset from start of allocation to mask surface pixel 0,0 */ + long MaskStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */ + long MaskX, MaskY; /* mask rect top left (mask size = blt size) */ + unsigned long MaskSurfWidth; /* size of mask surface in pixels */ + unsigned long MaskSurfHeight; /* size of mask surface in pixels */ + + PPVR2D_ALPHABLT pAlpha; /* fully specified alpha blend */ + +}PVR2DBLTINFO, *PPVR2DBLTINFO; + +typedef struct _PVR2DRECT +{ + long left, top; + long right, bottom; +} PVR2DRECT; + +typedef struct +{ + PVR2DMEMINFO *pSurfMemInfo; /* surface memory */ + unsigned long SurfOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */ + long Stride; /* signed stride */ + PVR2DFORMAT Format; + unsigned long SurfWidth; /* surface size in pixels */ + unsigned long SurfHeight; + +} PVR2D_SURFACE, *PPVR2D_SURFACE; + +typedef struct +{ + unsigned long *pUseCode; /* USSE code */ + unsigned long UseCodeSize; /* usse code size in bytes */ + +} PVR2D_USECODE, *PPVR2D_USECODE; + +typedef struct +{ + PVR2D_SURFACE sDst; /* destination surface */ + PVR2D_SURFACE sSrc; /* source surface */ + PVR2DRECT rcDest; /* destination rectangle */ + PVR2DRECT rcSource; /* source rectangle */ + PVR2D_HANDLE hUseCode; /* custom USE code (NULL implies source copy) */ + unsigned long UseParams[2]; /* per-blt params for use code */ + +} PVR2D_3DBLT, *PPVR2D_3DBLT; + + +#define MAKE_COPY_BLIT(src,soff,dest,doff,sx,sy,dx,dy,sz) + +typedef void* PVR2DCONTEXTHANDLE; +typedef void* PVR2DFLIPCHAINHANDLE; + + +// CopyCode field of PVR2DBLTINFO structure: +// the CopyCode field of the PVR2DBLTINFO structure should contain a rop3 or rop4 code. +// a rop3 is an 8 bit code that describes a blt with three inputs : source dest and pattern +// rop4 is a 16 bit code that describes a blt with four inputs : source dest pattern and mask +// common rop3 codes are defined below +// a colour fill blt is processed in the pattern channel as a constant colour with a rop code of 0xF0 +// PVR2D_BLIT_PAT_SURFACE_ENABLE defines whether the pattern channel is a surface or a fill colour. +// a rop4 is defined by two rop3 codes, and the 1 bit-per-pixel mask surface defines which is used. +// a common rop4 is 0xAAF0 which is the mask copy blt used for text glyphs. +// CopyCode is taken to be a rop4 when pMaskMemInfo is non zero, otherwise it is assumed to be a rop3 +// use the PVR2DMASKROP4 macro below to construct a rop4 from two rop3's +// rop3a is the rop used when mask pixel = 1, and rop3b when mask = 0 +#define PVR2DROP4(rop3b, rop3a) ((rop3b<<8)|rop3a) + +/* common rop codes */ +#define PVR2DROPclear 0x00 /* 0 (whiteness) */ +#define PVR2DROPset 0xFF /* 1 (blackness) */ +#define PVR2DROPnoop 0xAA /* dst (used for masked blts) */ + +/* source and dest rop codes */ +#define PVR2DROPand 0x88 /* src AND dst */ +#define PVR2DROPandReverse 0x44 /* src AND NOT dst */ +#define PVR2DROPcopy 0xCC /* src (used for source copy and alpha blts) */ +#define PVR2DROPandInverted 0x22 /* NOT src AND dst */ +#define PVR2DROPxor 0x66 /* src XOR dst */ +#define PVR2DROPor 0xEE /* src OR dst */ +#define PVR2DROPnor 0x11 /* NOT src AND NOT dst */ +#define PVR2DROPequiv 0x99 /* NOT src XOR dst */ +#define PVR2DROPinvert 0x55 /* NOT dst */ +#define PVR2DROPorReverse 0xDD /* src OR NOT dst */ +#define PVR2DROPcopyInverted 0x33 /* NOT src */ +#define PVR2DROPorInverted 0xBB /* NOT src OR dst */ +#define PVR2DROPnand 0x77 /* NOT src OR NOT dst */ + +/* pattern rop codes */ +#define PVR2DPATROPand 0xA0 /* pat AND dst */ +#define PVR2DPATROPandReverse 0x50 /* pat AND NOT dst */ +#define PVR2DPATROPcopy 0xF0 /* pat (used for solid color fills and pattern blts) */ +#define PVR2DPATROPandInverted 0x0A /* NOT pat AND dst */ +#define PVR2DPATROPxor 0x5A /* pat XOR dst */ +#define PVR2DPATROPor 0xFA /* pat OR dst */ +#define PVR2DPATROPnor 0x05 /* NOT pat AND NOT dst */ +#define PVR2DPATROPequiv 0xA5 /* NOT pat XOR dst */ +#define PVR2DPATROPinvert 0x55 /* NOT dst */ +#define PVR2DPATROPorReverse 0xF5 /* pat OR NOT dst */ +#define PVR2DPATROPcopyInverted 0x0F /* NOT pat */ +#define PVR2DPATROPorInverted 0xAF /* NOT pat OR dst */ +#define PVR2DPATROPnand 0x5F /* NOT pat OR NOT dst */ + +/* common rop4 codes */ +#define PVR2DROP4MaskedCopy PVR2DROP4(PVR2DROPnoop,PVR2DROPcopy) /* masked source copy blt (used for rounded window corners etc) */ +#define PVR2DROP4MaskedFill PVR2DROP4(PVR2DROPnoop,PVR2DPATROPcopy) /* masked colour fill blt (used for text) */ + +/* Legacy support */ +#define PVR2DROP3_PATMASK PVR2DPATROPcopy +#define PVR2DROP3_SRCMASK PVR2DROPcopy + +/* pixmap memory alignment */ +#define PVR2D_ALIGNMENT_4 4 /* DWORD alignment */ +#define PVR2D_ALIGNMENT_ANY 0 /* no alignment */ +#define PVR2D_ALIGNMENT_PALETTE 16 /* 16 byte alignment is required for palettes */ + +/* Heap number for PVR2DGetFrameBuffer */ +#define PVR2D_FB_PRIMARY_SURFACE 0 + +#define PVR2D_PRESENT_PROPERTY_SRCSTRIDE (1 << 0) +#define PVR2D_PRESENT_PROPERTY_DSTSIZE (1 << 1) +#define PVR2D_PRESENT_PROPERTY_DSTPOS (1 << 2) +#define PVR2D_PRESENT_PROPERTY_CLIPRECTS (1 << 3) +#define PVR2D_PRESENT_PROPERTY_INTERVAL (1 << 4) + + +#define PVR2D_CREATE_FLIPCHAIN_SHARED (1 << 0) +#define PVR2D_CREATE_FLIPCHAIN_QUERY (1 << 1) + +/* Functions that the library exports */ + +PVR2D_IMPORT +int PVR2DEnumerateDevices(PVR2DDEVICEINFO *pDevInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DCreateDeviceContext(unsigned long ulDevID, + PVR2DCONTEXTHANDLE* phContext, + unsigned long ulFlags); + +PVR2D_IMPORT +PVR2DERROR PVR2DDestroyDeviceContext(PVR2DCONTEXTHANDLE hContext); + +PVR2D_IMPORT +PVR2DERROR PVR2DGetDeviceInfo(PVR2DCONTEXTHANDLE hContext, + PVR2DDISPLAYINFO *pDisplayInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DGetScreenMode(PVR2DCONTEXTHANDLE hContext, + PVR2DFORMAT *pFormat, + long *plWidth, + long *plHeight, + long *plStride, + int *piRefreshRate); + +PVR2D_IMPORT +PVR2DERROR PVR2DGetFrameBuffer(PVR2DCONTEXTHANDLE hContext, + int nHeap, + PVR2DMEMINFO **ppsMemInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DMemAlloc(PVR2DCONTEXTHANDLE hContext, + unsigned long ulBytes, + unsigned long ulAlign, + unsigned long ulFlags, + PVR2DMEMINFO **ppsMemInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DMemWrap(PVR2DCONTEXTHANDLE hContext, + void *pMem, + unsigned long ulFlags, + unsigned long ulBytes, + unsigned long alPageAddress[], + PVR2DMEMINFO **ppsMemInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DMemMap(PVR2DCONTEXTHANDLE hContext, + unsigned long ulFlags, + void *hPrivateMapData, + PVR2DMEMINFO **ppsDstMem); + +PVR2D_IMPORT +PVR2DERROR PVR2DMemFree(PVR2DCONTEXTHANDLE hContext, + PVR2DMEMINFO *psMemInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DBlt(PVR2DCONTEXTHANDLE hContext, + PVR2DBLTINFO *pBltInfo); + +PVR2D_IMPORT +PVR2DERROR PVR2DBltClipped(PVR2DCONTEXTHANDLE hContext, + PVR2DBLTINFO *pBltInfo, + unsigned long ulNumClipRects, + PVR2DRECT *pClipRects); + +PVR2D_IMPORT +PVR2DERROR PVR2DQueryBlitsComplete(PVR2DCONTEXTHANDLE hContext, + PVR2DMEMINFO *pMemInfo, + unsigned int uiWaitForComplete); + +PVR2D_IMPORT +PVR2DERROR PVR2DSetPresentBltProperties(PVR2DCONTEXTHANDLE hContext, + unsigned long ulPropertyMask, + long lSrcStride, + unsigned long ulDstWidth, + unsigned long ulDstHeight, + long lDstXPos, + long lDstYPos, + unsigned long ulNumClipRects, + PVR2DRECT *pClipRects, + unsigned long ulSwapInterval); + +PVR2D_IMPORT +PVR2DERROR PVR2DPresentBlt(PVR2DCONTEXTHANDLE hContext, + PVR2DMEMINFO *pMemInfo, + long lRenderID); + +PVR2D_IMPORT +PVR2DERROR PVR2DCreateFlipChain(PVR2DCONTEXTHANDLE hContext, + unsigned long ulFlags, + unsigned long ulNumBuffers, + unsigned long ulWidth, + unsigned long ulHeight, + PVR2DFORMAT eFormat, + long *plStride, + unsigned long *pulFlipChainID, + PVR2DFLIPCHAINHANDLE *phFlipChain); + +PVR2D_IMPORT +PVR2DERROR PVR2DDestroyFlipChain(PVR2DCONTEXTHANDLE hContext, + PVR2DFLIPCHAINHANDLE hFlipChain); + +PVR2D_IMPORT +PVR2DERROR PVR2DGetFlipChainBuffers(PVR2DCONTEXTHANDLE hContext, + PVR2DFLIPCHAINHANDLE hFlipChain, + unsigned long *pulNumBuffers, + PVR2DMEMINFO *psMemInfo[]); + +PVR2D_IMPORT +PVR2DERROR PVR2DSetPresentFlipProperties(PVR2DCONTEXTHANDLE hContext, + PVR2DFLIPCHAINHANDLE hFlipChain, + unsigned long ulPropertyMask, + long lDstXPos, + long lDstYPos, + unsigned long ulNumClipRects, + PVR2DRECT *pClipRects, + unsigned long ulSwapInterval); + +PVR2D_IMPORT +PVR2DERROR PVR2DPresentFlip(PVR2DCONTEXTHANDLE hContext, + PVR2DFLIPCHAINHANDLE hFlipChain, + PVR2DMEMINFO *psMemInfo, + long lRenderID); + +PVR2D_IMPORT +PVR2DERROR PVR2DGetAPIRev(long *lRevMajor, long *lRevMinor); + +PVR2D_IMPORT +PVR2DERROR PVR2DLoadUseCode (const PVR2DCONTEXTHANDLE hContext, const unsigned char *pUseCode, + const unsigned long UseCodeSize, PVR2D_HANDLE *pUseCodeHandle); +PVR2D_IMPORT +PVR2DERROR PVR2DFreeUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_HANDLE hUseCodeHandle); + +PVR2D_IMPORT +PVR2DERROR PVR2DBlt3D (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT pBlt3D); + +#ifdef __cplusplus +} +#endif + +#endif /* _PVR2D_H_ */ + +/****************************************************************************** + End of file (pvr2d.h) +******************************************************************************/ diff --git a/src/3rdparty/powervr/wsegl.h b/src/3rdparty/powervr/wsegl.h new file mode 100644 index 0000000..0490607 --- /dev/null +++ b/src/3rdparty/powervr/wsegl.h @@ -0,0 +1,240 @@ +/****************************************************************************** + Name : wsegl.h + Copyright : Copyright (c) Imagination Technologies Limited. + This specification is protected by copyright laws and contains + material proprietary to Imagination Technologies Limited. + You may use and distribute this specification free of charge for implementing + the functionality therein, without altering or removing any trademark, copyright, + or other notice from the specification. + Platform : ANSI +*****************************************************************************/ + + +#if !defined(__WSEGL_H__) +#define __WSEGL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +// WSEGL Platform-specific definitions +*/ +#define WSEGL_EXPORT +#define WSEGL_IMPORT + +/* +// WSEGL API Version Number +*/ + +#define WSEGL_VERSION 1 +#define WSEGL_DEFAULT_DISPLAY 0 +#define WSEGL_DEFAULT_NATIVE_ENGINE 0 + +#define WSEGL_FALSE 0 +#define WSEGL_TRUE 1 +#define WSEGL_NULL 0 + +#define WSEGL_UNREFERENCED_PARAMETER(param) (param) = (param) + +/* +// WSEGL handles +*/ +typedef void *WSEGLDisplayHandle; +typedef void *WSEGLDrawableHandle; + +/* +// Display capability type +*/ +typedef enum WSEGLCapsType_TAG +{ + WSEGL_NO_CAPS = 0, + WSEGL_CAP_MIN_SWAP_INTERVAL = 1, /* System default value = 1 */ + WSEGL_CAP_MAX_SWAP_INTERVAL = 2, /* System default value = 1 */ + WSEGL_CAP_WINDOWS_USE_HW_SYNC = 3, /* System default value = 0 (FALSE) */ + WSEGL_CAP_PIXMAPS_USE_HW_SYNC = 4, /* System default value = 0 (FALSE) */ + +} WSEGLCapsType; + +/* +// Display capability +*/ +typedef struct WSEGLCaps_TAG +{ + WSEGLCapsType eCapsType; + unsigned long ui32CapsValue; + +} WSEGLCaps; + +/* +// Drawable type +*/ +#define WSEGL_NO_DRAWABLE 0x0 +#define WSEGL_DRAWABLE_WINDOW 0x1 +#define WSEGL_DRAWABLE_PIXMAP 0x2 + + +/* +// Pixel format of display/drawable +*/ +typedef enum WSEGLPixelFormat_TAG +{ + WSEGL_PIXELFORMAT_565 = 0, + WSEGL_PIXELFORMAT_4444 = 1, + WSEGL_PIXELFORMAT_8888 = 2, + WSEGL_PIXELFORMAT_1555 = 3 + +} WSEGLPixelFormat; + +/* +// Transparent of display/drawable +*/ +typedef enum WSEGLTransparentType_TAG +{ + WSEGL_OPAQUE = 0, + WSEGL_COLOR_KEY = 1, + +} WSEGLTransparentType; + +/* +// Display/drawable configuration +*/ +typedef struct WSEGLConfig_TAG +{ + /* + // Type of drawables this configuration applies to - + // OR'd values of drawable types. + */ + unsigned long ui32DrawableType; + + /* Pixel format */ + WSEGLPixelFormat ePixelFormat; + + /* Native Renderable - set to WSEGL_TRUE if native renderable */ + unsigned long ulNativeRenderable; + + /* FrameBuffer Level Parameter */ + unsigned long ulFrameBufferLevel; + + /* Native Visual ID */ + unsigned long ulNativeVisualID; + + /* Native Visual */ + void *hNativeVisual; + + /* Transparent Type */ + WSEGLTransparentType eTransparentType; + + /* Transparent Color - only used if transparent type is COLOR_KEY */ + unsigned long ulTransparentColor; /* packed as 0x00RRGGBB */ + + +} WSEGLConfig; + +/* +// WSEGL errors +*/ +typedef enum WSEGLError_TAG +{ + WSEGL_SUCCESS = 0, + WSEGL_CANNOT_INITIALISE = 1, + WSEGL_BAD_NATIVE_DISPLAY = 2, + WSEGL_BAD_NATIVE_WINDOW = 3, + WSEGL_BAD_NATIVE_PIXMAP = 4, + WSEGL_BAD_NATIVE_ENGINE = 5, + WSEGL_BAD_DRAWABLE = 6, + WSEGL_BAD_CONFIG = 7, + WSEGL_OUT_OF_MEMORY = 8 + +} WSEGLError; + +/* +// Drawable orientation (in degrees anti-clockwise) +*/ +typedef enum WSEGLRotationAngle_TAG +{ + WSEGL_ROTATE_0 = 0, + WSEGL_ROTATE_90 = 1, + WSEGL_ROTATE_180 = 2, + WSEGL_ROTATE_270 = 3 + +} WSEGLRotationAngle; + +/* +// Drawable information required by OpenGL-ES driver +*/ +typedef struct WSEGLDrawableParams_TAG +{ + /* Width in pixels of the drawable */ + unsigned long ui32Width; + + /* Height in pixels of the drawable */ + unsigned long ui32Height; + + /* Stride in pixels of the drawable */ + unsigned long ui32Stride; + + /* Pixel format of the drawable */ + WSEGLPixelFormat ePixelFormat; + + /* User space cpu virtual address of the drawable */ + void *pvLinearAddress; + + /* HW address of the drawable */ + unsigned long ui32HWAddress; + + /* Private data for the drawable */ + void *hPrivateData; + +} WSEGLDrawableParams; + + +/* +// Table of function pointers that is returned by WSEGL_GetFunctionTablePointer() +// +// The first entry in the table is the version number of the wsegl.h header file that +// the module has been written against, and should therefore be set to WSEGL_VERSION +*/ +typedef struct WSEGL_FunctionTable_TAG +{ + unsigned long ui32WSEGLVersion; + + WSEGLError (*pfnWSEGL_IsDisplayValid)(NativeDisplayType); + + WSEGLError (*pfnWSEGL_InitialiseDisplay)(NativeDisplayType, WSEGLDisplayHandle *, const WSEGLCaps **, WSEGLConfig **); + + WSEGLError (*pfnWSEGL_CloseDisplay)(WSEGLDisplayHandle); + + WSEGLError (*pfnWSEGL_CreateWindowDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativeWindowType, WSEGLRotationAngle *); + + WSEGLError (*pfnWSEGL_CreatePixmapDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativePixmapType, WSEGLRotationAngle *); + + WSEGLError (*pfnWSEGL_DeleteDrawable)(WSEGLDrawableHandle); + + WSEGLError (*pfnWSEGL_SwapDrawable)(WSEGLDrawableHandle, unsigned long); + + WSEGLError (*pfnWSEGL_SwapControlInterval)(WSEGLDrawableHandle, unsigned long); + + WSEGLError (*pfnWSEGL_WaitNative)(WSEGLDrawableHandle, unsigned long); + + WSEGLError (*pfnWSEGL_CopyFromDrawable)(WSEGLDrawableHandle, NativePixmapType); + + WSEGLError (*pfnWSEGL_CopyFromPBuffer)(void *, unsigned long, unsigned long, unsigned long, WSEGLPixelFormat, NativePixmapType); + + WSEGLError (*pfnWSEGL_GetDrawableParameters)(WSEGLDrawableHandle, WSEGLDrawableParams *, WSEGLDrawableParams *); + + +} WSEGL_FunctionTable; + + +WSEGL_IMPORT const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __WSEGL_H__ */ + +/****************************************************************************** + End of file (wsegl.h) +******************************************************************************/ diff --git a/src/corelib/arch/qatomic_mips.h b/src/corelib/arch/qatomic_mips.h index b263aab..ea9954b 100644 --- a/src/corelib/arch/qatomic_mips.h +++ b/src/corelib/arch/qatomic_mips.h @@ -103,16 +103,25 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() #if defined(Q_CC_GNU) && !defined(Q_OS_IRIX) +#if _MIPS_SIM == _ABIO32 +#define SET_MIPS2 ".set mips2\n\t" +#else +#define SET_MIPS2 +#endif + inline bool QBasicAtomicInt::ref() { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[one]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -125,12 +134,15 @@ inline bool QBasicAtomicInt::deref() { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addiu %[newValue], %[originalValue], %[minusOne]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -143,7 +155,9 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) { register int result; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -153,6 +167,7 @@ inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -166,7 +181,9 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) { register int result; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -177,6 +194,7 @@ inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) "nop\n" "sync\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -190,7 +208,9 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) { register int result; register int tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" "ll %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -201,6 +221,7 @@ inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -219,12 +240,15 @@ inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) { register int originalValue; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" "sc %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -237,13 +261,16 @@ inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) { register int originalValue; register int tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" "sc %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -256,13 +283,16 @@ inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) { register int originalValue; register int tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" "ll %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" "sc %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -280,12 +310,15 @@ inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -298,13 +331,16 @@ inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) { register int originalValue; register int newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -317,13 +353,16 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) { register int originalValue; register int newValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" "ll %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" "sc %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -350,7 +389,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu { register T *result; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -360,6 +401,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValu "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -374,7 +416,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu { register T *result; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" "bnez %[result], 0f\n" @@ -385,6 +429,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValu "nop\n" "sync\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -399,7 +444,9 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu { register T *result; register T *tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" LLP" %[result], %[_q_value]\n" "xor %[result], %[result], %[expectedValue]\n" @@ -410,6 +457,7 @@ Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValu "beqz %[tempValue], 0b\n" "nop\n" "0:\n" + ".set pop\n" : [result] "=&r" (result), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -430,12 +478,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) { register T *originalValue; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" SCP" %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -449,13 +500,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) { register T *originalValue; register T *tempValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" SCP" %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -469,13 +523,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) { register T *originalValue; register T *tempValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" LLP" %[originalValue], %[_q_value]\n" "move %[tempValue], %[newValue]\n" SCP" %[tempValue], %[_q_value]\n" "beqz %[tempValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [tempValue] "=&r" (tempValue), [_q_value] "+m" (_q_value) @@ -495,12 +552,15 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueTo { register T *originalValue; register T *newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" SCP" %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -514,13 +574,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueTo { register T *originalValue; register T *newValue; - asm volatile("0:\n" + asm volatile(".set push\n" + SET_MIPS2 + "0:\n" LLP" %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" SCP" %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" "sync\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) @@ -534,13 +597,16 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueTo { register T *originalValue; register T *newValue; - asm volatile("sync\n" + asm volatile(".set push\n" + SET_MIPS2 + "sync\n" "0:\n" LLP" %[originalValue], %[_q_value]\n" "addu %[newValue], %[originalValue], %[valueToAdd]\n" SCP" %[newValue], %[_q_value]\n" "beqz %[newValue], 0b\n" "nop\n" + ".set pop\n" : [originalValue] "=&r" (originalValue), [_q_value] "+m" (_q_value), [newValue] "=&r" (newValue) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 6e8ffa1..51ca43e 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1508,9 +1508,14 @@ QString QTextDecoder::toUnicode(const QByteArray &ba) /*! \since 4.4 - Tries to detect the encoding of the provided snippet of HTML in the given byte array, \a ba, - and returns a QTextCodec instance that is capable of decoding the html to unicode. - If the codec cannot be detected from the content provided, \a defaultCodec is returned. + Tries to detect the encoding of the provided snippet of HTML in + the given byte array, \a ba, by checking the BOM (Byte Order Mark) + and the content-type meta header and returns a QTextCodec instance + that is capable of decoding the html to unicode. If the codec + cannot be detected from the content provided, \a defaultCodec is + returned. + + \sa codecForUtfText */ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec) { @@ -1518,15 +1523,8 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo int pos; QTextCodec *c = 0; - if (ba.size() > 1 && (((uchar)ba[0] == 0xfe && (uchar)ba[1] == 0xff) - || ((uchar)ba[0] == 0xff && (uchar)ba[1] == 0xfe))) { - c = QTextCodec::codecForMib(1015); // utf16 - } else if (ba.size() > 2 - && (uchar)ba[0] == 0xef - && (uchar)ba[1] == 0xbb - && (uchar)ba[2] == 0xbf) { - c = QTextCodec::codecForMib(106); // utf-8 - } else { + c = QTextCodec::codecForUtfText(ba, c); + if (!c) { QByteArray header = ba.left(512).toLower(); if ((pos = header.indexOf("http-equiv=")) != -1) { pos = header.indexOf("charset=", pos) + int(strlen("charset=")); @@ -1554,6 +1552,61 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba) return codecForHtml(ba, QTextCodec::codecForMib(/*Latin 1*/ 4)); } +/*! + \since 4.6 + + Tries to detect the encoding of the provided snippet \a ba by + using the BOM (Byte Order Mark) and returns a QTextCodec instance + that is capable of decoding the text to unicode. If the codec + cannot be detected from the content provided, \a defaultCodec is + returned. + + \sa codecForHtml +*/ +QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec) +{ + const uint arraySize = ba.size(); + + if (arraySize > 3) { + if ((uchar)ba[0] == 0x00 + && (uchar)ba[1] == 0x00 + && (uchar)ba[2] == 0xFE + && (uchar)ba[3] == 0xFF) + return QTextCodec::codecForMib(1018); // utf-32 be + else if ((uchar)ba[0] == 0xFF + && (uchar)ba[1] == 0xFE + && (uchar)ba[2] == 0x00 + && (uchar)ba[3] == 0x00) + return QTextCodec::codecForMib(1019); // utf-32 le + } + + if (arraySize < 2) + return defaultCodec; + if ((uchar)ba[0] == 0xfe && (uchar)ba[1] == 0xff) + return QTextCodec::codecForMib(1013); // utf16 be + else if ((uchar)ba[0] == 0xff && (uchar)ba[1] == 0xfe) + return QTextCodec::codecForMib(1014); // utf16 le + + if (arraySize < 3) + return defaultCodec; + if ((uchar)ba[0] == 0xef + && (uchar)ba[1] == 0xbb + && (uchar)ba[2] == 0xbf) + return QTextCodec::codecForMib(106); // utf-8 + + return defaultCodec; +} + +/*! + \overload + + If the codec cannot be detected, this overload returns a Latin-1 QTextCodec. +*/ +QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba) +{ + return codecForUtfText(ba, QTextCodec::codecForMib(/*Latin 1*/ 4)); +} + /*! \internal \since 4.3 diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index e32650f..83097a5 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -82,6 +82,9 @@ public: static QTextCodec *codecForHtml(const QByteArray &ba); static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec); + static QTextCodec *codecForUtfText(const QByteArray &ba); + static QTextCodec *codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec); + QTextDecoder* makeDecoder() const; QTextEncoder* makeEncoder() const; diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h index 8f11e48..425e7fd 100644 --- a/src/corelib/codecs/qtsciicodec_p.h +++ b/src/corelib/codecs/qtsciicodec_p.h @@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_CODECS -class Q_CORE_EXPORT QTsciiCodec : public QTextCodec { +class QTsciiCodec : public QTextCodec { public: ~QTsciiCodec(); diff --git a/src/corelib/concurrent/qfutureinterface.h b/src/corelib/concurrent/qfutureinterface.h index 85d03c9..345bebe 100644 --- a/src/corelib/concurrent/qfutureinterface.h +++ b/src/corelib/concurrent/qfutureinterface.h @@ -165,6 +165,8 @@ public: QFutureInterface &operator=(const QFutureInterface &other) { + if (referenceCountIsOne()) + resultStore().clear(); QFutureInterfaceBase::operator=(other); return *this; } diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index ada08c7..29e356e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -485,100 +485,27 @@ QT_END_NAMESPACE #if defined(Q_CC_GNU) && defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) && !defined(QT_BOOTSTRAPPED) -# include <sys/syscall.h> -# include <unistd.h> - -static const char boilerplate[] = - "This is the QtCore library version " QT_VERSION_STR "\n" - "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n" - "Contact: Qt Software Information (qt-info@nokia.com)\n" - "\n" - "Build key: " QT_BUILD_KEY; - -extern "C" { -void qt_core_init_boilerplate() __attribute__((noreturn)); -} +# include <stdio.h> +# include <stdlib.h> -# if defined(QT_ARCH_I386) -#define sysinit() (void)0 -#define syswrite(msg, len) \ - ({ int res; \ - asm volatile ("movl %%ebx, %%edi\n" \ - "movl $1, %%ebx\n" \ - "int $0x80\n" \ - "movl %%edi, %%ebx\n" \ - : "=a" (res) : "0" (SYS_write), "c" (msg), "d" (len) : "edi"); res; }) -#define sysexit(c) \ - asm ("xor %%ebx, %%ebx\n" \ - "int $0x80\n" \ - : : "a" (SYS_exit)); _exit(c) - -# elif defined(QT_ARCH_X86_64) -#define sysinit() (void)0 -#define syswrite(msg, len) \ - ({ int res; \ - asm volatile ("syscall\n" \ - : "=a" (res) : "0" (SYS_write), "D" (1), "S" (msg), "d" (len) : "rcx"); res; }) -#define sysexit(c) \ - asm ("syscall\n" \ - : : "a" (SYS_exit), "D" (0)); _exit(c) - -# elif defined(QT_ARCH_IA64) -#define sysinit() \ - asm volatile ("{.mlx\n" \ - " nop.m 0\n" \ - " movl r2 = @pcrel(boilerplate);;" \ - "}\n" \ - "{.mii\n" \ - " mov r10 = @ltoffx(boilerplate)\n" \ - " mov r1 = ip\n" \ - " adds r2 = -16, r2\n;;\n" \ - "}\n" \ - " add r1 = r2, r1;;\n" \ - " sub r1 = r1, r10;;\n" \ - : : : "r2", "r10") -#define syswrite(msg, len) \ - ({ const char *_msg = msg; \ - asm ("mov out0=%1\n" \ - "mov out1=%2\n" \ - "mov out2=%3\n" \ - ";;\n" \ - "mov r15=%0\n" \ - "break 0x100000;;\n" \ - : : "I" (SYS_write), "I" (1), "r" (_msg), "r" (len)); }) -#define sysexit(c) \ - asm ("mov out0=%1\n" \ - ";;\n" \ - "mov r15=%0\n" \ - "break 0x100000;;\n" \ - : : "I" (SYS_exit), "O" (0)); write(1, 0, 0); _exit(c) -# else -#define sysinit() (void)0 -#define syswrite(msg, len) (msg); (len) -#define sysexit(c) __builtin_exit(c) -# endif - -#define sysputs(msg) syswrite(msg, -1 + sizeof(msg)) -#define sysendl() syswrite("\n", 1) -#define print_qt_configure(_which) \ - ({const char *which = _which; \ - which += 12; \ - int len = 0; \ - while (which[len]) ++len; \ - syswrite(which, len); }) +extern const char qt_core_interpreter[] __attribute__((section(".interp"))) + = "/lib/ld-linux.so.2"; +extern "C" void qt_core_init_boilerplate() { - sysinit(); - sysputs(boilerplate); - sysputs("\nInstallation prefix: "); - print_qt_configure(qt_configure_prefix_path_str); - sysputs("\nLibrary path: "); - print_qt_configure(qt_configure_libraries_path_str); - sysputs("\nInclude path: "); - print_qt_configure(qt_configure_headers_path_str); - sysendl(); - sysexit(0); + printf("This is the QtCore library version " QT_VERSION_STR "\n" + "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n" + "Contact: Qt Software Information (qt-info@nokia.com)\n" + "\n" + "Build key: " QT_BUILD_KEY "\n" + "Installation prefix: %s\n" + "Library path: %s\n" + "Include path: %s\n", + qt_configure_prefix_path_str + 12, + qt_configure_libraries_path_str + 12, + qt_configure_headers_path_str + 12); + exit(0); } #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 9b26ef3..3367581 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -503,6 +503,8 @@ public: AA_NativeWindows = 3, AA_DontCreateNativeWidgetSiblings = 4, AA_MacPluginApplication = 5, + AA_DontUseNativeMenuBar = 6, + AA_MacDontSwapCtrlAndMeta = 7, // Add new attributes before this line AA_AttributeCount diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 3690d4b..8f37e25 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -10,9 +10,9 @@ HEADERS += \ io/qdiriterator.h \ io/qfile.h \ io/qfileinfo.h \ - io/qfileinfo_p.h \ io/qiodevice.h \ io/qiodevice_p.h \ + io/qnoncontiguousbytedevice_p.h \ io/qprocess.h \ io/qprocess_p.h \ io/qtextstream.h \ @@ -38,6 +38,7 @@ SOURCES += \ io/qfile.cpp \ io/qfileinfo.cpp \ io/qiodevice.cpp \ + io/qnoncontiguousbytedevice.cpp \ io/qprocess.cpp \ io/qtextstream.cpp \ io/qtemporaryfile.cpp \ diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 9990696..b203899 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -514,7 +514,7 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_4_2 Version 8 (Qt 4.2) \value Qt_4_3 Version 9 (Qt 4.3) \value Qt_4_4 Version 10 (Qt 4.4) - \value Qt_4_5 Version 10 (Qt 4.5) + \value Qt_4_5 Version 11 (Qt 4.5) \omitvalue Qt_4_6 \sa setVersion(), version() diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index d62328f..0dc8a63 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -50,6 +50,7 @@ #include "qstring.h" #include "qregexp.h" #include "qvector.h" +#include "qalgorithms.h" #ifdef QT_BUILD_CORE_LIB # include "qresource.h" #endif @@ -192,32 +193,28 @@ QDirPrivate::~QDirPrivate() /* For sorting */ struct QDirSortItem { - QString filename_cache; - QString suffix_cache; + mutable QString filename_cache; + mutable QString suffix_cache; QFileInfo item; }; -static int qt_cmp_si_sort_flags; -#if defined(Q_C_CALLBACKS) -extern "C" { -#endif -#ifdef Q_OS_WINCE -static int __cdecl qt_cmp_si(const void *n1, const void *n2) -#else -static int qt_cmp_si(const void *n1, const void *n2) -#endif -{ - if (!n1 || !n2) - return 0; +class QDirSortItemComparator { + int qt_cmp_si_sort_flags; +public: + QDirSortItemComparator(int flags) : qt_cmp_si_sort_flags(flags) {} + bool operator()(const QDirSortItem &, const QDirSortItem &); +}; - QDirSortItem* f1 = (QDirSortItem*)n1; - QDirSortItem* f2 = (QDirSortItem*)n2; +bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortItem &n2) +{ + const QDirSortItem* f1 = &n1; + const QDirSortItem* f2 = &n2; if ((qt_cmp_si_sort_flags & QDir::DirsFirst) && (f1->item.isDir() != f2->item.isDir())) - return f1->item.isDir() ? -1 : 1; + return f1->item.isDir(); if ((qt_cmp_si_sort_flags & QDir::DirsLast) && (f1->item.isDir() != f2->item.isDir())) - return f1->item.isDir() ? 1 : -1; + return !f1->item.isDir(); int r = 0; int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask) @@ -266,18 +263,11 @@ static int qt_cmp_si(const void *n1, const void *n2) : f1->filename_cache.compare(f2->filename_cache); } - if (r == 0) // Enforce an order - the order the items appear in the array - r = (char*)n1 - (char*)n2; - if (qt_cmp_si_sort_flags & QDir::Reversed) - return -r; - return r; + return r > 0; + return r < 0; } -#if defined(Q_C_CALLBACKS) -} -#endif - inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l, QStringList *names, QFileInfoList *infos) const { @@ -294,9 +284,8 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l, path += QLatin1Char('/'); si[i].item = QFileInfo(path + l.at(i)); } - qt_cmp_si_sort_flags = sort; if ((sort & QDir::SortByMask) != QDir::Unsorted) - qsort(si, i, sizeof(si[0]), qt_cmp_si); + qStableSort(si, si+i, QDirSortItemComparator(sort)); // put them back in the list(s) for (int j = 0; j<i; j++) { if(infos) diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index a8d28cb..36b1ed8 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -571,7 +571,6 @@ void QFileInfo::setFile(const QFile &file) void QFileInfo::setFile(const QDir &dir, const QString &file) { - Q_D(QFileInfo); *this = QFileInfo(dir.filePath(file)); } diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h deleted file mode 100644 index 7d66581..0000000 --- a/src/corelib/io/qfileinfo_p.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFILEINFO_P_H -#define QFILEINFO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of QIODevice. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qfileinfo.h" - -QT_BEGIN_NAMESPACE - -class QFileInfoPrivate -{ -public: - QFileInfoPrivate(const QFileInfo *copy=0); - ~QFileInfoPrivate(); - - void initFileEngine(const QString &); - - enum Access { - ReadAccess, - WriteAccess, - ExecuteAccess - }; - bool hasAccess(Access access) const; - - uint getFileFlags(QAbstractFileEngine::FileFlags) const; - QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; - QString getFileName(QAbstractFileEngine::FileName) const; - - enum { - CachedFileFlags = 0x01, - CachedLinkTypeFlag = 0x02, - CachedBundleTypeFlag= 0x04, - CachedMTime = 0x10, - CachedCTime = 0x20, - CachedATime = 0x40, - CachedSize = 0x08 - }; - - struct Data - { - inline Data() - : ref(1), fileEngine(0), cache_enabled(1) - { - clear(); - } - - inline Data(const Data ©) - : ref(1), fileEngine(QAbstractFileEngine::create(copy.fileName)), - fileName(copy.fileName), cache_enabled(copy.cache_enabled) - { - clear(); - } - - inline ~Data() - { - delete fileEngine; - } - - inline void clear() - { - fileNames.clear(); - fileFlags = 0; - cachedFlags = 0; - } - - mutable QAtomicInt ref; - - QAbstractFileEngine *fileEngine; - mutable QString fileName; - mutable QHash<int, QString> fileNames; - mutable uint cachedFlags : 31; - mutable uint cache_enabled : 1; - mutable uint fileFlags; - mutable qint64 fileSize; - mutable QDateTime fileTimes[3]; - - inline bool getCachedFlag(uint c) const - { return cache_enabled ? (cachedFlags & c) : 0; } - - inline void setCachedFlag(uint c) - { if (cache_enabled) cachedFlags |= c; } - } *data; - - inline void reset() { - detach(); - data->clear(); - } - - void detach(); -}; - - -QT_END_NAMESPACE -#endif - diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 8a0a3f5..7a6a85b 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -780,7 +780,7 @@ QString QFSFileEngine::fileName(FileName file) const #endif if (len > 0) { QString ret; - if (S_ISDIR(d->st.st_mode) && s[0] != '/') { + if (d->doStat() && S_ISDIR(d->st.st_mode) && s[0] != '/') { QDir parent(d->filePath); parent.cdUp(); ret = parent.path(); diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 63506c2..c5b54b4 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -1392,8 +1392,6 @@ bool QFSFileEnginePrivate::doStat() const if (tmpAttributes != -1) { fileAttrib = tmpAttributes; could_stat = true; - } else { - return false; } #endif } else { diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp new file mode 100644 index 0000000..6233fde --- /dev/null +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -0,0 +1,542 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnoncontiguousbytedevice_p.h" +#include <QObject> +#include <QBuffer> +#include <QDebug> +#include <QFile> + +QT_BEGIN_NAMESPACE + +/*! + \class QNonContiguousByteDevice + \brief A QNonContiguousByteDevice is a representation of a + file, array or buffer that allows access with a read pointer. + \since 4.6 + + \inmodule QtCore + + The goal of this class is to have a data representation that + allows us to avoid doing a memcpy as we have to do with QIODevice. + + \sa QNonContiguousByteDeviceFactory + + \internal +*/ +/*! + \fn virtual const char* QNonContiguousByteDevice::readPointer(qint64 maximumLength, qint64 &len) + + Return a byte pointer for at most \a maximumLength bytes of that device. + if \a maximumLength is -1, the caller does not care about the length and + the device may return what it desires to. + The actual number of bytes the pointer is valid for is returned in + the \a len variable. + \a len will be -1 if EOF or an error occurs. + If it was really EOF can then afterwards be checked with atEnd() + Returns 0 if it is not possible to read at that position. + + \sa atEnd() + + \internal +*/ +/*! + \fn virtual bool QNonContiguousByteDevice::advanceReadPointer(qint64 amount) + + will advance the internal read pointer by \a amount bytes. + The old readPointer is invalid after this call. + + \sa readPointer() + + \internal +*/ +/*! + \fn virtual bool QNonContiguousByteDevice::atEnd() + + Returns true if everything has been read and the read + pointer cannot be advanced anymore. + + \sa readPointer(), advanceReadPointer(), reset() + + \internal +*/ +/*! + \fn virtual bool QNonContiguousByteDevice::reset() + + Moves the internal read pointer back to the beginning. + Returns false if this was not possible. + + \sa atEnd(), disableReset() + + \internal +*/ +/*! + \fn void QNonContiguousByteDevice::disableReset() + + Disable the reset() call, e.g. it will always + do nothing and return false. + + \sa reset() + + \internal +*/ +/*! + \fn virtual qint64 QNonContiguousByteDevice::size() + + Returns the size of the complete device or -1 if unknown. + May also return less/more than what can be actually read with readPointer() + + \internal +*/ +/*! + \fn void QNonContiguousByteDevice::readyRead() + + Emitted when there is data available + + \internal +*/ +/*! + \fn void QNonContiguousByteDevice::readProgress(qint64 current, qint64 total) + + Emitted when data has been "read" by advancing the read pointer + + \internal +*/ + +QNonContiguousByteDevice::QNonContiguousByteDevice() : QObject((QObject*)0), resetDisabled(false) +{ +}; + +QNonContiguousByteDevice::~QNonContiguousByteDevice() +{ +}; + +void QNonContiguousByteDevice::disableReset() +{ + resetDisabled = true; +} + +QNonContiguousByteDeviceBufferImpl::QNonContiguousByteDeviceBufferImpl(QBuffer *b) : QNonContiguousByteDevice() +{ + buffer = b; + byteArray = QByteArray::fromRawData(buffer->buffer().constData() + buffer->pos(), buffer->size() - buffer->pos()); + arrayImpl = new QNonContiguousByteDeviceByteArrayImpl(&byteArray); + arrayImpl->setParent(this); + connect(arrayImpl, SIGNAL(readyRead()), SIGNAL(readyRead())); + connect(arrayImpl, SIGNAL(readProgress(qint64,qint64)), SIGNAL(readProgress(qint64,qint64))); +} + +QNonContiguousByteDeviceBufferImpl::~QNonContiguousByteDeviceBufferImpl() +{ +} + +const char* QNonContiguousByteDeviceBufferImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + return arrayImpl->readPointer(maximumLength, len); +} + +bool QNonContiguousByteDeviceBufferImpl::advanceReadPointer(qint64 amount) +{ + return arrayImpl->advanceReadPointer(amount); +} + +bool QNonContiguousByteDeviceBufferImpl::atEnd() +{ + return arrayImpl->atEnd(); +} + +bool QNonContiguousByteDeviceBufferImpl::reset() +{ + if (resetDisabled) + return false; + return arrayImpl->reset(); +} + +qint64 QNonContiguousByteDeviceBufferImpl::size() +{ + return arrayImpl->size(); +} + +QNonContiguousByteDeviceByteArrayImpl::QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba) : QNonContiguousByteDevice(), currentPosition(0) +{ + byteArray = ba; +} + +QNonContiguousByteDeviceByteArrayImpl::~QNonContiguousByteDeviceByteArrayImpl() +{ +} + +const char* QNonContiguousByteDeviceByteArrayImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + if (atEnd()) { + len = -1; + return 0; + } + + if (maximumLength != -1) + len = qMin(maximumLength, size() - currentPosition); + else + len = size() - currentPosition; + + return byteArray->constData() + currentPosition; +} + +bool QNonContiguousByteDeviceByteArrayImpl::advanceReadPointer(qint64 amount) +{ + currentPosition += amount; + emit readProgress(currentPosition, size()); + return true; +} + +bool QNonContiguousByteDeviceByteArrayImpl::atEnd() +{ + return currentPosition >= size(); +} + +bool QNonContiguousByteDeviceByteArrayImpl::reset() +{ + if (resetDisabled) + return false; + + currentPosition = 0; + return true; +} + +qint64 QNonContiguousByteDeviceByteArrayImpl::size() +{ + return byteArray->size(); +} + +QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb) + : QNonContiguousByteDevice(), currentPosition(0) +{ + ringBuffer = rb; +} + +QNonContiguousByteDeviceRingBufferImpl::~QNonContiguousByteDeviceRingBufferImpl() +{ +}; + +const char* QNonContiguousByteDeviceRingBufferImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + if (atEnd()) { + len = -1; + return 0; + } + + const char *returnValue = ringBuffer->readPointerAtPosition(currentPosition, len); + + if (maximumLength != -1) + len = qMin(len, maximumLength); + + return returnValue; +}; + +bool QNonContiguousByteDeviceRingBufferImpl::advanceReadPointer(qint64 amount) +{ + currentPosition += amount; + emit readProgress(currentPosition, size()); + return true; +}; + +bool QNonContiguousByteDeviceRingBufferImpl::atEnd() +{ + return currentPosition >= size(); +}; + +bool QNonContiguousByteDeviceRingBufferImpl::reset() +{ + if (resetDisabled) + return false; + + currentPosition = 0; + return true; +}; + +qint64 QNonContiguousByteDeviceRingBufferImpl::size() +{ + return ringBuffer->size(); +}; + +QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) + : QNonContiguousByteDevice(), + currentReadBuffer(0), currentReadBufferSize(16*1024), + currentReadBufferAmount(0), currentReadBufferPosition(0), totalAdvancements(0), + eof(false) +{ + device = d; + initialPosition = d->pos(); + connect(device, SIGNAL(readyRead()), this, SIGNAL(readyRead()), Qt::QueuedConnection); + connect(device, SIGNAL(readChannelFinished()), this, SIGNAL(readyRead()), Qt::QueuedConnection); +}; + +QNonContiguousByteDeviceIoDeviceImpl::~QNonContiguousByteDeviceIoDeviceImpl() +{ + delete currentReadBuffer; +}; + +const char* QNonContiguousByteDeviceIoDeviceImpl::readPointer(qint64 maximumLength, qint64 &len) +{ + if (eof == true) { + len = -1; + return 0; + } + + if (currentReadBuffer == 0) + currentReadBuffer = new QByteArray(currentReadBufferSize, '\0'); // lazy alloc + + if (maximumLength == -1) + maximumLength = currentReadBufferSize; + + if (currentReadBufferAmount - currentReadBufferPosition > 0) { + len = currentReadBufferAmount - currentReadBufferPosition; + return currentReadBuffer->data() + currentReadBufferPosition; + } + + qint64 haveRead = device->read(currentReadBuffer->data(), qMin(maximumLength, currentReadBufferSize)); + + if ((haveRead == -1) || (haveRead == 0 && device->atEnd() && !device->isSequential())) { + eof = true; + len = -1; + // size was unknown before, emit a readProgress with the final size + if (size() == -1) + emit readProgress(totalAdvancements, totalAdvancements); + return 0; + } + + currentReadBufferAmount = haveRead; + currentReadBufferPosition = 0; + + len = haveRead; + return currentReadBuffer->data(); +}; + +bool QNonContiguousByteDeviceIoDeviceImpl::advanceReadPointer(qint64 amount) +{ + totalAdvancements += amount; + + // normal advancement + currentReadBufferPosition += amount; + + // advancing over that what has actually been read before + if (currentReadBufferPosition > currentReadBufferAmount) { + qint64 i = currentReadBufferPosition - currentReadBufferAmount; + while (i > 0) { + if (device->getChar(0) == false) { + emit readProgress(totalAdvancements - i, size()); + return false; // ### FIXME handle eof + } + i--; + } + + currentReadBufferPosition = 0; + currentReadBufferAmount = 0; + } + + if (size() == -1) + emit readProgress(totalAdvancements, totalAdvancements); + else + emit readProgress(totalAdvancements, size()); + + return true; +}; + +bool QNonContiguousByteDeviceIoDeviceImpl::atEnd() +{ + return eof == true; +}; + +bool QNonContiguousByteDeviceIoDeviceImpl::reset() +{ + if (resetDisabled) + return false; + + if (device->seek(initialPosition)) { + eof = false; // assume eof is false, it will be true after a read has been attempted + return true; + } + + return false; +}; + +qint64 QNonContiguousByteDeviceIoDeviceImpl::size() +{ + // note that this is different from the size() implementation of QIODevice! + + if (device->isSequential()) + return -1; + + return device->size() - initialPosition; +}; + +QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) +{ + byteDevice = bd; + connect(bd, SIGNAL(readyRead()), SIGNAL(readyRead())); + + open(ReadOnly); +} + +QByteDeviceWrappingIoDevice::~QByteDeviceWrappingIoDevice() +{ + +} + +bool QByteDeviceWrappingIoDevice::isSequential() const +{ + return (byteDevice->size() == -1); +} + +bool QByteDeviceWrappingIoDevice::atEnd() const +{ + return byteDevice->atEnd(); +} + +bool QByteDeviceWrappingIoDevice::reset() +{ + return byteDevice->reset(); +} + +qint64 QByteDeviceWrappingIoDevice::size() const +{ + if (isSequential()) + return 0; + + return byteDevice->size(); +} + + +qint64 QByteDeviceWrappingIoDevice::readData( char * data, qint64 maxSize) +{ + qint64 len; + const char *readPointer = byteDevice->readPointer(maxSize, len); + if (len == -1) + return -1; + + memcpy(data, readPointer, len); + byteDevice->advanceReadPointer(len); + return len; +} + +qint64 QByteDeviceWrappingIoDevice::writeData( const char* data, qint64 maxSize) +{ + return -1; +} + +/*! + \class QNonContiguousByteDeviceFactory + \since 4.6 + + \inmodule QtCore + + Creates a QNonContiguousByteDevice out of a QIODevice, + QByteArray etc. + + \sa QNonContiguousByteDevice + + \internal +*/ + +/*! + \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device); + + Create a QNonContiguousByteDevice out of a QIODevice. + For QFile, QBuffer and all other QIoDevice, sequential or not. + + \internal +*/ +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QIODevice *device) +{ + // shortcut if it is a QBuffer + if (QBuffer* buffer = qobject_cast<QBuffer*>(device)) { + return new QNonContiguousByteDeviceBufferImpl(buffer); + } + + // ### FIXME special case if device is a QFile that supports map() + // then we can actually deal with the file without using read/peek + + // generic QIODevice + return new QNonContiguousByteDeviceIoDeviceImpl(device); // FIXME +}; + +/*! + \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QRingBuffer *ringBuffer); + + Create a QNonContiguousByteDevice out of a QRingBuffer. + + \internal +*/ +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QRingBuffer *ringBuffer) +{ + return new QNonContiguousByteDeviceRingBufferImpl(ringBuffer); +}; + +/*! + \fn static QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray); + + Create a QNonContiguousByteDevice out of a QByteArray. + + \internal +*/ +QNonContiguousByteDevice* QNonContiguousByteDeviceFactory::create(QByteArray *byteArray) +{ + return new QNonContiguousByteDeviceByteArrayImpl(byteArray); +}; + +/*! + \fn static QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice); + + Wrap the \a byteDevice (possibly again) into a QIODevice. + + \internal +*/ +QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteDevice) +{ + // ### FIXME if it already has been based on QIoDevice, we could that one out again + // and save some calling + + // needed for FTP backend + + return new QByteDeviceWrappingIoDevice(byteDevice); +} + +QT_END_NAMESPACE + diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h new file mode 100644 index 0000000..2a7e40b --- /dev/null +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNONCONTIGUOUSBYTEDEVICE_H +#define QNONCONTIGUOUSBYTEDEVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of a number of Qt sources files. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include <QObject> +#include <QtCore/qbytearray.h> +#include <QtCore/qbuffer.h> +#include <QtCore/qiodevice.h> +#include "private/qringbuffer_p.h" + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QNonContiguousByteDevice : public QObject +{ + Q_OBJECT +public: + virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0; + virtual bool advanceReadPointer(qint64 amount) = 0; + virtual bool atEnd() = 0; + virtual bool reset() = 0; + void disableReset(); + virtual qint64 size() = 0; + +protected: + QNonContiguousByteDevice(); + virtual ~QNonContiguousByteDevice(); + + bool resetDisabled; +signals: + void readyRead(); + void readProgress(qint64 current, qint64 total); +}; + +class Q_CORE_EXPORT QNonContiguousByteDeviceFactory +{ +public: + static QNonContiguousByteDevice* create(QIODevice *device); + static QNonContiguousByteDevice* create(QByteArray *byteArray); + static QNonContiguousByteDevice* create(QRingBuffer *ringBuffer); + static QIODevice* wrap(QNonContiguousByteDevice* byteDevice); +}; + +// the actual implementations +// + +class QNonContiguousByteDeviceByteArrayImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba); + ~QNonContiguousByteDeviceByteArrayImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QByteArray* byteArray; + qint64 currentPosition; +}; + +class QNonContiguousByteDeviceRingBufferImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb); + ~QNonContiguousByteDeviceRingBufferImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QRingBuffer* ringBuffer; + qint64 currentPosition; +}; + + +class QNonContiguousByteDeviceIoDeviceImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d); + ~QNonContiguousByteDeviceIoDeviceImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QIODevice* device; + QByteArray* currentReadBuffer; + qint64 currentReadBufferSize; + qint64 currentReadBufferAmount; + qint64 currentReadBufferPosition; + qint64 totalAdvancements; + bool eof; + qint64 initialPosition; +}; + +class QNonContiguousByteDeviceBufferImpl : public QNonContiguousByteDevice +{ + Q_OBJECT +public: + QNonContiguousByteDeviceBufferImpl(QBuffer *b); + ~QNonContiguousByteDeviceBufferImpl(); + const char* readPointer(qint64 maximumLength, qint64 &len); + bool advanceReadPointer(qint64 amount); + bool atEnd(); + bool reset(); + qint64 size(); +protected: + QBuffer* buffer; + QByteArray byteArray; + QNonContiguousByteDeviceByteArrayImpl* arrayImpl; +}; + +// ... and the reverse thing +class QByteDeviceWrappingIoDevice : public QIODevice +{ + Q_OBJECT +public: + QByteDeviceWrappingIoDevice (QNonContiguousByteDevice *bd); + ~QByteDeviceWrappingIoDevice (); + virtual bool isSequential () const; + virtual bool atEnd () const; + virtual bool reset (); + virtual qint64 size () const; +protected: + virtual qint64 readData ( char * data, qint64 maxSize ); + virtual qint64 writeData ( const char * data, qint64 maxSize ); + + QNonContiguousByteDevice *byteDevice; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index dd72fd9..93d07e0 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -146,7 +146,7 @@ inline QString QSettingsGroup::toString() const return result; } -class Q_CORE_EXPORT QConfFile +class QConfFile { public: ParsedSettingsMap mergedKeyMap() const; diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 4856353..6a9125c 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -294,6 +294,8 @@ public: QTemporaryFileEngine(const QString &file) : QFSFileEngine(file) { } ~QTemporaryFileEngine(); + void setFileName(const QString &file); + bool open(QIODevice::OpenMode flags); bool remove(); bool close(); @@ -304,6 +306,13 @@ QTemporaryFileEngine::~QTemporaryFileEngine() QFSFileEngine::close(); } +void QTemporaryFileEngine::setFileName(const QString &file) +{ + // Really close the file, so we don't leak + QFSFileEngine::close(); + QFSFileEngine::setFileName(file); +} + bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode) { Q_D(QFSFileEngine); diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 73408dc..612d7f7 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -67,8 +67,10 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384; \snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 1 Note that you cannot use QTextStream::atEnd(), which returns true when you - have reached the end of the data stream, with stdin. - + have reached the end of the data stream, with stdin. The reason for this is + that as long as stdin doesn't give any input to the QTextStream, \c atEnd() + will return true even if the stdin is open and waiting for more characters. + Besides using QTextStream's constructors, you can also set the device or string QTextStream operates on by calling setDevice() or setString(). You can seek to a position by calling seek(), and @@ -559,13 +561,8 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes) if (!codec || autoDetectUnicode) { autoDetectUnicode = false; - if (bytesRead >= 4 && ((uchar(buf[0]) == 0xff && uchar(buf[1]) == 0xfe && uchar(buf[2]) == 0 && uchar(buf[3]) == 0) - || (uchar(buf[0]) == 0 && uchar(buf[1]) == 0 && uchar(buf[2]) == 0xfe && uchar(buf[3]) == 0xff))) { - codec = QTextCodec::codecForName("UTF-32"); - } else if (bytesRead >= 2 && ((uchar(buf[0]) == 0xff && uchar(buf[1]) == 0xfe) - || (uchar(buf[0]) == 0xfe && uchar(buf[1]) == 0xff))) { - codec = QTextCodec::codecForName("UTF-16"); - } else if (!codec) { + codec = QTextCodec::codecForUtfText(QByteArray::fromRawData(buf, bytesRead), 0); + if (!codec) { codec = QTextCodec::codecForLocale(); writeConverterState.flags |= QTextCodec::IgnoreHeader; } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e4bd664..c21cf87 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -556,6 +556,20 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on) QCoreApplicationPrivate::attribs |= 1 << attribute; else QCoreApplicationPrivate::attribs &= ~(1 << attribute); +#ifdef Q_OS_MAC + // Turn on the no native menubar here, since we used to + // do this implicitly. We DO NOT flip it off if someone sets + // it to false. + // Ideally, we'd have magic that would be something along the lines of + // "follow MacPluginApplication" unless explicitly set. + // Considering this attribute isn't only at the beginning + // it's unlikely it will ever be a problem, but I want + // to have the behavior documented here. + if (attribute == Qt::AA_MacPluginApplication && on + && !testAttribute(Qt::AA_DontUseNativeMenuBar)) { + setAttribute(Qt::AA_DontUseNativeMenuBar, true); + } +#endif } /*! diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp index 1c929c7..e0f7687 100644 --- a/src/corelib/kernel/qfunctions_wince.cpp +++ b/src/corelib/kernel/qfunctions_wince.cpp @@ -285,11 +285,6 @@ int qt_wince_SetErrorMode(int newValue) return result; } -HRESULT qt_wince_CoInitialize(void* reserved) -{ - return CoInitializeEx(reserved, 0); -} - bool qt_wince__chmod(const char *file, int mode) { return _wchmod( reinterpret_cast<const wchar_t *> (QString::fromLatin1(file).utf16()), mode); diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h index 123bd23..5f08bb3 100644 --- a/src/corelib/kernel/qfunctions_wince.h +++ b/src/corelib/kernel/qfunctions_wince.h @@ -199,7 +199,9 @@ int qt_wince__fstat( int handle, struct stat *buffer); #define SEM_FAILCRITICALERRORS 0x0001 #define SEM_NOOPENFILEERRORBOX 0x0002 int qt_wince_SetErrorMode(int); -HRESULT qt_wince_CoInitialize(void* reserved); +#ifndef CoInitialize +#define CoInitialize(x) CoInitializeEx(x, COINIT_MULTITHREADED) +#endif bool qt_wince__chmod(const char *file, int mode); bool qt_wince__wchmod(const WCHAR *file, int mode); @@ -376,7 +378,6 @@ typedef DWORD OLE_COLOR; #define _rename(a,b) qt_wince__rename(a,b) #define _remove(a) qt_wince__remove(a) #define SetErrorMode(a) qt_wince_SetErrorMode(a) -#define CoInitialize(a) qt_wince_CoInitialize(a) #define _chmod(a,b) qt_wince__chmod(a,b) #define _wchmod(a,b) qt_wince__wchmod(a,b) #define CreateFileA(a,b,c,d,e,f,g) qt_wince_CreateFileA(a,b,c,d,e,f,g) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 05015c0..287ac30 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -70,7 +70,7 @@ static int DIRECT_CONNECTION_ONLY = 0; static int *queuedConnectionTypes(const QList<QByteArray> &typeNames) { - int *types = static_cast<int *>(qMalloc((typeNames.count() + 1) * sizeof(int))); + int *types = new int [typeNames.count() + 1]; for (int i = 0; i < typeNames.count(); ++i) { const QByteArray typeName = typeNames.at(i); if (typeName.endsWith('*')) @@ -82,7 +82,7 @@ static int *queuedConnectionTypes(const QList<QByteArray> &typeNames) qWarning("QObject::connect: Cannot queue arguments of type '%s'\n" "(Make sure '%s' is registered using qRegisterMetaType().)", typeName.constData(), typeName.constData()); - qFree(types); + delete [] types; return 0; } } @@ -216,6 +216,7 @@ public: } }; +// Used by QAccessibleWidget bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const { Q_Q(const QObject); @@ -227,8 +228,8 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const if (signal_index < connectionLists->count()) { const ConnectionList &connectionList = connectionLists->at(signal_index); for (int i = 0; i < connectionList.count(); ++i) { - const QObjectPrivate::Connection &c = connectionList.at(i); - if (c.receiver && c.receiver == receiver) + const QObjectPrivate::Connection *c = connectionList.at(i); + if (c->receiver == receiver) return true; } } @@ -236,6 +237,7 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const return false; } +// Used by QAccessibleWidget QObjectList QObjectPrivate::receiverList(const char *signal) const { Q_Q(const QObject); @@ -248,21 +250,22 @@ QObjectList QObjectPrivate::receiverList(const char *signal) const if (signal_index < connectionLists->count()) { const ConnectionList &connectionList = connectionLists->at(signal_index); for (int i = 0; i < connectionList.count(); ++i) { - const QObjectPrivate::Connection &c = connectionList.at(i); - if (c.receiver) - returnValue << c.receiver; + const QObjectPrivate::Connection *c = connectionList.at(i); + if (c->receiver) + returnValue << c->receiver; } } } return returnValue; } +// Used by QAccessibleWidget QObjectList QObjectPrivate::senderList() const { QObjectList returnValue; QMutexLocker locker(&threadData->mutex); for (int i = 0; i < senders.count(); ++i) - returnValue << senders.at(i).sender; + returnValue << senders.at(i)->sender; return returnValue; } @@ -274,33 +277,11 @@ void QObjectPrivate::addConnection(int signal, Connection *c) connectionLists->resize(signal + 1); ConnectionList &connectionList = (*connectionLists)[signal]; - connectionList.append(*c); + connectionList.append(c); cleanConnectionLists(); } -void QObjectPrivate::removeReceiver(int signal, QObject *receiver) -{ - if (!connectionLists) - return; - - if (signal >= connectionLists->count()) - return; - - ConnectionList &connectionList = (*connectionLists)[signal]; - for (int i = 0; i < connectionList.count(); ++i) { - Connection &c = connectionList[i]; - if (c.receiver == receiver) { - c.receiver = 0; - if (c.argumentTypes && c.argumentTypes != &DIRECT_CONNECTION_ONLY) { - qFree(c.argumentTypes); - c.argumentTypes = 0; - } - connectionLists->dirty = true; - } - } -} - void QObjectPrivate::cleanConnectionLists() { if (connectionLists->dirty && !connectionLists->inUse) { @@ -308,55 +289,17 @@ void QObjectPrivate::cleanConnectionLists() for (int signal = -1; signal < connectionLists->count(); ++signal) { QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal]; for (int i = 0; i < connectionList.count(); ++i) { - const QObjectPrivate::Connection &c = connectionList.at(i); - if (!c.receiver) + QObjectPrivate::Connection *c = connectionList.at(i); + if (!c->receiver) { + delete c; connectionList.removeAt(i--); + } } } connectionLists->dirty = false; } } -void QObjectPrivate::refSender(QObject *sender, int signal) -{ - for (int i = 0; i < senders.count(); ++i) { - Sender &s = senders[i]; - if (s.sender == sender && s.signal == signal) { - ++s.ref; - return; - } - } - - Sender s = { sender, signal, 1 }; - senders.append(s); -} - -void QObjectPrivate::derefSender(QObject *sender, int signal) -{ - for (int i = 0; i < senders.count(); ++i) { - Sender &s = senders[i]; - if (s.sender == sender && s.signal == signal) { - if (--s.ref == 0) { - senders.removeAt(i); - break; - } - } - } - // Q_ASSERT_X(false, "QObjectPrivate::derefSender", "sender not found"); -} - -void QObjectPrivate::removeSender(QObject *sender, int signal) -{ - for (int i = 0; i < senders.count(); ++i) { - Sender &s = senders[i]; - if (s.sender == sender && s.signal == signal) { - senders.removeAt(i); - return; - } - } - // Q_ASSERT_X(false, "QObjectPrivate::removeSender", "sender not found"); -} - QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver, Sender *sender) { @@ -782,23 +725,21 @@ QObject::~QObject() for (int signal = -1; signal < d->connectionLists->count(); ++signal) { QObjectPrivate::ConnectionList &connectionList = (*d->connectionLists)[signal]; for (int i = 0; i < connectionList.count(); ++i) { - QObjectPrivate::Connection *c = &connectionList[i]; - if (!c->receiver) + QObjectPrivate::Connection *c = connectionList[i]; + if (!c->receiver) { + delete c; continue; + } QMutex *m = &c->receiver->d_func()->threadData->mutex; bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); - c = &connectionList[i]; + c = connectionList[i]; if (c->receiver) - c->receiver->d_func()->removeSender(this, signal); + c->receiver->d_func()->senders.removeOne(c); if (needToUnlock) m->unlock(); - if (c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) { - qFree(c->argumentTypes); - c->argumentTypes = 0; - } - c->receiver = 0; + delete c; } } @@ -812,15 +753,20 @@ QObject::~QObject() // disconnect all senders for (int i = 0; i < d->senders.count(); ++i) { - QObjectPrivate::Sender *s = &d->senders[i]; + QObjectPrivate::Connection *s = d->senders[i]; if (!s->sender) continue; QMutex *m = &s->sender->d_func()->threadData->mutex; bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m); - s = &d->senders[i]; - if (s->sender) - s->sender->d_func()->removeReceiver(s->signal, this); + s = d->senders[i]; + s->receiver = 0; + if (s->sender) { + QObjectConnectionListVector *senderLists = s->sender->d_func()->connectionLists; + if (senderLists) + senderLists->dirty = true; + } + if (needToUnlock) m->unlock(); } @@ -866,6 +812,12 @@ QObject::~QObject() d_ptr = 0; } +QObjectPrivate::Connection::~Connection() +{ + if (argumentTypes != &DIRECT_CONNECTION_ONLY) + delete [] argumentTypes; +} + /*! \fn QMetaObject *QObject::metaObject() const @@ -2304,7 +2256,7 @@ QObject *QObject::sender() const // Return 0 if d->currentSender isn't in d->senders bool found = false; for (int i = 0; !found && i < d->senders.count(); ++i) - found = (d->senders.at(i).sender == d->currentSender->sender); + found = (d->senders.at(i)->sender == d->currentSender->sender); if (!found) return 0; return d->currentSender->sender; @@ -2359,8 +2311,8 @@ int QObject::receivers(const char *signal) const const QObjectPrivate::ConnectionList &connectionList = d->connectionLists->at(signal_index); for (int i = 0; i < connectionList.count(); ++i) { - const QObjectPrivate::Connection &c = connectionList.at(i); - receivers += c.receiver ? 1 : 0; + const QObjectPrivate::Connection *c = connectionList.at(i); + receivers += c->receiver ? 1 : 0; } } } @@ -2793,20 +2745,18 @@ bool QMetaObject::connect(const QObject *sender, int signal_index, QObject *s = const_cast<QObject *>(sender); QObject *r = const_cast<QObject *>(receiver); + QObjectPrivate::Connection *c = new QObjectPrivate::Connection; + c->sender = s; + c->receiver = r; + c->method = method_index; + c->connectionType = type; + c->argumentTypes = types; + QOrderedMutexLocker locker(&s->d_func()->threadData->mutex, &r->d_func()->threadData->mutex); -#if defined(Q_CC_HPACC) && defined(QT_ARCH_PARISC) - QObjectPrivate::Connection c; - c.receiver = r; - c.method = method_index; - c.connectionType = type; - c.argumentTypes = types; -#else - QObjectPrivate::Connection c = { r, method_index, type, Q_BASIC_ATOMIC_INITIALIZER(types) }; -#endif - s->d_func()->addConnection(signal_index, &c); - r->d_func()->refSender(s, signal_index); + s->d_func()->addConnection(signal_index, c); + r->d_func()->senders.append(c); if (signal_index < 0) sender->d_func()->connectedSignals = ~0u; @@ -2845,27 +2795,23 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, for (signal_index = -1; signal_index < connectionLists->count(); ++signal_index) { QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal_index]; for (int i = 0; i < connectionList.count(); ++i) { - QObjectPrivate::Connection *c = &connectionList[i]; + QObjectPrivate::Connection *c = connectionList[i]; if (c->receiver && (r == 0 || (c->receiver == r && (method_index < 0 || c->method == method_index)))) { QMutex *m = &c->receiver->d_func()->threadData->mutex; + bool needToUnlock = false; if (!receiverMutex && senderMutex != m) { // need to relock this receiver and sender in the correct order - bool needToUnlock = QOrderedMutexLocker::relock(senderMutex, m); - c = &connectionList[i]; - if (c->receiver) - c->receiver->d_func()->derefSender(s, signal_index); - if (needToUnlock) - m->unlock(); - } else { - // no need to unlock - c->receiver->d_func()->derefSender(s, signal_index); - } - if (c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) { - qFree(c->argumentTypes); - c->argumentTypes = 0; + needToUnlock = QOrderedMutexLocker::relock(senderMutex, m); + c = connectionList[i]; } + if (c->receiver) + c->receiver->d_func()->senders.removeOne(c); + + if (needToUnlock) + m->unlock(); + c->receiver = 0; success = true; @@ -2876,27 +2822,22 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index, } else if (signal_index < connectionLists->count()) { QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal_index]; for (int i = 0; i < connectionList.count(); ++i) { - QObjectPrivate::Connection *c = &connectionList[i]; + QObjectPrivate::Connection *c = connectionList[i]; if (c->receiver && (r == 0 || (c->receiver == r && (method_index < 0 || c->method == method_index)))) { QMutex *m = &c->receiver->d_func()->threadData->mutex; + bool needToUnlock = false; if (!receiverMutex && senderMutex != m) { // need to relock this receiver and sender in the correct order - bool needToUnlock = QOrderedMutexLocker::relock(senderMutex, m); - c = &connectionList[i]; - if (c->receiver) - c->receiver->d_func()->derefSender(s, signal_index); - if (needToUnlock) - m->unlock(); - } else { - // no need to unlock - c->receiver->d_func()->derefSender(s, signal_index); - } - if (c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) { - qFree(c->argumentTypes); - c->argumentTypes = 0; + needToUnlock = QOrderedMutexLocker::relock(senderMutex, m); + c = connectionList[i]; } + if (c->receiver) + c->receiver->d_func()->senders.removeOne(c); + + if (needToUnlock) + m->unlock(); c->receiver = 0; success = true; @@ -2979,32 +2920,31 @@ void QMetaObject::connectSlotsByName(QObject *o) } } -static void queued_activate(QObject *sender, int signal, const QObjectPrivate::Connection &c, +static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connection *c, void **argv, QSemaphore *semaphore = 0) { - if (!c.argumentTypes || c.argumentTypes != &DIRECT_CONNECTION_ONLY) { + if (!c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) { QMetaMethod m = sender->metaObject()->method(signal); - QObjectPrivate::Connection &x = const_cast<QObjectPrivate::Connection &>(c); int *tmp = queuedConnectionTypes(m.parameterTypes()); if (!tmp) // cannot queue arguments tmp = &DIRECT_CONNECTION_ONLY; - if (!x.argumentTypes.testAndSetOrdered(0, tmp)) { + if (!c->argumentTypes.testAndSetOrdered(0, tmp)) { if (tmp != &DIRECT_CONNECTION_ONLY) - qFree(tmp); + delete [] tmp; } } - if (c.argumentTypes == &DIRECT_CONNECTION_ONLY) // cannot activate + if (c->argumentTypes == &DIRECT_CONNECTION_ONLY) // cannot activate return; int nargs = 1; // include return type - while (c.argumentTypes[nargs-1]) + while (c->argumentTypes[nargs-1]) ++nargs; int *types = (int *) qMalloc(nargs*sizeof(int)); void **args = (void **) qMalloc(nargs*sizeof(void *)); types[0] = 0; // return type args[0] = 0; // return value for (int n = 1; n < nargs; ++n) - args[n] = QMetaType::construct((types[n] = c.argumentTypes[n-1]), argv[n]); - QCoreApplication::postEvent(c.receiver, new QMetaCallEvent(c.method, + args[n] = QMetaType::construct((types[n] = c->argumentTypes[n-1]), argv[n]); + QCoreApplication::postEvent(c->receiver, new QMetaCallEvent(c->method, sender, signal, nargs, @@ -3013,13 +2953,13 @@ static void queued_activate(QObject *sender, int signal, const QObjectPrivate::C semaphore)); } -static void blocking_activate(QObject *sender, int signal, const QObjectPrivate::Connection &c, void **argv) +static void blocking_activate(QObject *sender, int signal, QObjectPrivate::Connection *c, void **argv) { - if (QThread::currentThread() == c.receiver->thread()) { + if (QThread::currentThread() == c->receiver->thread()) { qWarning("Qt: Dead lock detected while activating a BlockingQueuedConnection: " "Sender is %s(%p), receiver is %s(%p)", sender->metaObject()->className(), sender, - c.receiver->metaObject()->className(), c.receiver); + c->receiver->metaObject()->className(), c->receiver); } #ifdef QT_NO_THREAD @@ -3069,7 +3009,7 @@ void QMetaObject::activate(QObject *sender, int from_signal_index, int to_signal } int count = connectionLists->at(signal).count(); for (int i = 0; i < count; ++i) { - const QObjectPrivate::Connection *c = &connectionLists->at(signal)[i]; + QObjectPrivate::Connection *c = connectionLists->at(signal)[i]; if (!c->receiver) continue; @@ -3081,10 +3021,10 @@ void QMetaObject::activate(QObject *sender, int from_signal_index, int to_signal && (currentThreadData != sender->d_func()->threadData || receiver->d_func()->threadData != sender->d_func()->threadData)) || (c->connectionType == Qt::QueuedConnection)) { - queued_activate(sender, signal, *c, argv); + queued_activate(sender, signal, c, argv); continue; } else if (c->connectionType == Qt::BlockingQueuedConnection) { - blocking_activate(sender, signal, *c, argv); + blocking_activate(sender, signal, c, argv); continue; } @@ -3412,16 +3352,16 @@ void QObject::dumpObjectInfo() // receivers const QObjectPrivate::ConnectionList &connectionList = d->connectionLists->at(signal_index); for (int i = 0; i < connectionList.count(); ++i) { - const QObjectPrivate::Connection &c = connectionList.at(i); - if (!c.receiver) { + const QObjectPrivate::Connection *c = connectionList.at(i); + if (!c->receiver) { qDebug(" <Disconnected receiver>"); continue; } - const QMetaObject *receiverMetaObject = c.receiver->metaObject(); - const QMetaMethod method = receiverMetaObject->method(c.method); + const QMetaObject *receiverMetaObject = c->receiver->metaObject(); + const QMetaMethod method = receiverMetaObject->method(c->method); qDebug(" --> %s::%s %s", receiverMetaObject->className(), - c.receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c.receiver->objectName()), + c->receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver->objectName()), method.signature()); } } @@ -3434,13 +3374,12 @@ void QObject::dumpObjectInfo() if (!d->senders.isEmpty()) { for (int i = 0; i < d->senders.count(); ++i) { - const QObjectPrivate::Sender &s = d->senders.at(i); - const QMetaObject *senderMetaObject = s.sender->metaObject(); - const QMetaMethod signal = senderMetaObject->method(s.signal); - qDebug(" <-- %s::%s %s", - senderMetaObject->className(), - s.sender->objectName().isEmpty() ? "unnamed" : qPrintable(s.sender->objectName()), - signal.signature()); + const QObjectPrivate::Connection *s = d->senders.at(i); + const QMetaMethod slot = metaObject()->method(s->method); + qDebug(" <-- %s::%s %s", + s->sender->metaObject()->className(), + s->sender->objectName().isEmpty() ? "unnamed" : qPrintable(s->sender->objectName()), + slot.signature()); } } else { qDebug(" <None>"); diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index b324334..96d79af 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -114,7 +114,6 @@ public: int signal; int ref; }; - // object currently activating the object Sender *currentSender; @@ -148,22 +147,20 @@ public: // Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions struct Connection { + QObject *sender; QObject *receiver; int method; uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking QBasicAtomicPointer<int> argumentTypes; + ~Connection(); }; - typedef QList<Connection> ConnectionList; + typedef QList<Connection *> ConnectionList; QObjectConnectionListVector *connectionLists; void addConnection(int signal, Connection *c); - void removeReceiver(int signal, QObject *receiver); void cleanConnectionLists(); - QList<Sender> senders; - void refSender(QObject *sender, int signal); - void derefSender(QObject *sender, int signal); - void removeSender(QObject *sender, int signal); + ConnectionList senders; static Sender *setCurrentSender(QObject *receiver, Sender *sender); @@ -208,7 +205,7 @@ private: QSemaphore *semaphore_; }; -class Q_CORE_EXPORT QBoolBlocker +class QBoolBlocker { public: inline QBoolBlocker(bool &b, bool value=true):block(b), reset(b){block = value;} diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index 4d0e53c..121a875 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -63,6 +63,21 @@ typedef QObject *(*QtPluginInstanceFunction)(); void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function); +struct qt_plugin_instance_deleter +{ + qt_plugin_instance_deleter(QPointer<QObject> &instance) + : instance_(instance) + { + } + + ~qt_plugin_instance_deleter() + { + delete instance_; + } + + QPointer<QObject> &instance_; +}; + #define Q_IMPORT_PLUGIN(PLUGIN) \ extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \ class Static##PLUGIN##PluginInstance{ \ @@ -76,8 +91,10 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio #define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \ { \ static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \ - if (!_instance) \ + if (!_instance) { \ + static QT_PREPEND_NAMESPACE(qt_plugin_instance_deleter) deleter(_instance); \ _instance = new IMPLEMENTATION; \ + } \ return _instance; \ } diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 21d98b5..2313e0e 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -379,6 +379,107 @@ void QHashData::checkSanity() #endif /*! + \fn uint qHash(const QPair<T1, T2> &key) + \since 4.3 + \relates QHash + + Returns the hash value for the \a key. + + Types \c T1 and \c T2 must be supported by qHash(). +*/ + +/*! \fn uint qHash(char key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(uchar key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(signed char key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(ushort key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(short key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(uint key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(int key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(ulong key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(long key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(quint64 key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(qint64 key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(QChar key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(const QByteArray &key) + \fn uint qHash(const QBitArray &key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(const QString &key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \fn uint qHash(const T *key) + \relates QHash + + Returns the hash value for the \a key. +*/ + +/*! \class QHash \brief The QHash class is a template class that provides a hash-table-based dictionary. @@ -401,7 +502,8 @@ void QHashData::checkSanity() key. With QHash, the items are arbitrarily ordered. \i The key type of a QMap must provide operator<(). The key type of a QHash must provide operator==() and a global - \l{qHash()}{qHash}(Key) function. + hash function called qHash() (see the related non-member + functions). \endlist Here's an example QHash with QString keys and \c int values: @@ -732,7 +834,6 @@ void QHashData::checkSanity() */ /*! \fn const T QHash::value(const Key &key, const T &defaultValue) const - \overload If the hash contains no item with the given \a key, the function returns @@ -1490,121 +1591,6 @@ void QHashData::checkSanity() \sa operator+=(), operator-() */ -/*! \fn uint qHash(char key) - \relates QHash - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(uchar key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(signed char key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(ushort key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(short key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(uint key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(int key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(ulong key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(long key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(quint64 key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(qint64 key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(QChar key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(const QByteArray &key) - \fn uint qHash(const QBitArray &key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(const QString &key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! \fn uint qHash(const T *key) - \relates QHash - \overload - - Returns the hash value for the \a key. -*/ - -/*! - \fn uint qHash(const QPair<T1, T2> &key) - \relates QHash - \since 4.3 - - Returns the hash value for the \a key. - - Types \c T1 and \c T2 must be supported by qHash(). -*/ - /*! \fn QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash) \relates QHash diff --git a/src/corelib/tools/qlistdata.cpp b/src/corelib/tools/qlistdata.cpp index d7c39a7..d40b6b6 100644 --- a/src/corelib/tools/qlistdata.cpp +++ b/src/corelib/tools/qlistdata.cpp @@ -764,6 +764,10 @@ void **QListData::erase(void **xi) This function requires the value type to have an implementation of \c operator==(). + Note that QList uses 0-based indexes, just like C++ arrays. Negative + indexes are not supported with the exception of the value mentioned + above. + \sa lastIndexOf(), contains() */ @@ -780,6 +784,10 @@ void **QListData::erase(void **xi) This function requires the value type to have an implementation of \c operator==(). + Note that QList uses 0-based indexes, just like C++ arrays. Negative + indexes are not supported with the exception of the value mentioned + above. + \sa indexOf() */ diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 559ba81..a2154a9 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -5367,6 +5367,14 @@ static Bigint *mult(Bigint *a, Bigint *b) static Bigint *p5s; +struct p5s_deleter +{ + ~p5s_deleter() + { + Bfree(p5s); + } +}; + static Bigint *pow5mult(Bigint *b, int k) { Bigint *b1, *p5, *p51; @@ -5388,6 +5396,7 @@ static Bigint *pow5mult(Bigint *b, int k) return b; if (!(p5 = p5s)) { /* first time */ + static p5s_deleter deleter; p5 = p5s = i2b(625); p5->next = 0; } diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 3a0901d..02cc497 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class Q_CORE_EXPORT QRingBuffer +class QRingBuffer { public: inline QRingBuffer(int growth = 4096) : basicBlockSize(growth) { @@ -74,6 +74,52 @@ public: return buffers.isEmpty() ? 0 : (buffers.first().constData() + head); } + // access the bytes at a specified position + // the out-variable length will contain the amount of bytes readable + // from there, e.g. the amount still the same QByteArray + inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const { + if (buffers.isEmpty()) { + length = 0; + return 0; + } + + if (pos >= bufferSize) { + length = 0; + return 0; + } + + // special case: it is in the first buffer + int nextDataBlockSizeValue = nextDataBlockSize(); + if (pos - head < nextDataBlockSizeValue) { + length = nextDataBlockSizeValue - pos; + return buffers.at(0).constData() + head + pos; + } + + // special case: we only had one buffer and tried to read over it + if (buffers.length() == 1) { + length = 0; + return 0; + } + + // skip the first + pos -= nextDataBlockSizeValue; + + // normal case: it is somewhere in the second to the-one-before-the-tailBuffer + for (int i = 1; i < tailBuffer; i++) { + if (pos >= buffers[i].size()) { + pos -= buffers[i].size(); + continue; + } + + length = buffers[i].length() - pos; + return buffers[i].constData() + pos; + } + + // it is in the tail buffer + length = tail - pos; + return buffers[tailBuffer].constData() + pos; + } + inline void free(int bytes) { bufferSize -= bytes; if (bufferSize < 0) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 375d672..c3649e3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -743,7 +743,9 @@ int QString::grow(int size) /*! \since 4.2 - Returns a copy of the \a string string encoded in ucs4. + Returns a copy of the \a string, where the encoding of \a string depends on + the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4, + if wchar is 2 bytes it is interpreted as ucs-2. If \a size is -1 (default), the \a string has to be 0 terminated. diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 1493dce..69c4f2f 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -113,7 +113,7 @@ public: int capacity() const; inline void reserve(int size); - inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;} + inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;} inline const QChar *unicode() const; inline QChar *data(); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 3fd52ee..1f047b8 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -315,7 +315,7 @@ void QVector<T>::detach_helper() { realloc(d->size, d->alloc); } template <typename T> void QVector<T>::reserve(int asize) -{ if (asize > d->alloc) realloc(d->size, asize); d->capacity = 1; } +{ if (asize > d->alloc || d->ref != 1) realloc(d->size, asize); d->capacity = 1; } template <typename T> void QVector<T>::resize(int asize) { realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ? diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 8c701f5..f40a45f 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1102,7 +1102,7 @@ void QDBusConnectionPrivate::socketWrite(int fd) } for (int i = 0; i < pendingWatches.size(); ++i) - if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE)) + if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_WRITABLE)) qDebug("OUT OF MEM"); } @@ -1125,12 +1125,7 @@ void QDBusConnectionPrivate::objectDestroyed(QObject *obj) void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, int signalId, const QVariantList &args) { - int mciid = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE); - Q_ASSERT(mciid != -1); - - QMetaClassInfo mci = mo->classInfo(mciid); - Q_ASSERT(mci.value()); - const char *interface = mci.value(); + QString interface = qDBusInterfaceFromMetaObject(mo); QMetaMethod mm = mo->method(signalId); QByteArray memberName = mm.signature(); @@ -1146,12 +1141,12 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in } QDBusReadLocker locker(RelaySignalAction, this); - QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), QLatin1String(interface), + QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface, QLatin1String(memberName)); message.setArguments(args); DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message); if (!msg) { - qWarning("QDBusConnection: Could not emit signal %s.%s", interface, memberName.constData()); + qWarning("QDBusConnection: Could not emit signal %s.%s", qPrintable(interface), memberName.constData()); return; } diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp index 9753bbe..955f4a0 100644 --- a/src/dbus/qdbuspendingcall.cpp +++ b/src/dbus/qdbuspendingcall.cpp @@ -432,9 +432,14 @@ inline void QDBusPendingCallWatcherPrivate::_q_finished() QDBusPendingCallWatcher::QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent) : QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call) { - if (d) { - if (!d->watcherHelper) + if (d) { // QDBusPendingCall::d + if (!d->watcherHelper) { d->watcherHelper = new QDBusPendingCallWatcherHelper; + if (isFinished()) { + // cause a signal emission anyways + QMetaObject::invokeMethod(d->watcherHelper, "finished", Qt::QueuedConnection); + } + } d->watcherHelper->add(this); } } @@ -464,6 +469,7 @@ void QDBusPendingCallWatcher::waitForFinished() d->waitForFinished(); // our signals were queued, so deliver them + QCoreApplication::sendPostedEvents(d->watcherHelper, QEvent::MetaCall); QCoreApplication::sendPostedEvents(this, QEvent::MetaCall); } } diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 0dc16c9..5ed8852 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -400,7 +400,7 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) QAbstractPrintDialog::setEnabledOptions() and QAbstractPrintDialog::addEnabledOption() have no effect. - In Qt 4.4, it was possible to use the satic functions to show a sheet on + In Qt 4.4, it was possible to use the static functions to show a sheet on Mac OS X. This is no longer supported in Qt 4.5. If you want this functionality, use QPrintDialog::open(). diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index e06d14a..7e885da 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1578,10 +1578,11 @@ void QColorDialog::setCurrentColor(const QColor &color) { Q_D(QColorDialog); d->setCurrentColor(color.rgb()); - d->selectColor(color.rgb()); + d->selectColor(color); d->setCurrentAlpha(color.alpha()); #ifdef Q_WS_MAC + d->setCurrentQColor(color); if (d->delegate) QColorDialogPrivate::setColor(d->delegate, color); #endif diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm index 2556265..9862c1c 100644 --- a/src/gui/dialogs/qcolordialog_mac.mm +++ b/src/gui/dialogs/qcolordialog_mac.mm @@ -234,16 +234,22 @@ QT_USE_NAMESPACE CGFloat cyan, magenta, yellow, black, alpha; [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha]; mQtColor->setCmykF(cyan, magenta, yellow, black, alpha); + } else if (colorSpace == NSCalibratedRGBColorSpace || colorSpace == NSDeviceRGBColorSpace) { + CGFloat red, green, blue, alpha; + [color getRed:&red green:&green blue:&blue alpha:&alpha]; + mQtColor->setRgbF(red, green, blue, alpha); } else { - NSColor *tmpColor; - if (colorSpace == NSCalibratedRGBColorSpace || colorSpace == NSDeviceRGBColorSpace) { - tmpColor = color; + NSColorSpace *colorSpace = [color colorSpace]; + if ([colorSpace colorSpaceModel] == NSCMYKColorSpaceModel && [color numberOfComponents] == 5){ + CGFloat components[5]; + [color getComponents:components]; + mQtColor->setCmykF(components[0], components[1], components[2], components[3], components[4]); } else { - tmpColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + NSColor *tmpColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; + CGFloat red, green, blue, alpha; + [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha]; + mQtColor->setRgbF(red, green, blue, alpha); } - CGFloat red, green, blue, alpha; - [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha]; - mQtColor->setRgbF(red, green, blue, alpha); } if (mPriv) @@ -414,10 +420,20 @@ void QColorDialogPrivate::setColor(void *delegate, const QColor &color) { QMacCocoaAutoReleasePool pool; QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate); - NSColor *nsColor = [NSColor colorWithCalibratedRed:color.red() / 255.0 - green:color.green() / 255.0 - blue:color.blue() / 255.0 - alpha:color.alpha() / 255.0]; + NSColor *nsColor; + const QColor::Spec spec = color.spec(); + if (spec == QColor::Cmyk) { + nsColor = [NSColor colorWithDeviceCyan:color.cyanF() + magenta:color.magentaF() + yellow:color.yellowF() + black:color.blackF() + alpha:color.alphaF()]; + } else { + nsColor = [NSColor colorWithCalibratedRed:color.redF() + green:color.greenF() + blue:color.blueF() + alpha:color.alphaF()]; + } [[theDelegate colorPanel] setColor:nsColor]; } diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 044aa43..903cd74 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -2142,7 +2142,6 @@ void QFileDialogPrivate::createWidgets() #ifndef QT_NO_COMPLETER completer = new QFSCompletor(model, q); qFileDialogUi->fileNameEdit->setCompleter(completer); - completer->sourceModel = model; QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_autoCompleteFileName(QString))); #endif // QT_NO_COMPLETER diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 90af9fc..39a231b 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -911,8 +911,9 @@ void QFileDialogPrivate::createNavServicesDialog() navOptions.windowTitle = QCFString::toCFStringRef(q->windowTitle()); - static const int w = 450, h = 350; - navOptions.location.h = navOptions.location.v = -1; + navOptions.location.h = -1; + navOptions.location.v = -1; + QWidget *parent = q->parentWidget(); if (parent && parent->isVisible()) { WindowClass wclass; @@ -920,20 +921,6 @@ void QFileDialogPrivate::createNavServicesDialog() parent = parent->window(); QString s = parent->windowTitle(); navOptions.clientName = QCFString::toCFStringRef(s); - navOptions.location.h = (parent->x() + (parent->width() / 2)) - (w / 2); - navOptions.location.v = (parent->y() + (parent->height() / 2)) - (h / 2); - - QRect r = QApplication::desktop()->screenGeometry( - QApplication::desktop()->screenNumber(parent)); - const int border = 10; - if (navOptions.location.h + w > r.right()) - navOptions.location.h -= (navOptions.location.h + w) - r.right() + border; - if (navOptions.location.v + h > r.bottom()) - navOptions.location.v -= (navOptions.location.v + h) - r.bottom() + border; - if (navOptions.location.h < r.left()) - navOptions.location.h = r.left() + border; - if (navOptions.location.v < r.top()) - navOptions.location.v = r.top() + border; } filterInfo.currentSelection = 0; diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index dc24390..ab4199e 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -97,7 +97,7 @@ class Ui_QFileDialog; */ class QFSCompletor : public QCompleter { public: - QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0) + QFSCompletor(QFileSystemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(model) { #ifdef Q_OS_WIN setCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index c00bd14..3580fdc 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -54,6 +54,9 @@ #include <QtGui/qtoolbutton.h> #include <QtGui/qvalidator.h> #include <QtGui/qfiledialog.h> +#include <QtGui/qmainwindow.h> +#include <QtGui/qtoolbar.h> +#include <QtGui/qformlayout.h> #include <QtCore/QCoreApplication> #include <math.h> @@ -63,6 +66,13 @@ QT_BEGIN_NAMESPACE namespace { +class QPrintPreviewMainWindow : public QMainWindow +{ +public: + QPrintPreviewMainWindow(QWidget *parent) : QMainWindow(parent) {} + QMenu *createPopupMenu() { return 0; } +}; + class ZoomFactorValidator : public QDoubleValidator { public: @@ -197,7 +207,6 @@ public: QActionGroup *printerGroup; QAction *printAction; QAction *pageSetupAction; - QAction *closeAction; QPointer<QObject> receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; @@ -219,27 +228,12 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) QObject::connect(preview, SIGNAL(previewChanged()), q, SLOT(_q_previewChanged())); setupActions(); - // Navigation - QToolButton* nextPageButton = new QToolButton; - nextPageButton->setDefaultAction(nextPageAction); - QToolButton* prevPageButton = new QToolButton; - prevPageButton->setDefaultAction(prevPageAction); - QToolButton* firstPageButton = new QToolButton; - firstPageButton->setDefaultAction(firstPageAction); - QToolButton* lastPageButton = new QToolButton; - lastPageButton->setDefaultAction(lastPageAction); - pageNumEdit = new LineEdit; pageNumEdit->setAlignment(Qt::AlignRight); - pageNumEdit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding)); + pageNumEdit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); pageNumLabel = new QLabel; QObject::connect(pageNumEdit, SIGNAL(editingFinished()), q, SLOT(_q_pageNumEdited())); - QToolButton* fitWidthButton = new QToolButton; - fitWidthButton->setDefaultAction(fitWidthAction); - QToolButton* fitPageButton = new QToolButton; - fitPageButton->setDefaultAction(fitPageAction); - zoomFactor = new QComboBox; zoomFactor->setEditable(true); zoomFactor->setMinimumContentsLength(7); @@ -255,77 +249,66 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) QObject::connect(zoomFactor, SIGNAL(currentIndexChanged(int)), q, SLOT(_q_zoomFactorChanged())); - QToolButton* zoomInButton = new QToolButton; - zoomInButton->setDefaultAction(zoomInAction); + QPrintPreviewMainWindow *mw = new QPrintPreviewMainWindow(q); + QToolBar *toolbar = new QToolBar(mw); + toolbar->addAction(fitWidthAction); + toolbar->addAction(fitPageAction); + toolbar->addSeparator(); + toolbar->addWidget(zoomFactor); + toolbar->addAction(zoomOutAction); + toolbar->addAction(zoomInAction); + toolbar->addSeparator(); + toolbar->addAction(portraitAction); + toolbar->addAction(landscapeAction); + toolbar->addSeparator(); + toolbar->addAction(firstPageAction); + toolbar->addAction(prevPageAction); + + // this is to ensure the label text and the editor text are + // aligned in all styles - the extra QVBoxLayout is a workaround + // for bug in QFormLayout + QWidget *pageEdit = new QWidget(toolbar); + QVBoxLayout *vboxLayout = new QVBoxLayout; + vboxLayout->setContentsMargins(0, 0, 0, 0); + QFormLayout *formLayout = new QFormLayout; + formLayout->setWidget(0, QFormLayout::LabelRole, pageNumEdit); + formLayout->setWidget(0, QFormLayout::FieldRole, pageNumLabel); + vboxLayout->addLayout(formLayout); + vboxLayout->setAlignment(Qt::AlignVCenter); + pageEdit->setLayout(vboxLayout); + toolbar->addWidget(pageEdit); + + toolbar->addAction(nextPageAction); + toolbar->addAction(lastPageAction); + toolbar->addSeparator(); + toolbar->addAction(singleModeAction); + toolbar->addAction(facingModeAction); + toolbar->addAction(overviewModeAction); + toolbar->addSeparator(); + toolbar->addAction(pageSetupAction); + toolbar->addAction(printAction); + + // Cannot use the actions' triggered signal here, since it doesn't autorepeat + QToolButton *zoomInButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomInAction)); + QToolButton *zoomOutButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomOutAction)); zoomInButton->setAutoRepeat(true); zoomInButton->setAutoRepeatInterval(200); zoomInButton->setAutoRepeatDelay(200); - - QToolButton* zoomOutButton = new QToolButton; - zoomOutButton->setDefaultAction(zoomOutAction); zoomOutButton->setAutoRepeat(true); zoomOutButton->setAutoRepeatInterval(200); zoomOutButton->setAutoRepeatDelay(200); - - //Cannot use the actions' triggered signal here, since it doesnt autorepeat QObject::connect(zoomInButton, SIGNAL(clicked()), q, SLOT(_q_zoomIn())); QObject::connect(zoomOutButton, SIGNAL(clicked()), q, SLOT(_q_zoomOut())); - QToolButton* portraitButton = new QToolButton; - portraitButton->setDefaultAction(portraitAction); - QToolButton* landscapeButton = new QToolButton; - landscapeButton->setDefaultAction(landscapeAction); - - QToolButton* singleModeButton = new QToolButton; - singleModeButton->setDefaultAction(singleModeAction); - QToolButton* facingModeButton = new QToolButton; - facingModeButton->setDefaultAction(facingModeAction); - QToolButton* overviewModeButton = new QToolButton; - overviewModeButton->setDefaultAction(overviewModeAction); - - QToolButton *printButton = new QToolButton; - printButton->setDefaultAction(printAction); - QToolButton *pageSetupButton = new QToolButton; - pageSetupButton->setDefaultAction(pageSetupAction); - QToolButton *closeButton = new QToolButton; - closeButton->setDefaultAction(closeAction); - - QHBoxLayout* modeLayout = new QHBoxLayout; - modeLayout->setSpacing(0); - modeLayout->addWidget(singleModeButton); - modeLayout->addWidget(facingModeButton); - modeLayout->addWidget(overviewModeButton); - - QHBoxLayout *barLayout = new QHBoxLayout; - barLayout->addWidget(fitWidthButton); - barLayout->addWidget(fitPageButton); - barLayout->addWidget(zoomFactor); - barLayout->addWidget(zoomOutButton); - barLayout->addWidget(zoomInButton); - barLayout->addWidget(portraitButton); - barLayout->addWidget(landscapeButton); - barLayout->addStretch(); - barLayout->addWidget(firstPageButton); - barLayout->addWidget(prevPageButton); - barLayout->addWidget(pageNumEdit); - barLayout->addWidget(pageNumLabel); - barLayout->addWidget(nextPageButton); - barLayout->addWidget(lastPageButton); - barLayout->addStretch(); - barLayout->addLayout(modeLayout); - barLayout->addStretch(); - barLayout->addWidget(pageSetupButton); - barLayout->addWidget(printButton); - barLayout->addWidget(closeButton); - - QWidget* buttonBar = new QWidget; - buttonBar->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum)); - barLayout->setMargin(0); - buttonBar->setLayout(barLayout); + mw->addToolBar(toolbar); + mw->setCentralWidget(preview); + // QMainWindows are always created as top levels, force it to be a + // plain widget + mw->setParent(q, Qt::Widget); QVBoxLayout *topLayout = new QVBoxLayout; - topLayout->addWidget(buttonBar); - topLayout->addWidget(preview); + topLayout->addWidget(mw); + topLayout->setMargin(0); q->setLayout(topLayout); QString caption = QCoreApplication::translate("QPrintPreviewDialog", "Print Preview"); @@ -338,7 +321,8 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) || printer->outputFormat() != QPrinter::NativeFormat #endif ) - pageSetupButton->setEnabled(false); + pageSetupAction->setEnabled(false); + preview->setFocus(); } static inline void qt_setupActionIcon(QAction *action, const QLatin1String &name) @@ -418,12 +402,10 @@ void QPrintPreviewDialogPrivate::setupActions() printerGroup = new QActionGroup(q); printAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Print")); pageSetupAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Page setup")); - closeAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Close")); qt_setupActionIcon(printAction, QLatin1String("print")); qt_setupActionIcon(pageSetupAction, QLatin1String("page-setup")); QObject::connect(printAction, SIGNAL(triggered(bool)), q, SLOT(_q_print())); QObject::connect(pageSetupAction, SIGNAL(triggered(bool)), q, SLOT(_q_pageSetup())); - QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(reject())); // Initial state: fitPageAction->setChecked(true); diff --git a/src/gui/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp index 46ac1d1..e22ea1f 100644 --- a/src/gui/embedded/qscreentransformed_qws.cpp +++ b/src/gui/embedded/qscreentransformed_qws.cpp @@ -400,7 +400,19 @@ void QTransformedScreen::blit(const QImage &image, const QPoint &topLeft, #endif #if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15) || defined(QT_QWS_DEPTH_12) case 16: +#if defined QT_QWS_ROTATE_BGR + if (pixelType() == BGRPixel && image.depth() == 16) { + SET_BLIT_FUNC(qbgr565, quint16, trans, func); + break; + } //fall-through here!!! +#endif case 15: +#if defined QT_QWS_ROTATE_BGR + if (pixelType() == BGRPixel && image.format() == QImage::Format_RGB555) { + SET_BLIT_FUNC(qbgr555, qrgb555, trans, func); + break; + } //fall-through here!!! +#endif case 12: if (image.depth() == 16) SET_BLIT_FUNC(quint16, quint16, trans, func); diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp index abbe73b..accfe1f 100644 --- a/src/gui/embedded/qscreenvfb_qws.cpp +++ b/src/gui/embedded/qscreenvfb_qws.cpp @@ -310,6 +310,9 @@ bool QVFbScreen::connect(const QString &displaySpec) connected = this; + if (qgetenv("QT_QVFB_BGR").toInt()) + pixeltype = BGRPixel; + return true; } diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp index dffebf2..fdcd193 100644 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ b/src/gui/embedded/qwindowsystem_qws.cpp @@ -4044,7 +4044,7 @@ void QWSServer::setDesktopBackground(const QImage &img) */ void QWSServer::setDesktopBackground(const QColor &c) { - setDesktopBackground(QBrush(c)); + setBackground(QBrush(c)); } #endif //QT3_SUPPORT diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 65d1e0a..743c16d 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1263,8 +1263,8 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) return; // Flags that alter the geometry of the item (or its children). - int geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations); - bool fullUpdate = (flags & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask); + const quint32 geomChangeFlagsMask = (ItemClipsChildrenToShape | ItemClipsToShape | ItemIgnoresTransformations); + bool fullUpdate = (quint32(flags) & geomChangeFlagsMask) != (d_ptr->flags & geomChangeFlagsMask); if (fullUpdate) d_ptr->fullUpdateHelper(false, true); @@ -1961,7 +1961,7 @@ void QGraphicsItem::setOpacity(qreal opacity) itemChange(ItemOpacityHasChanged, newOpacity); // Update. - d_ptr->fullUpdateHelper(); + d_ptr->fullUpdateHelper(/*childrenOnly=*/false, /*maybeDirtyClipPath=*/false, /*ignoreOpacity=*/true); } /*! @@ -3276,10 +3276,16 @@ bool QGraphicsItem::contains(const QPointF &point) const } /*! - Returns true if this item collides with \a other; otherwise returns false. - The ways items collide is determined by \a mode. The default value for \a - mode is Qt::IntersectsItemShape; \a other collides with this item if it - either intersects, contains, or is contained by this item's shape. + + Returns true if this item collides with \a other; otherwise + returns false. + + The \a mode is applied to \a other, and the resulting shape or + bounding rectangle is then compared to this item's shape. The + default value for \a mode is Qt::IntersectsItemShape; \a other + collides with this item if it either intersects, contains, or is + contained by this item's shape (see Qt::ItemSelectionMode for + details). The default implementation is based on shape intersection, and it calls shape() on both items. Because the complexity of arbitrary shape-shape @@ -3334,6 +3340,11 @@ bool QGraphicsItem::collidesWithItem(const QGraphicsItem *other, Qt::ItemSelecti Qt::IntersectsItemShape; \a path collides with this item if it either intersects, contains, or is contained by this item's shape. + Note that this function checks whether the item's shape or + bounding rectangle (depending on \a mode) is contained within \a + path, and not whether \a path is contained within the items shape + or bounding rectangle. + \sa collidesWithItem(), contains(), shape() */ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode) const @@ -3374,11 +3385,12 @@ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelection /*! Returns a list of all items that collide with this item. - The way collisions are detected is determined by \a mode. The default - value for \a mode is Qt::IntersectsItemShape; All items whose shape - intersects or is contained by this item's shape are returned. + The way collisions are detected is determined by applying \a mode + to items that are compared to this item, i.e., each item's shape + or bounding rectangle is checked against this item's shape. The + default value for \a mode is Qt::IntersectsItemShape. - \sa QGraphicsScene::collidingItems(), collidesWithItem() + \sa collidesWithItem() */ QList<QGraphicsItem *> QGraphicsItem::collidingItems(Qt::ItemSelectionMode mode) const { @@ -3662,9 +3674,8 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity) \internal Returns true if we can discard an update request; otherwise false. */ -bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, - bool ignoreVisibleBit, - bool ignoreDirtyBit) const +bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit, + bool ignoreDirtyBit, bool ignoreOpacity) const { // No scene, or if the scene is updating everything, means we have nothing // to do. The only exception is if the scene tracks the growing scene rect. @@ -3673,7 +3684,7 @@ bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, || !scene || (scene->d_func()->updateAll && scene->d_func()->hasSceneRect) || (!ignoreClipping && (childrenClippedToShape() && isClippedAway())) - || (childrenCombineOpacity() && isFullyTransparent()); + || (!ignoreOpacity && childrenCombineOpacity() && isFullyTransparent()); } /*! @@ -3703,11 +3714,10 @@ void QGraphicsItemPrivate::updateHelper(const QRectF &rect, bool force, bool may Propagates updates to \a item and all its children. */ -void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath) +void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath, bool ignoreOpacity) { - if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, - /*ignoreVisibleBit=*/false, - /*ignoreDirtyBit=*/true)) { + if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, /*ignoreVisibleBit=*/false, + /*ignoreDirtyBit=*/true, ignoreOpacity)) { return; } diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 940e566..2936cf1 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -166,11 +166,10 @@ public: void setPosHelper(const QPointF &pos); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true); - bool discardUpdateRequest(bool ignoreClipping = false, - bool ignoreVisibleBit = false, - bool ignoreDirtyBit = false) const; + bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false, + bool ignoreDirtyBit = false, bool ignoreOpacity = false) const; void updateHelper(const QRectF &rect = QRectF(), bool force = false, bool maybeDirtyClipPath = false); - void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false); + void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false, bool ignoreOpacity = false); void updateEffectiveOpacity(); void resolveEffectiveOpacity(qreal effectiveParentOpacity); void resolveDepth(int parentDepth); diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index eaa97ff..e058292 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -108,13 +108,22 @@ static void normalizeHints(qreal &minimum, qreal &preferred, qreal &maximum, qre \internal */ QGraphicsLayoutItemPrivate::QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *par, bool layout) - : parent(par), isLayout(layout), ownedByLayout(false), graphicsItem(0) + : parent(par), userSizeHints(0), isLayout(layout), ownedByLayout(false), graphicsItem(0) { } /*! \internal */ +QGraphicsLayoutItemPrivate::~QGraphicsLayoutItemPrivate() +{ + // Remove any lazily allocated data + delete[] userSizeHints; +} + +/*! + \internal +*/ void QGraphicsLayoutItemPrivate::init() { sizeHintCacheDirty = true; @@ -132,7 +141,8 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) for (int i = 0; i < Qt::NSizeHints; ++i) { cachedSizeHints[i] = constraint; - combineSize(cachedSizeHints[i], userSizeHints[i]); + if (userSizeHints) + combineSize(cachedSizeHints[i], userSizeHints[i]); } QSizeF &minS = cachedSizeHints[Qt::MinimumSize]; @@ -198,6 +208,58 @@ QGraphicsItem *QGraphicsLayoutItemPrivate::parentItem() const } /*! + \internal + + Ensures that userSizeHints is allocated. + This function must be called before any dereferencing. +*/ +void QGraphicsLayoutItemPrivate::ensureUserSizeHints() +{ + if (!userSizeHints) + userSizeHints = new QSizeF[Qt::NSizeHints]; +} + +/*! + \internal + + Sets the user size hint \a which to \a size. Use an invalid size to unset the size hint. + */ +void QGraphicsLayoutItemPrivate::setSize(Qt::SizeHint which, const QSizeF &size) +{ + Q_Q(QGraphicsLayoutItem); + + if (userSizeHints) { + if (size == userSizeHints[which]) + return; + } else if (!size.isValid()) { + return; + } + + ensureUserSizeHints(); + userSizeHints[which] = size; + q->updateGeometry(); +} + +/*! + \internal + + Sets the width of the user size hint \a which to \a width. + */ +void QGraphicsLayoutItemPrivate::setSizeComponent( + Qt::SizeHint which, SizeComponent component, qreal value) +{ + Q_Q(QGraphicsLayoutItem); + ensureUserSizeHints(); + qreal &userValue = (component == Width) + ? userSizeHints[which].rwidth() + : userSizeHints[which].rheight(); + if (value == userValue) + return; + userValue = value; + q->updateGeometry(); +} + +/*! \class QGraphicsLayoutItem \brief The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts. @@ -381,12 +443,7 @@ QSizePolicy QGraphicsLayoutItem::sizePolicy() const */ void QGraphicsLayoutItem::setMinimumSize(const QSizeF &size) { - Q_D(QGraphicsLayoutItem); - if (size == d->userSizeHints[Qt::MinimumSize]) - return; - - d->userSizeHints[Qt::MinimumSize] = size; - updateGeometry(); + d_ptr->setSize(Qt::MinimumSize, size); } /*! @@ -416,12 +473,7 @@ QSizeF QGraphicsLayoutItem::minimumSize() const */ void QGraphicsLayoutItem::setMinimumWidth(qreal width) { - Q_D(QGraphicsLayoutItem); - qreal &userSizeHint = d->userSizeHints[Qt::MinimumSize].rwidth(); - if (width == userSizeHint) - return; - userSizeHint = width; - updateGeometry(); + d_ptr->setSizeComponent(Qt::MinimumSize, d_ptr->Width, width); } /*! @@ -431,12 +483,7 @@ void QGraphicsLayoutItem::setMinimumWidth(qreal width) */ void QGraphicsLayoutItem::setMinimumHeight(qreal height) { - Q_D(QGraphicsLayoutItem); - qreal &userSizeHint = d->userSizeHints[Qt::MinimumSize].rheight(); - if (height == userSizeHint) - return; - userSizeHint = height; - updateGeometry(); + d_ptr->setSizeComponent(Qt::MinimumSize, d_ptr->Height, height); } @@ -450,12 +497,7 @@ void QGraphicsLayoutItem::setMinimumHeight(qreal height) */ void QGraphicsLayoutItem::setPreferredSize(const QSizeF &size) { - Q_D(QGraphicsLayoutItem); - if (size == d->userSizeHints[Qt::PreferredSize]) - return; - - d->userSizeHints[Qt::PreferredSize] = size; - updateGeometry(); + d_ptr->setSize(Qt::PreferredSize, size); } /*! @@ -485,12 +527,7 @@ QSizeF QGraphicsLayoutItem::preferredSize() const */ void QGraphicsLayoutItem::setPreferredHeight(qreal height) { - Q_D(QGraphicsLayoutItem); - qreal &userSizeHint = d->userSizeHints[Qt::PreferredSize].rheight(); - if (height == userSizeHint) - return; - userSizeHint = height; - updateGeometry(); + d_ptr->setSizeComponent(Qt::PreferredSize, d_ptr->Height, height); } /*! @@ -500,12 +537,7 @@ void QGraphicsLayoutItem::setPreferredHeight(qreal height) */ void QGraphicsLayoutItem::setPreferredWidth(qreal width) { - Q_D(QGraphicsLayoutItem); - qreal &userSizeHint = d->userSizeHints[Qt::PreferredSize].rwidth(); - if (width == userSizeHint) - return; - userSizeHint = width; - updateGeometry(); + d_ptr->setSizeComponent(Qt::PreferredSize, d_ptr->Width, width); } /*! @@ -519,12 +551,7 @@ void QGraphicsLayoutItem::setPreferredWidth(qreal width) */ void QGraphicsLayoutItem::setMaximumSize(const QSizeF &size) { - Q_D(QGraphicsLayoutItem); - if (size == d->userSizeHints[Qt::MaximumSize]) - return; - - d->userSizeHints[Qt::MaximumSize] = size; - updateGeometry(); + d_ptr->setSize(Qt::MaximumSize, size); } /*! @@ -554,12 +581,7 @@ QSizeF QGraphicsLayoutItem::maximumSize() const */ void QGraphicsLayoutItem::setMaximumWidth(qreal width) { - Q_D(QGraphicsLayoutItem); - qreal &userSizeHint = d->userSizeHints[Qt::MaximumSize].rwidth(); - if (width == userSizeHint) - return; - userSizeHint = width; - updateGeometry(); + d_ptr->setSizeComponent(Qt::MaximumSize, d_ptr->Width, width); } /*! @@ -569,12 +591,7 @@ void QGraphicsLayoutItem::setMaximumWidth(qreal width) */ void QGraphicsLayoutItem::setMaximumHeight(qreal height) { - Q_D(QGraphicsLayoutItem); - qreal &userSizeHint = d->userSizeHints[Qt::MaximumSize].rheight(); - if (height == userSizeHint) - return; - userSizeHint = height; - updateGeometry(); + d_ptr->setSizeComponent(Qt::MaximumSize, d_ptr->Height, height); } /*! @@ -732,6 +749,11 @@ QRectF QGraphicsLayoutItem::contentsRect() const */ QSizeF QGraphicsLayoutItem::effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint) const { + Q_D(const QGraphicsLayoutItem); + + if (!d->userSizeHints && constraint.isValid()) + return constraint; + // ### should respect size policy??? return d_ptr->effectiveSizeHints(constraint)[which]; } diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index fab0f39..dc044e6 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -63,16 +63,20 @@ class Q_AUTOTEST_EXPORT QGraphicsLayoutItemPrivate { Q_DECLARE_PUBLIC(QGraphicsLayoutItem) public: - virtual ~QGraphicsLayoutItemPrivate() {} + virtual ~QGraphicsLayoutItemPrivate(); QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout); void init(); QSizeF *effectiveSizeHints(const QSizeF &constraint) const; QGraphicsItem *parentItem() const; + void ensureUserSizeHints(); + void setSize(Qt::SizeHint which, const QSizeF &size); + enum SizeComponent { Width, Height }; + void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value); QSizePolicy sizePolicy; QGraphicsLayoutItem *parent; - QSizeF userSizeHints[Qt::NSizeHints]; + QSizeF *userSizeHints; mutable QSizeF cachedSizeHints[Qt::NSizeHints]; mutable QSizeF cachedConstraint; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 7720a10..5e33896 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -587,10 +587,6 @@ void QGraphicsViewPrivate::mouseMoveEventHandler(QMouseEvent *event) return; if (!scene) return; - if (scene->d_func()->allItemsIgnoreHoverEvents && scene->d_func()->allItemsUseDefaultCursor - && !event->buttons()) { // forward event to the scene if something is pressed. - return; // No need to process this event further. - } QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); mouseEvent.setWidget(q->viewport()); @@ -1085,8 +1081,12 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg QList<QGraphicsItem *> itemList(scene->items()); int i = 0; while (i < itemList.size()) { + const QGraphicsItem *item = itemList.at(i); // But we only want to include items that are visible - if (!itemList.at(i)->isVisible()) + // The following check is basically the same as item->d_ptr->isInvisible(), except + // that we don't check whether the item clips children to shape or propagates its + // opacity (we loop through all items, so those checks are wrong in this context). + if (!item->isVisible() || item->d_ptr->isClippedAway() || item->d_ptr->isFullyTransparent()) itemList.removeAt(i); else ++i; @@ -1691,6 +1691,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene) disconnect(d->scene, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(updateSceneRect(QRectF))); d->scene->d_func()->views.removeAll(this); + d->connectedToScene = false; } // Assign the new scene and update the contents (scrollbars, etc.)). diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h index a76279e..d573e8f 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/gui/graphicsview/qgraphicsview_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate +class QGraphicsViewPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QGraphicsView) public: diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 66930f2..702e0b6 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -459,17 +459,19 @@ void QGraphicsWidget::setContentsMargins(qreal left, qreal top, qreal right, qre { Q_D(QGraphicsWidget); - if (left == d->leftMargin - && top == d->topMargin - && right == d->rightMargin - && bottom == d->bottomMargin) { + if (!d->margins && left == 0 && top == 0 && right == 0 && bottom == 0) + return; + d->ensureMargins(); + if (left == d->margins[d->Left] + && top == d->margins[d->Top] + && right == d->margins[d->Right] + && bottom == d->margins[d->Bottom]) return; - } - d->leftMargin = left; - d->topMargin = top; - d->rightMargin = right; - d->bottomMargin = bottom; + d->margins[d->Left] = left; + d->margins[d->Top] = top; + d->margins[d->Right] = right; + d->margins[d->Bottom] = bottom; if (QGraphicsLayout *l = d->layout) l->invalidate(); @@ -490,14 +492,16 @@ void QGraphicsWidget::setContentsMargins(qreal left, qreal top, qreal right, qre void QGraphicsWidget::getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const { Q_D(const QGraphicsWidget); + if (left || top || right || bottom) + d->ensureMargins(); if (left) - *left = d->leftMargin; + *left = d->margins[d->Left]; if (top) - *top = d->topMargin; + *top = d->margins[d->Top]; if (right) - *right = d->rightMargin; + *right = d->margins[d->Right]; if (bottom) - *bottom = d->bottomMargin; + *bottom = d->margins[d->Bottom]; } /*! @@ -513,16 +517,23 @@ void QGraphicsWidget::getContentsMargins(qreal *left, qreal *top, qreal *right, void QGraphicsWidget::setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom) { Q_D(QGraphicsWidget); - bool unchanged = left == d->leftWindowFrameMargin && top == d->topWindowFrameMargin - && right == d->rightWindowFrameMargin && bottom == d->bottomWindowFrameMargin; + + if (!d->windowFrameMargins && left == 0 && top == 0 && right == 0 && bottom == 0) + return; + d->ensureWindowFrameMargins(); + bool unchanged = + d->windowFrameMargins[d->Left] == left + && d->windowFrameMargins[d->Top] == top + && d->windowFrameMargins[d->Right] == right + && d->windowFrameMargins[d->Bottom] == bottom; if (d->setWindowFrameMargins && unchanged) return; if (!unchanged) prepareGeometryChange(); - d->leftWindowFrameMargin = left; - d->topWindowFrameMargin = top; - d->rightWindowFrameMargin = right; - d->bottomWindowFrameMargin = bottom; + d->windowFrameMargins[d->Left] = left; + d->windowFrameMargins[d->Top] = top; + d->windowFrameMargins[d->Right] = right; + d->windowFrameMargins[d->Bottom] = bottom; d->setWindowFrameMargins = true; } @@ -536,14 +547,16 @@ void QGraphicsWidget::setWindowFrameMargins(qreal left, qreal top, qreal right, void QGraphicsWidget::getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const { Q_D(const QGraphicsWidget); + if (left || top || right || bottom) + d->ensureWindowFrameMargins(); if (left) - *left = d->leftWindowFrameMargin; + *left = d->windowFrameMargins[d->Left]; if (top) - *top = d->topWindowFrameMargin; + *top = d->windowFrameMargins[d->Top]; if (right) - *right = d->rightWindowFrameMargin; + *right = d->windowFrameMargins[d->Right]; if (bottom) - *bottom = d->bottomWindowFrameMargin; + *bottom = d->windowFrameMargins[d->Bottom]; } /*! @@ -577,8 +590,10 @@ void QGraphicsWidget::unsetWindowFrameMargins() QRectF QGraphicsWidget::windowFrameGeometry() const { Q_D(const QGraphicsWidget); - return geometry().adjusted(-d->leftWindowFrameMargin, -d->topWindowFrameMargin, - d->rightWindowFrameMargin, d->bottomWindowFrameMargin); + return d->windowFrameMargins + ? geometry().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top], + d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom]) + : geometry(); } /*! @@ -589,8 +604,10 @@ QRectF QGraphicsWidget::windowFrameGeometry() const QRectF QGraphicsWidget::windowFrameRect() const { Q_D(const QGraphicsWidget); - return rect().adjusted(-d->leftWindowFrameMargin, -d->topWindowFrameMargin, - d->rightWindowFrameMargin, d->bottomWindowFrameMargin); + return d->windowFrameMargins + ? rect().adjusted(-d->windowFrameMargins[d->Left], -d->windowFrameMargins[d->Top], + d->windowFrameMargins[d->Right], d->windowFrameMargins[d->Bottom]) + : rect(); } /*! @@ -699,7 +716,10 @@ QSizeF QGraphicsWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) c QSizeF sh; if (d->layout) { sh = d->layout->effectiveSizeHint(which, constraint); - sh += QSizeF(d->leftMargin + d->rightMargin, d->topMargin + d->bottomMargin); + if (d->margins) { + sh += QSizeF(d->margins[d->Left] + d->margins[d->Right], + d->margins[d->Top] + d->margins[d->Bottom]); + } } else { switch (which) { case Qt::MinimumSize: @@ -1127,7 +1147,8 @@ bool QGraphicsWidget::windowFrameEvent(QEvent *event) d->windowFrameMousePressEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); break; case QEvent::GraphicsSceneMouseMove: - if (d->grabbedSection != Qt::NoSection) { + d->ensureWindowData(); + if (d->windowData->grabbedSection != Qt::NoSection) { d->windowFrameMouseMoveEvent(static_cast<QGraphicsSceneMouseEvent *>(event)); event->accept(); } @@ -1182,7 +1203,8 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) const qreal cornerMargin = 20; //### Not sure of this one, it should be the same value for all edges. - const qreal windowFrameWidth = d->leftWindowFrameMargin; + const qreal windowFrameWidth = d->windowFrameMargins + ? d->windowFrameMargins[d->Left] : 0; Qt::WindowFrameSection s = Qt::NoSection; if (x <= left + cornerMargin) { @@ -1208,7 +1230,8 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) } if (s == Qt::NoSection) { QRectF r1 = r; - r1.setHeight(d->topWindowFrameMargin); + r1.setHeight(d->windowFrameMargins + ? d->windowFrameMargins[d->Top] : 0); if (r1.contains(pos)) s = Qt::TitleBarArea; } @@ -1316,7 +1339,8 @@ bool QGraphicsWidget::event(QEvent *event) case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: case QEvent::GraphicsSceneMouseDoubleClick: - if (d->hasDecoration() && d->grabbedSection != Qt::NoSection) + d->ensureWindowData(); + if (d->hasDecoration() && d->windowData->grabbedSection != Qt::NoSection) return windowFrameEvent(event); break; case QEvent::GraphicsSceneHoverEnter: @@ -1669,12 +1693,13 @@ bool QGraphicsWidget::isActiveWindow() const void QGraphicsWidget::setWindowTitle(const QString &title) { Q_D(QGraphicsWidget); - d->windowTitle = title; + d->ensureWindowData(); + d->windowData->windowTitle = title; } QString QGraphicsWidget::windowTitle() const { Q_D(const QGraphicsWidget); - return d->windowTitle; + return d->windowData ? d->windowData->windowTitle : QString(); } /*! @@ -2110,11 +2135,12 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap QStyleOptionTitleBar bar; bar.QStyleOption::operator=(*option); d->initStyleOptionTitleBar(&bar); // this clear flags in bar.state - if (d->buttonMouseOver) + d->ensureWindowData(); + if (d->windowData->buttonMouseOver) bar.state |= QStyle::State_MouseOver; else bar.state &= ~QStyle::State_MouseOver; - if (d->buttonSunken) + if (d->windowData->buttonSunken) bar.state |= QStyle::State_Sunken; else bar.state &= ~QStyle::State_Sunken; diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 4b41a31..8ced47a 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -89,56 +89,57 @@ qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options return (qreal)height; } -void QGraphicsWidgetPrivate::getLayoutItemMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const +/*! + \internal +*/ +QGraphicsWidgetPrivate::~QGraphicsWidgetPrivate() { - if (left) - *left = leftLayoutItemMargin; - if (top) - *top = topLayoutItemMargin; - if (right) - *right = rightLayoutItemMargin; - if (bottom) - *bottom = bottomLayoutItemMargin; + // Remove any lazily allocated data + delete[] margins; + delete[] windowFrameMargins; + delete windowData; } -void QGraphicsWidgetPrivate::setLayoutItemMargins(qreal left, qreal top, qreal right, qreal bottom) -{ - if (leftLayoutItemMargin == left - && topLayoutItemMargin == top - && rightLayoutItemMargin == right - && bottomLayoutItemMargin == bottom) - return; +/*! + \internal - Q_Q(QGraphicsWidget); - leftLayoutItemMargin = left; - topLayoutItemMargin = top; - rightLayoutItemMargin = right; - bottomLayoutItemMargin = bottom; - q->updateGeometry(); + Ensures that margins is allocated. + This function must be called before any dereferencing. +*/ +void QGraphicsWidgetPrivate::ensureMargins() const +{ + if (!margins) { + margins = new qreal[4]; + for (int i = 0; i < 4; ++i) + margins[i] = 0; + } } -void QGraphicsWidgetPrivate::setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt) +/*! + \internal + + Ensures that windowFrameMargins is allocated. + This function must be called before any dereferencing. +*/ +void QGraphicsWidgetPrivate::ensureWindowFrameMargins() const { - Q_Q(QGraphicsWidget); - QStyleOption myOpt; - if (!opt) { - q->initStyleOption(&myOpt); - myOpt.rect.setRect(0, 0, 32768, 32768); // arbitrary - opt = &myOpt; + if (!windowFrameMargins) { + windowFrameMargins = new qreal[4]; + for (int i = 0; i < 4; ++i) + windowFrameMargins[i] = 0; } +} - QRect liRect = q->style()->subElementRect(element, opt, /* q */ 0); - if (liRect.isValid()) { - leftLayoutItemMargin = (opt->rect.left() - liRect.left()); - topLayoutItemMargin = (opt->rect.top() - liRect.top()); - rightLayoutItemMargin = (liRect.right() - opt->rect.right()); - bottomLayoutItemMargin = (liRect.bottom() - opt->rect.bottom()); - } else { - leftLayoutItemMargin = 0; - topLayoutItemMargin = 0; - rightLayoutItemMargin = 0; - bottomLayoutItemMargin = 0; - } +/*! + \internal + + Ensures that windowData is allocated. + This function must be called before any dereferencing. +*/ +void QGraphicsWidgetPrivate::ensureWindowData() +{ + if (!windowData) + windowData = new WindowData; } void QGraphicsWidgetPrivate::setPalette_helper(const QPalette &palette) @@ -297,11 +298,12 @@ QFont QGraphicsWidgetPrivate::naturalWidgetFont() const void QGraphicsWidgetPrivate::initStyleOptionTitleBar(QStyleOptionTitleBar *option) { Q_Q(QGraphicsWidget); + ensureWindowData(); q->initStyleOption(option); option->rect.setHeight(titleBarHeight(*option)); option->titleBarFlags = windowFlags; option->subControls = QStyle::SC_TitleBarCloseButton | QStyle::SC_TitleBarLabel | QStyle::SC_TitleBarSysMenu; - option->activeSubControls = hoveredSubControl; + option->activeSubControls = windowData->hoveredSubControl; bool isActive = q->isActiveWindow(); if (isActive) { option->state |= QStyle::State_Active; @@ -313,7 +315,8 @@ void QGraphicsWidgetPrivate::initStyleOptionTitleBar(QStyleOptionTitleBar *optio } QFont windowTitleFont = QApplication::font("QWorkspaceTitleBar"); QRect textRect = q->style()->subControlRect(QStyle::CC_TitleBar, option, QStyle::SC_TitleBarLabel, 0); - option->text = QFontMetrics(windowTitleFont).elidedText(windowTitle, Qt::ElideRight, textRect.width()); + option->text = QFontMetrics(windowTitleFont).elidedText( + windowData->windowTitle, Qt::ElideRight, textRect.width()); } void QGraphicsWidgetPrivate::adjustWindowFlags(Qt::WindowFlags *flags) @@ -341,9 +344,10 @@ void QGraphicsWidgetPrivate::adjustWindowFlags(Qt::WindowFlags *flags) void QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QGraphicsWidget); - if (grabbedSection != Qt::NoSection) { - if (grabbedSection == Qt::TitleBarArea) { - buttonSunken = false; + ensureWindowData(); + if (windowData->grabbedSection != Qt::NoSection) { + if (windowData->grabbedSection == Qt::TitleBarArea) { + windowData->buttonSunken = false; QStyleOptionTitleBar bar; initStyleOptionTitleBar(&bar); // make sure that the coordinates (rect and pos) we send to the style are positive. @@ -351,8 +355,10 @@ void QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent(QGraphicsSceneMouseEve bar.rect.moveTo(0,0); bar.rect.setHeight(q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &bar)); QPointF pos = event->pos(); - pos.rx() += leftWindowFrameMargin; - pos.ry() += topWindowFrameMargin; + if (windowFrameMargins) { + pos.rx() += windowFrameMargins[Left]; + pos.ry() += windowFrameMargins[Top]; + } bar.subControls = QStyle::SC_TitleBarCloseButton; if (q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, @@ -361,7 +367,7 @@ void QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent(QGraphicsSceneMouseEve } } if (!(static_cast<QGraphicsSceneMouseEvent *>(event)->buttons())) - grabbedSection = Qt::NoSection; + windowData->grabbedSection = Qt::NoSection; event->accept(); } } @@ -372,35 +378,16 @@ void QGraphicsWidgetPrivate::windowFrameMousePressEvent(QGraphicsSceneMouseEvent if (event->button() != Qt::LeftButton) return; - startGeometry = q->geometry(); - grabbedSection = q->windowFrameSectionAt(event->pos()); - switch (grabbedSection) { - case Qt::LeftSection: - case Qt::TopLeftSection: - mouseDelta = event->pos() - q->rect().topLeft(); - break; - case Qt::TopSection: - case Qt::TopRightSection: - mouseDelta = event->pos() - q->rect().topRight(); - break; - case Qt::RightSection: - case Qt::BottomRightSection: - mouseDelta = event->pos() - q->rect().bottomRight(); - break; - case Qt::BottomSection: - case Qt::BottomLeftSection: - mouseDelta = event->pos() - q->rect().bottomLeft(); - break; - case Qt::TitleBarArea: - if (hoveredSubControl == QStyle::SC_TitleBarCloseButton) { - buttonSunken = true; - q->update(); - } - break; - case Qt::NoSection: - break; + ensureWindowData(); + windowData->startGeometry = q->geometry(); + windowData->grabbedSection = q->windowFrameSectionAt(event->pos()); + ensureWindowData(); + if (windowData->grabbedSection == Qt::TitleBarArea + && windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton) { + windowData->buttonSunken = true; + q->update(); } - event->setAccepted(grabbedSection != Qt::NoSection); + event->setAccepted(windowData->grabbedSection != Qt::NoSection); } static void _q_boundGeometryToSizeConstraints(const QRectF &startGeometry, @@ -455,7 +442,8 @@ static void _q_boundGeometryToSizeConstraints(const QRectF &startGeometry, void QGraphicsWidgetPrivate::windowFrameMouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QGraphicsWidget); - if (!(event->buttons() & Qt::LeftButton) || hoveredSubControl != QStyle::SC_TitleBarLabel) + ensureWindowData(); + if (!(event->buttons() & Qt::LeftButton) || windowData->hoveredSubControl != QStyle::SC_TitleBarLabel) return; QLineF delta(q->mapFromScene(event->buttonDownScenePos(Qt::LeftButton)), event->pos()); @@ -464,49 +452,56 @@ void QGraphicsWidgetPrivate::windowFrameMouseMoveEvent(QGraphicsSceneMouseEvent QLineF parentYDelta(q->mapToParent(QPointF(0, delta.p1().y())), q->mapToParent(QPointF(0, delta.p2().y()))); QRectF newGeometry; - switch (grabbedSection) { + switch (windowData->grabbedSection) { case Qt::LeftSection: - newGeometry = QRectF(startGeometry.topLeft() + QPointF(parentXDelta.dx(), parentXDelta.dy()), - startGeometry.size() - QSizeF(delta.dx(), delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft() + + QPointF(parentXDelta.dx(), parentXDelta.dy()), + windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); break; case Qt::TopLeftSection: - newGeometry = QRectF(startGeometry.topLeft() + QPointF(parentDelta.dx(), parentDelta.dy()), - startGeometry.size() - QSizeF(delta.dx(), delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft() + + QPointF(parentDelta.dx(), parentDelta.dy()), + windowData->startGeometry.size() - QSizeF(delta.dx(), delta.dy())); break; case Qt::TopSection: - newGeometry = QRectF(startGeometry.topLeft() + QPointF(parentYDelta.dx(), parentYDelta.dy()), - startGeometry.size() - QSizeF(0, delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft() + + QPointF(parentYDelta.dx(), parentYDelta.dy()), + windowData->startGeometry.size() - QSizeF(0, delta.dy())); break; case Qt::TopRightSection: - newGeometry = QRectF(startGeometry.topLeft() + QPointF(parentYDelta.dx(), parentYDelta.dy()), - startGeometry.size() - QSizeF(-delta.dx(), delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft() + + QPointF(parentYDelta.dx(), parentYDelta.dy()), + windowData->startGeometry.size() - QSizeF(-delta.dx(), delta.dy())); break; case Qt::RightSection: - newGeometry = QRectF(startGeometry.topLeft(), - startGeometry.size() + QSizeF(delta.dx(), 0)); + newGeometry = QRectF(windowData->startGeometry.topLeft(), + windowData->startGeometry.size() + QSizeF(delta.dx(), 0)); break; case Qt::BottomRightSection: - newGeometry = QRectF(startGeometry.topLeft(), - startGeometry.size() + QSizeF(delta.dx(), delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft(), + windowData->startGeometry.size() + QSizeF(delta.dx(), delta.dy())); break; case Qt::BottomSection: - newGeometry = QRectF(startGeometry.topLeft(), - startGeometry.size() + QSizeF(0, delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft(), + windowData->startGeometry.size() + QSizeF(0, delta.dy())); break; case Qt::BottomLeftSection: - newGeometry = QRectF(startGeometry.topLeft() + QPointF(parentXDelta.dx(), parentXDelta.dy()), - startGeometry.size() - QSizeF(delta.dx(), -delta.dy())); + newGeometry = QRectF(windowData->startGeometry.topLeft() + + QPointF(parentXDelta.dx(), parentXDelta.dy()), + windowData->startGeometry.size() - QSizeF(delta.dx(), -delta.dy())); break; case Qt::TitleBarArea: - newGeometry = QRectF(startGeometry.topLeft() + QPointF(parentDelta.dx(), parentDelta.dy()), - startGeometry.size()); + newGeometry = QRectF(windowData->startGeometry.topLeft() + + QPointF(parentDelta.dx(), parentDelta.dy()), + windowData->startGeometry.size()); break; case Qt::NoSection: break; } - if (grabbedSection != Qt::NoSection) { - _q_boundGeometryToSizeConstraints(startGeometry, &newGeometry, grabbedSection, + if (windowData->grabbedSection != Qt::NoSection) { + _q_boundGeometryToSizeConstraints(windowData->startGeometry, &newGeometry, + windowData->grabbedSection, q->effectiveSizeHint(Qt::MinimumSize), q->effectiveSizeHint(Qt::MaximumSize)); q->setGeometry(newGeometry); @@ -519,21 +514,25 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent if (!hasDecoration()) return; + ensureWindowData(); + if (q->rect().contains(event->pos())) { - if (buttonMouseOver || hoveredSubControl != QStyle::SC_None) + if (windowData->buttonMouseOver || windowData->hoveredSubControl != QStyle::SC_None) windowFrameHoverLeaveEvent(event); return; } - bool wasMouseOver = buttonMouseOver; - QRect oldButtonRect = buttonRect; - buttonRect = QRect(); - buttonMouseOver = false; + bool wasMouseOver = windowData->buttonMouseOver; + QRect oldButtonRect = windowData->buttonRect; + windowData->buttonRect = QRect(); + windowData->buttonMouseOver = false; QPointF pos = event->pos(); QStyleOptionTitleBar bar; // make sure that the coordinates (rect and pos) we send to the style are positive. - pos.rx() += leftWindowFrameMargin; - pos.ry() += topWindowFrameMargin; + if (windowFrameMargins) { + pos.rx() += windowFrameMargins[Left]; + pos.ry() += windowFrameMargins[Top]; + } initStyleOptionTitleBar(&bar); bar.rect = q->windowFrameRect().toRect(); bar.rect.moveTo(0,0); @@ -559,14 +558,17 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent cursorShape = Qt::SizeVerCursor; break; case Qt::TitleBarArea: - buttonRect = q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); + windowData->buttonRect = q->style()->subControlRect( + QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0); #ifdef Q_WS_MAC // On mac we should hover if we are in the 'area' of the buttons - buttonRect |= q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0); - buttonRect |= q->style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMaxButton, 0); + windowData->buttonRect |= q->style()->subControlRect( + QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0); + windowData->buttonRect |= q->style()->subControlRect( + QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMaxButton, 0); #endif - if (buttonRect.contains(pos.toPoint())) - buttonMouseOver = true; + if (windowData->buttonRect.contains(pos.toPoint())) + windowData->buttonMouseOver = true; event->ignore(); break; default: @@ -578,15 +580,15 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent q->setCursor(cursorShape); #endif // update buttons if we hover over them - hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0); - if (hoveredSubControl != QStyle::SC_TitleBarCloseButton) - hoveredSubControl = QStyle::SC_TitleBarLabel; + windowData->hoveredSubControl = q->style()->hitTestComplexControl(QStyle::CC_TitleBar, &bar, pos.toPoint(), 0); + if (windowData->hoveredSubControl != QStyle::SC_TitleBarCloseButton) + windowData->hoveredSubControl = QStyle::SC_TitleBarLabel; - if (buttonMouseOver != wasMouseOver) { + if (windowData->buttonMouseOver != wasMouseOver) { if (!oldButtonRect.isNull()) q->update(QRectF(oldButtonRect).translated(q->windowFrameRect().topLeft())); - if (!buttonRect.isNull()) - q->update(QRectF(buttonRect).translated(q->windowFrameRect().topLeft())); + if (!windowData->buttonRect.isNull()) + q->update(QRectF(windowData->buttonRect).translated(q->windowFrameRect().topLeft())); } } @@ -600,16 +602,19 @@ void QGraphicsWidgetPrivate::windowFrameHoverLeaveEvent(QGraphicsSceneHoverEvent q->unsetCursor(); #endif + ensureWindowData(); + bool needsUpdate = false; - if (hoveredSubControl == QStyle::SC_TitleBarCloseButton || buttonMouseOver) + if (windowData->hoveredSubControl == QStyle::SC_TitleBarCloseButton + || windowData->buttonMouseOver) needsUpdate = true; // update the hover state (of buttons etc...) - hoveredSubControl = QStyle::SC_None; - buttonMouseOver = false; - buttonRect = QRect(); + windowData->hoveredSubControl = QStyle::SC_None; + windowData->buttonMouseOver = false; + windowData->buttonRect = QRect(); if (needsUpdate) - q->update(buttonRect); + q->update(windowData->buttonRect); } } diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 53eaa31..f4cdeca 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -68,19 +68,12 @@ class QStyleOptionTitleBar; #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW -class Q_GUI_EXPORT QGraphicsWidgetPrivate : public QGraphicsItemPrivate +class QGraphicsWidgetPrivate : public QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QGraphicsWidget) public: QGraphicsWidgetPrivate() - : leftMargin(0), - topMargin(0), - rightMargin(0), - bottomMargin(0), - leftLayoutItemMargin(0), - topLayoutItemMargin(0), - rightLayoutItemMargin(0), - bottomLayoutItemMargin(0), + : margins(0), layout(0), inheritedPaletteResolveMask(0), inheritedFontResolveMask(0), @@ -92,40 +85,23 @@ public: focusPrev(0), focusChild(0), windowFlags(0), - hoveredSubControl(QStyle::SC_None), - grabbedSection(Qt::NoSection), - buttonMouseOver(false), - buttonSunken(false), + windowData(0), setWindowFrameMargins(false), - leftWindowFrameMargin(0), - topWindowFrameMargin(0), - rightWindowFrameMargin(0), - bottomWindowFrameMargin(0) + windowFrameMargins(0) { } + virtual ~QGraphicsWidgetPrivate(); void init(QGraphicsItem *parentItem, Qt::WindowFlags wFlags); qreal titleBarHeight(const QStyleOptionTitleBar &options) const; // Margins - qreal leftMargin; - qreal topMargin; - qreal rightMargin; - qreal bottomMargin; - QRectF contentsRect; - - // Layout item margins - void getLayoutItemMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; - void setLayoutItemMargins(qreal left, qreal top, qreal right, qreal bottom); - void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0); + enum {Left, Top, Right, Bottom}; + mutable qreal *margins; + void ensureMargins() const; void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene = 0); void setLayout_helper(QGraphicsLayout *l); - qreal leftLayoutItemMargin; - qreal topLayoutItemMargin; - qreal rightLayoutItemMargin; - qreal bottomLayoutItemMargin; - // Layouts QGraphicsLayout *layout; void setLayoutDirection_helper(Qt::LayoutDirection direction); @@ -208,20 +184,26 @@ public: // Windows Qt::WindowFlags windowFlags; - QString windowTitle; - QStyle::SubControl hoveredSubControl; - Qt::WindowFrameSection grabbedSection; - uint buttonMouseOver : 1; - uint buttonSunken : 1; - QPointF mouseDelta; // to compensate for small error when interactively resizing - QRectF startGeometry; - QRect buttonRect; + struct WindowData { + QString windowTitle; + QStyle::SubControl hoveredSubControl; + Qt::WindowFrameSection grabbedSection; + uint buttonMouseOver : 1; + uint buttonSunken : 1; + QRectF startGeometry; + QRect buttonRect; + WindowData() + : hoveredSubControl(QStyle::SC_None) + , grabbedSection(Qt::NoSection) + , buttonMouseOver(false) + , buttonSunken(false) + {} + } *windowData; + void ensureWindowData(); bool setWindowFrameMargins; - qreal leftWindowFrameMargin; - qreal topWindowFrameMargin; - qreal rightWindowFrameMargin; - qreal bottomWindowFrameMargin; + mutable qreal *windowFrameMargins; + void ensureWindowFrameMargins() const; #ifndef QT_NO_ACTION QList<QAction *> actions; diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index dc5ca21..c150b0e 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -275,7 +275,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz if (hasIgnoreFlag) { factors[i] = (stretch < 0) ? 1.0 : 0.0; } else { - factors[i] = (stretch < 0) ? sizes[i] : 0.0; + factors[i] = (stretch < 0) ? sizes[i] : 0.0; } } else if (stretch == sumStretches) { factors[i] = 1.0; @@ -615,7 +615,7 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig QSizeF size = effectiveMaxSize().boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); - + Qt::Alignment align = q_engine->effectiveAlignment(this); switch (align & Qt::AlignHorizontal_Mask) { case Qt::AlignHCenter: @@ -717,7 +717,7 @@ void QGridLayoutItem::dump(int indent) const void QGridLayoutRowInfo::insertOrRemoveRows(int row, int delta) { count += delta; - + insertOrRemoveItems(stretches, row, delta); insertOrRemoveItems(spacings, row, delta); insertOrRemoveItems(alignments, row, delta); @@ -1076,7 +1076,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi break; } return QSizeF(); -} +} QSizePolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) const { @@ -1150,16 +1150,16 @@ void QGridLayoutEngine::dump(int indent) const q_rowData.dump(indent + 2); qDebug("%*s Geometries output", indent, ""); + QVector<qreal> *cellPos = &q_yy; for (int pass = 0; pass < 2; ++pass) { - QVector<qreal> &cellPos = q_yy; QString message; - for (i = 0; i < cellPos.count(); ++i) { + for (i = 0; i < cellPos->count(); ++i) { message += QLatin1String((message.isEmpty() ? "[" : ", ")); - message += QString::number(cellPos.at(i)); + message += QString::number(cellPos->at(i)); } message += QLatin1String("]"); qDebug("%*s %s %s", indent, "", (pass == 0 ? "rows:" : "columns:"), qPrintable(message)); - cellPos = q_xx; + cellPos = &q_xx; } } #endif @@ -1538,5 +1538,5 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, } QT_END_NAMESPACE - + #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 0514567..b2b8c13 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -856,6 +856,9 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state) QImageWriter::supportedImageFormats() functions to retrieve a complete list of the supported file formats. + Note: When you add a non-empty filename to a QIcon, the icon becomes + non-null, even if the file doesn't exist or points to a corrupt file. + \sa addPixmap() */ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state) diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5de39d9..7f36be9 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1337,6 +1337,7 @@ QByteArray QImageReader::imageFormat(QIODevice *device) \row \o TIFF \o Tagged Image File Format \row \o XBM \o X11 Bitmap \row \o XPM \o X11 Pixmap + \row \o SVG \o Scalable Vector Graphics \endtable Reading and writing SVG files is supported through Qt's diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h index 860485a..6402af2 100644 --- a/src/gui/image/qnativeimage_p.h +++ b/src/gui/image/qnativeimage_p.h @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE class QWidget; -class Q_GUI_EXPORT QNativeImage +class QNativeImage { public: QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWidget *widget = 0); diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 20bed02..d4ebef7 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -319,6 +319,7 @@ static QImage qt_fromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h) } else { qWarning("qt_fromWinHBITMAP(), failed to get bitmap bits"); } + qFree(data); return image; } diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index cc14d3e..90c38ca 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -88,6 +88,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() autoScroll(true), autoScrollMargin(16), autoScrollCount(0), + shouldScrollToCurrentOnShow(false), alternatingColors(false), textElideMode(Qt::ElideRight), verticalScrollMode(QAbstractItemView::ScrollPerItem), @@ -1380,8 +1381,9 @@ bool QAbstractItemView::event(QEvent *event) d->executePostedLayout(); //make sure we set the layout properly break; case QEvent::Show: - if (d->delayedPendingLayout) { - d->executePostedLayout(); //make sure we set the layout properly + d->executePostedLayout(); //make sure we set the layout properly + if (d->shouldScrollToCurrentOnShow) { + d->shouldScrollToCurrentOnShow = false; const QModelIndex current = currentIndex(); if (current.isValid() && (d->state == QAbstractItemView::EditingState || d->autoScroll)) scrollTo(current); @@ -2163,11 +2165,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } #endif bool modified = (event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)); - if (!event->text().isEmpty() && !modified) { - if (!edit(currentIndex(), AnyKeyPressed, event)) - keyboardSearch(event->text()); + if (!event->text().isEmpty() && !modified && !edit(currentIndex(), AnyKeyPressed, event)) { + keyboardSearch(event->text()); + event->accept(); + } else { + event->ignore(); } - event->ignore(); break; } } } @@ -2842,9 +2845,9 @@ void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget d->persistent.insert(widget); d->addEditor(index, widget, true); widget->show(); + dataChanged(index, index); // update the geometry if (!d->delayedPendingLayout) widget->setGeometry(visualRect(index)); - dataChanged(index, index); // update the geometry } } @@ -3160,13 +3163,18 @@ void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelI update(previous); } } - if (isVisible() && current.isValid() && !d->autoScrollTimer.isActive()) { - if (d->autoScroll) - scrollTo(current); - update(current); - edit(current, CurrentChanged, 0); - if (current.row() == (d->model->rowCount(d->root) - 1)) - d->_q_fetchMore(); + + if (current.isValid() && !d->autoScrollTimer.isActive()) { + if (isVisible()) { + if (d->autoScroll) + scrollTo(current); + update(current); + edit(current, CurrentChanged, 0); + if (current.row() == (d->model->rowCount(d->root) - 1)) + d->_q_fetchMore(); + } else { + d->shouldScrollToCurrentOnShow = d->autoScroll; + } } } diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 37fe4a2..139d0b7 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -99,7 +99,7 @@ public: QVariant data(const QModelIndex &, int) const { return QVariant(); } }; -class Q_GUI_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate +class QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QAbstractItemView) @@ -359,6 +359,7 @@ public: QBasicTimer autoScrollTimer; int autoScrollMargin; int autoScrollCount; + bool shouldScrollToCurrentOnShow; //used to know if we should scroll to current on show event bool alternatingColors; diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index a5a194f..1071c1d 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1608,6 +1608,10 @@ QRegion QListView::visualRegionForSelection(const QItemSelection &selection) con if (!selection.at(i).isValid()) continue; QModelIndex parent = selection.at(i).topLeft().parent(); + //we only display the children of the root in a listview + //we're not interested in the other model indexes + if (parent != d->root) + continue; int t = selection.at(i).topLeft().row(); int b = selection.at(i).bottomRight().row(); if (d->viewMode == IconMode || d->isWrapping()) { // in non-static mode, we have to go through all selected items @@ -1616,8 +1620,8 @@ QRegion QListView::visualRegionForSelection(const QItemSelection &selection) con } else { // in static mode, we can optimize a bit while (t <= b && d->isHidden(t)) ++t; while (b >= t && d->isHidden(b)) --b; - const QModelIndex top = d->model->index(t, c, d->root); - const QModelIndex bottom = d->model->index(b, c, d->root); + const QModelIndex top = d->model->index(t, c, parent); + const QModelIndex bottom = d->model->index(b, c, parent); QRect rect(visualRect(top).topLeft(), visualRect(bottom).bottomRight()); selectionRegion += QRegion(rect); @@ -1997,14 +2001,15 @@ bool QListViewPrivate::doItemsLayout(int delta) int first = batchStartRow(); int last = qMin(first + delta - 1, max); - if (max < 0 || last < first) - return true; // nothing to do - if (first == 0) { layoutChildren(); // make sure the viewport has the right size prepareItemsLayout(); } + if (max < 0 || last < first) { + return true; // nothing to do + } + QListViewLayoutInfo info; info.bounds = layoutBounds; info.grid = gridSize(); diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index fee19c9..56925b8 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -153,6 +153,7 @@ public: const QModelIndex &proxy_index) const { Q_ASSERT(proxy_index.isValid()); + Q_ASSERT(proxy_index.model() == q_func()); const void *p = proxy_index.internalPointer(); Q_ASSERT(p); QMap<QModelIndex, Mapping *>::const_iterator it = @@ -320,6 +321,10 @@ QModelIndex QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex &pro { if (!proxy_index.isValid()) return QModelIndex(); // for now; we may want to be able to set a root index later + if (proxy_index.model() != q_func()) { + qWarning() << "QSortFilterProxyModel: index from wrong model passed to mapToSource"; + return QModelIndex(); + } IndexMap::const_iterator it = index_to_iterator(proxy_index); Mapping *m = it.value(); if ((proxy_index.row() >= m->source_rows.size()) || (proxy_index.column() >= m->source_columns.size())) @@ -333,6 +338,10 @@ QModelIndex QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex &sou { if (!source_index.isValid()) return QModelIndex(); // for now; we may want to be able to set a root index later + if (source_index.model() != model) { + qWarning() << "QSortFilterProxyModel: index from wrong model passed to mapFromSource"; + return QModelIndex(); + } QModelIndex source_parent = source_index.parent(); IndexMap::const_iterator it = create_mapping(source_parent); Mapping *m = it.value(); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 61f1b5b..f6c5cf0 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -680,10 +680,9 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto // refresh the height cache here; we don't really lose anything by getting the size hint, // since QAbstractItemView::dataChanged() will get the visualRect for the items anyway - QModelIndex top = topLeft.sibling(topLeft.row(), 0); - int topViewIndex = d->viewIndex(top); + int topViewIndex = d->viewIndex(topLeft); if (topViewIndex == 0) - d->defaultItemHeight = indexRowSizeHint(top); + d->defaultItemHeight = indexRowSizeHint(topLeft); bool sizeChanged = false; if (topViewIndex != -1) { if (topLeft == bottomRight) { @@ -691,8 +690,7 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto d->invalidateHeightCache(topViewIndex); sizeChanged = (oldHeight != d->itemHeight(topViewIndex)); } else { - QModelIndex bottom = bottomRight.sibling(bottomRight.row(), 0); - int bottomViewIndex = d->viewIndex(bottom); + int bottomViewIndex = d->viewIndex(bottomRight); for (int i = topViewIndex; i <= bottomViewIndex; ++i) { int oldHeight = d->itemHeight(i); d->invalidateHeightCache(i); @@ -1546,7 +1544,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, ? logicalIndexBeforeLeft : logicalIndices.at(currentLogicalSection - 1); if (columnCount == 1 || (nextLogicalSection == 0 && prevLogicalSection == -1) - || (headerSection == 0 && nextLogicalSection == -1)) + || (headerSection == 0 && nextLogicalSection == -1) || spanning) opt.viewItemPosition = QStyleOptionViewItemV4::OnlyOne; else if (headerSection == 0 || (nextLogicalSection != 0 && prevLogicalSection == -1)) opt.viewItemPosition = QStyleOptionViewItemV4::Beginning; @@ -1815,10 +1813,10 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event) if (i == -1) return; // user clicked outside the items - const QModelIndex &index = d->viewItems.at(i).index; + const QPersistentModelIndex firstColumnIndex = d->viewItems.at(i).index; int column = d->header->logicalIndexAt(event->x()); - QPersistentModelIndex persistent = index.sibling(index.row(), column); + QPersistentModelIndex persistent = firstColumnIndex.sibling(firstColumnIndex.row(), column); if (d->pressedIndex != persistent) { mousePressEvent(event); @@ -1841,10 +1839,10 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event) if (d->itemsExpandable && d->expandsOnDoubleClick && d->hasVisibleChildren(persistent)) { - if (!((i < d->viewItems.count()) && (d->viewItems.at(i).index == persistent))) { + if (!((i < d->viewItems.count()) && (d->viewItems.at(i).index == firstColumnIndex))) { // find the new index of the item for (i = 0; i < d->viewItems.count(); ++i) { - if (d->viewItems.at(i).index == persistent) + if (d->viewItems.at(i).index == firstColumnIndex) break; } if (i == d->viewItems.count()) @@ -2422,14 +2420,10 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) ? d->viewItems.count() : d->viewItems.at(parentItem).total) - 1; - int firstColumn = 0; - while (isColumnHidden(firstColumn) && firstColumn < header()->count() - 1) - ++firstColumn; - const int delta = end - start + 1; QVector<QTreeViewItem> insertedItems(delta); for (int i = 0; i < delta; ++i) { - insertedItems[i].index = d->model->index(i + start, firstColumn, parent); + insertedItems[i].index = d->model->index(i + start, 0, parent); insertedItems[i].level = childLevel; } if (d->viewItems.isEmpty()) @@ -2612,7 +2606,7 @@ void QTreeView::expandAll() d->viewItems[i].expanded = true; d->layout(i); QModelIndex idx = d->viewItems.at(i).index; - d->expandedIndexes.insert(idx.sibling(idx.row(), 0)); + d->expandedIndexes.insert(idx); } updateGeometries(); d->viewport->update(); @@ -3130,13 +3124,9 @@ void QTreeViewPrivate::layout(int i) int last = 0; int children = 0; - int firstColumn = 0; - while (header->isSectionHidden(firstColumn) && firstColumn < header->count()) - ++firstColumn; - for (int j = first; j < first + count; ++j) { - current = model->index(j - first, firstColumn, parent); - if (isRowHidden(current.sibling(current.row(), 0))) { + current = model->index(j - first, 0, parent); + if (isRowHidden(current)) { ++hidden; last = j - hidden + children; } else { @@ -3319,15 +3309,11 @@ int QTreeViewPrivate::itemAtCoordinate(int coordinate) const int QTreeViewPrivate::viewIndex(const QModelIndex &_index) const { - Q_Q(const QTreeView); if (!_index.isValid() || viewItems.isEmpty()) return -1; const int totalCount = viewItems.count(); - int firstColumn = 0; - while (q->isColumnHidden(firstColumn) && firstColumn < header->count()) - ++firstColumn; - const QModelIndex index = _index.sibling(_index.row(), firstColumn); + const QModelIndex index = _index.sibling(_index.row(), 0); // A quick check near the last item to see if we are just incrementing diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index c6addc1..b2afbd0 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -1370,7 +1370,7 @@ QAction::MenuRole QAction::menuRole() const void QAction::setIconVisibleInMenu(bool visible) { Q_D(QAction); - if (visible != (bool)d->iconVisibleInMenu) { + if (d->iconVisibleInMenu == -1 || visible != bool(d->iconVisibleInMenu)) { int oldValue = d->iconVisibleInMenu; d->iconVisibleInMenu = visible; // Only send data changed if we really need to. diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 98285f0..b9ebf55 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -4989,6 +4989,137 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy) return true; } +/*! \fn QDecoration &QApplication::qwsDecoration() + Return the QWSDecoration used for decorating windows. + + \warning This method is non-portable. It is only available in + Qt for Embedded Linux. + + \sa QDecoration +*/ + +/*! + \fn void QApplication::qwsSetDecoration(QDecoration *decoration) + + Sets the QDecoration derived class to use for decorating the + windows used by Qt for Embedded Linux to the \a decoration + specified. + + This method is non-portable. It is only available in Qt for Embedded Linux. + + \sa QDecoration +*/ + +/*! \fn QDecoration* QApplication::qwsSetDecoration(const QString &decoration) + \overload + + Requests a QDecoration object for \a decoration from the QDecorationFactory. + + The string must be one of the QDecorationFactory::keys(). Keys are + case insensitive. + + A later call to the QApplication constructor will override the + requested style when a "-style" option is passed in as a commandline + parameter. + + Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object + returned is set as the application's GUI style. +*/ + +/*! + \fn bool QApplication::qwsEventFilter(QWSEvent *event) + + This virtual function is only implemented under Qt for Embedded Linux. + + If you create an application that inherits QApplication and + reimplement this function, you get direct access to all QWS (Q + Window System) events that the are received from the QWS master + process. The events are passed in the \a event parameter. + + Return true if you want to stop the event from being processed. + Return false for normal event dispatching. The default + implementation returns false. +*/ + +/*! \fn void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors) + Set Qt for Embedded Linux custom color table. + + Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube. + The remaining 40 colors may be used by setting a custom color + table in the QWS master process before any clients connect. + + \a colorTable is an array of up to 40 custom colors. \a start is + the starting index (0-39) and \a numColors is the number of colors + to be set (1-40). + + This method is non-portable. It is available \e only in + Qt for Embedded Linux. + + \note The custom colors will not be used by the default screen + driver. To make use of the new colors, implement a custom screen + driver, or use QDirectPainter. +*/ + +/*! \fn int QApplication::qwsProcessEvent(QWSEvent* event) + \internal +*/ + +/*! \fn int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) + \internal +*/ + +/*! \fn int QApplication::x11ProcessEvent(XEvent* event) + This function does the core processing of individual X + \a{event}s, normally by dispatching Qt events to the right + destination. + + It returns 1 if the event was consumed by special handling, 0 if + the \a event was consumed by normal handling, and -1 if the \a + event was for an unrecognized widget. + + \sa x11EventFilter() +*/ + +/*! + \fn bool QApplication::x11EventFilter(XEvent *event) + + \warning This virtual function is only implemented under X11. + + If you create an application that inherits QApplication and + reimplement this function, you get direct access to all X events + that the are received from the X server. The events are passed in + the \a event parameter. + + Return true if you want to stop the event from being processed. + Return false for normal event dispatching. The default + implementation returns false. + + It is only the directly addressed messages that are filtered. + You must install an event filter directly on the event + dispatcher, which is returned by + QAbstractEventDispatcher::instance(), to handle system wide + messages. + + \sa x11ProcessEvent() +*/ + +/*! \fn void QApplication::winFocus(QWidget *widget, bool gotFocus) + \internal + \since 4.1 + + If \a gotFocus is true, \a widget will become the active window. + Otherwise the active window is reset to 0. +*/ + +/*! \fn void QApplication::winMouseButtonUp() + \internal + */ + +/*! \fn void QApplication::syncX() + Synchronizes with the X server in the X11 implementation. + This normally takes some time. Does nothing on other platforms. +*/ + QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index ae99e83..d5fa9ea 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -194,8 +194,8 @@ static bool appNoGrab = false; // mouse/keyboard grabbing #ifndef QT_MAC_USE_COCOA static EventHandlerRef app_proc_handler = 0; static EventHandlerUPP app_proc_handlerUPP = 0; -static AEEventHandlerUPP app_proc_ae_handlerUPP = NULL; #endif +static AEEventHandlerUPP app_proc_ae_handlerUPP = NULL; static EventHandlerRef tablet_proximity_handler = 0; static EventHandlerUPP tablet_proximity_UPP = 0; bool QApplicationPrivate::native_modal_dialog_active; @@ -951,7 +951,6 @@ void qt_mac_event_release(QWidget *w) } } -#ifndef QT_MAC_USE_COCOA struct QMacAppleEventTypeSpec { AEEventClass mac_class; AEEventID mac_id; @@ -959,6 +958,7 @@ struct QMacAppleEventTypeSpec { { kCoreEventClass, kAEQuitApplication }, { kCoreEventClass, kAEOpenDocuments } }; +#ifndef QT_MAC_USE_COCOA /* watched events */ static EventTypeSpec app_events[] = { { kEventClassQt, kEventQtRequestWindowChange }, @@ -1156,13 +1156,13 @@ void qt_init(QApplicationPrivate *priv, int) qt_init_app_proc_handler(); } +#endif if (!app_proc_ae_handlerUPP) { app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor); for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, app_proc_ae_handlerUPP, SRefCon(qApp), true); } -#endif if (QApplicationPrivate::app_style) { QEvent ev(QEvent::Style); @@ -1196,10 +1196,6 @@ void qt_init(QApplicationPrivate *priv, int) [qtMenuLoader release]; } #endif - if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) { - extern void qt_mac_set_native_menubar(bool); - qt_mac_set_native_menubar(false); - } // Register for Carbon tablet proximity events on the event monitor target. // This means that we should receive proximity events even when we aren't the active application. if (!tablet_proximity_handler) { @@ -1210,6 +1206,17 @@ void qt_init(QApplicationPrivate *priv, int) } +void qt_release_apple_event_handler() +{ + if(app_proc_ae_handlerUPP) { + for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) + AERemoveEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, + app_proc_ae_handlerUPP, true); + DisposeAEEventHandlerUPP(app_proc_ae_handlerUPP); + app_proc_ae_handlerUPP = 0; + } +} + /***************************************************************************** qt_cleanup() - cleans up when the application is finished *****************************************************************************/ @@ -1223,15 +1230,8 @@ void qt_cleanup() DisposeEventHandlerUPP(app_proc_handlerUPP); app_proc_handlerUPP = 0; } - if(app_proc_ae_handlerUPP) { - for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) - AERemoveEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, - app_proc_ae_handlerUPP, true); - DisposeAEEventHandlerUPP(app_proc_ae_handlerUPP); - app_proc_ae_handlerUPP = NULL; - } #endif - + qt_release_apple_event_handler(); qt_release_tablet_proximity_handler(); if (tablet_proximity_UPP) DisposeEventHandlerUPP(tablet_proximity_UPP); @@ -2358,6 +2358,12 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event #endif } +// In Carbon this is your one stop for apple events. +// In Cocoa, it ISN'T. This is the catch-all Apple Event handler that exists +// for the time between instantiating the NSApplication, but before the +// NSApplication has installed it's OWN Apple Event handler. When Cocoa has +// that set up, we remove this. So, if you are debugging problems, you likely +// want to check out QCocoaApplicationDelegate instead. OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, AppleEvent *, long handlerRefcon) { QApplication *app = (QApplication *)handlerRefcon; diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index fcfd2a4..1125610 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -2676,9 +2676,6 @@ void QApplication::alert(QWidget *, int) { } -/*! - \internal -*/ int QApplication::qwsProcessEvent(QWSEvent* event) { Q_D(QApplication); @@ -3057,43 +3054,11 @@ int QApplication::qwsProcessEvent(QWSEvent* event) return 0; } -/*! - \fn bool QApplication::qwsEventFilter(QWSEvent *event) - - This virtual function is only implemented under Qt for Embedded Linux. - - If you create an application that inherits QApplication and - reimplement this function, you get direct access to all QWS (Q - Window System) events that the are received from the QWS master - process. The events are passed in the \a event parameter. - - Return true if you want to stop the event from being processed. - Return false for normal event dispatching. The default - implementation returns false. -*/ bool QApplication::qwsEventFilter(QWSEvent *) { return false; } -/*! - Set Qt for Embedded Linux custom color table. - - Qt for Embedded Linux on 8-bpp displays allocates a standard 216 color cube. - The remaining 40 colors may be used by setting a custom color - table in the QWS master process before any clients connect. - - \a colorTable is an array of up to 40 custom colors. \a start is - the starting index (0-39) and \a numColors is the number of colors - to be set (1-40). - - This method is non-portable. It is available \e only in - Qt for Embedded Linux. - - \note The custom colors will not be used by the default screen - driver. To make use of the new colors, implement a custom screen - driver, or use QDirectPainter. -*/ void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors) { if (start < 0 || start > 39) { @@ -3112,30 +3077,11 @@ void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors } #ifndef QT_NO_QWS_MANAGER -/*! - Return the QWSDecoration used for decorating windows. - - \warning This method is non-portable. It is only available in - Qt for Embedded Linux. - - \sa QDecoration -*/ QDecoration &QApplication::qwsDecoration() { return *qws_decoration; } -/*! - \fn void QApplication::qwsSetDecoration(QDecoration *decoration) - - Sets the QDecoration derived class to use for decorating the - windows used by Qt for Embedded Linux to the \a decoration - specified. - - This method is non-portable. It is only available in Qt for Embedded Linux. - - \sa QDecoration -*/ void QApplication::qwsSetDecoration(QDecoration *dec) { if (dec) { @@ -3154,21 +3100,6 @@ void QApplication::qwsSetDecoration(QDecoration *dec) } } -/*! - \overload - - Requests a QDecoration object for \a decoration from the QDecorationFactory. - - The string must be one of the QDecorationFactory::keys(). Keys are - case insensitive. - - A later call to the QApplication constructor will override the - requested style when a "-style" option is passed in as a commandline - parameter. - - Returns 0 if an unknown \a decoration is passed, otherwise the QStyle object - returned is set as the application's GUI style. -*/ QDecoration* QApplication::qwsSetDecoration(const QString &decoration) { QDecoration *decore = QDecorationFactory::create(decoration); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 07b3865..6237657 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -1368,13 +1368,6 @@ QString QApplicationPrivate::appName() const extern uint qGlobalPostedEventsCount(); -/*! - \internal - \since 4.1 - - If \a gotFocus is true, \a widget will become the active window. - Otherwise the active window is reset to 0. -*/ void QApplication::winFocus(QWidget *widget, bool gotFocus) { if (d_func()->inPopupMode()) // some delayed focus event to ignore @@ -1729,6 +1722,21 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam // fall-through intended case WM_KEYUP: case WM_SYSKEYUP: +#if Q_OS_WINCE_WM + case WM_HOTKEY: + if(HIWORD(msg.lParam) == VK_TBACK) { + const bool hotKeyDown = !(LOWORD(msg.lParam) & MOD_KEYUP); + msg.lParam = 0x69 << 16; + msg.wParam = VK_BACK; + if (hotKeyDown) { + msg.message = WM_KEYDOWN; + qt_keymapper_private()->updateKeyMap(msg); + } else { + msg.message = WM_KEYUP; + } + } + // fall-through intended +#endif case WM_IME_CHAR: case WM_IME_KEYDOWN: case WM_CHAR: { @@ -2429,10 +2437,12 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam widget = (QETWidget*)qApp->focusWidget(); HWND focus = ::GetFocus(); //if there is a current widget and the new widget belongs to the same toplevel window + //or if the current widget was embedded into non-qt window (i.e. we won't get WM_ACTIVATEAPP) //then we clear the focus on the widget //in case the new widget belongs to a different widget hierarchy, clearing the focus //will be handled because the active window will change - if (widget && ::IsChild(widget->window()->internalWinId(), focus)) { + const bool embedded = widget && ((QETWidget*)widget->window())->topData()->embedded; + if (widget && (embedded || ::IsChild(widget->window()->internalWinId(), focus))) { widget->clearFocus(); result = true; } else { @@ -2916,7 +2926,6 @@ void qt_win_eatMouseMove() // In DnD, the mouse release event never appears, so the // mouse button state machine must be manually reset -/*! \internal */ void QApplication::winMouseButtonUp() { qt_button_down = 0; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index d7ca2f4..90376b3 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2975,15 +2975,10 @@ QWidget *QApplication::topLevelAt(const QPoint &p) #endif } -/*! - Synchronizes with the X server in the X11 implementation. This - normally takes some time. Does nothing on other platforms. -*/ - void QApplication::syncX() { if (X11->display) - XSync(X11->display, False); // don't discard events + XSync(X11->display, False); // don't discard events } @@ -3085,9 +3080,6 @@ static QETWidget *qPRFindWidget(Window oldwin) return wPRmapper ? (QETWidget*)wPRmapper->value((int)oldwin, 0) : 0; } -/*! - \internal -*/ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) { if (w && !w->internalWinId()) @@ -3150,17 +3142,6 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only) return 0; } -/*! - This function does the core processing of individual X - \a{event}s, normally by dispatching Qt events to the right - destination. - - It returns 1 if the event was consumed by special handling, 0 if - the \a event was consumed by normal handling, and -1 if the \a - event was for an unrecognized widget. - - \sa x11EventFilter() -*/ int QApplication::x11ProcessEvent(XEvent* event) { Q_D(QApplication); @@ -3168,43 +3149,48 @@ int QApplication::x11ProcessEvent(XEvent* event) #ifdef ALIEN_DEBUG //qDebug() << "QApplication::x11ProcessEvent:" << event->type; #endif + Time time = 0, userTime = 0; switch (event->type) { case ButtonPress: pressed_window = event->xbutton.window; - X11->userTime = event->xbutton.time; + userTime = event->xbutton.time; // fallthrough intended case ButtonRelease: - X11->time = event->xbutton.time; + time = event->xbutton.time; break; case MotionNotify: - X11->time = event->xmotion.time; + time = event->xmotion.time; break; case XKeyPress: - X11->userTime = event->xkey.time; + userTime = event->xkey.time; // fallthrough intended case XKeyRelease: - X11->time = event->xkey.time; + time = event->xkey.time; break; case PropertyNotify: - X11->time = event->xproperty.time; + time = event->xproperty.time; break; case EnterNotify: case LeaveNotify: - X11->time = event->xcrossing.time; + time = event->xcrossing.time; break; case SelectionClear: - X11->time = event->xselectionclear.time; + time = event->xselectionclear.time; break; default: - break; - } #ifndef QT_NO_XFIXES - if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) { - XFixesSelectionNotifyEvent *req = - reinterpret_cast<XFixesSelectionNotifyEvent *>(event); - X11->time = req->selection_timestamp; - } + if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) { + XFixesSelectionNotifyEvent *req = + reinterpret_cast<XFixesSelectionNotifyEvent *>(event); + time = req->selection_timestamp; + } #endif + break; + } + if (time > X11->time) + X11->time = time; + if (userTime > X11->userTime) + X11->userTime = userTime; QETWidget *widget = (QETWidget*)QWidget::find((WId)event->xany.window); @@ -3837,29 +3823,6 @@ int QApplication::x11ProcessEvent(XEvent* event) return 0; } -/*! - \fn bool QApplication::x11EventFilter(XEvent *event) - - \warning This virtual function is only implemented under X11. - - If you create an application that inherits QApplication and - reimplement this function, you get direct access to all X events - that the are received from the X server. The events are passed in - the \a event parameter. - - Return true if you want to stop the event from being processed. - Return false for normal event dispatching. The default - implementation returns false. - - It is only the directly addressed messages that are filtered. - You must install an event filter directly on the event - dispatcher, which is returned by - QAbstractEventDispatcher::instance(), to handle system wide - messages. - - \sa x11ProcessEvent() -*/ - bool QApplication::x11EventFilter(XEvent *) { return false; diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 917b5d5..6daf433 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -50,6 +50,7 @@ #include "qvariant.h" #include "qbuffer.h" #include "qimage.h" +#include "qtextcodec.h" QT_BEGIN_NAMESPACE @@ -276,11 +277,12 @@ QClipboard::~QClipboard() */ QString QClipboard::text(QString &subtype, Mode mode) const { - const QMimeData *data = mimeData(mode); + const QMimeData *const data = mimeData(mode); if (!data) return QString(); + + const QStringList formats = data->formats(); if (subtype.isEmpty()) { - QStringList formats = data->formats(); if (formats.contains(QLatin1String("text/plain"))) subtype = QLatin1String("plain"); else { @@ -289,13 +291,21 @@ QString QClipboard::text(QString &subtype, Mode mode) const subtype = formats.at(i).mid(5); break; } + if (subtype.isEmpty()) + return QString(); } - } - if (subtype.isEmpty()) + } else if (!formats.contains(QLatin1String("text/") + subtype)) { return QString(); - if (subtype == QLatin1String("plain")) - return data->text(); - return QString::fromUtf8(data->data(QLatin1String("text/") + subtype)); + } + + const QByteArray rawData = data->data(QLatin1String("text/") + subtype); + + QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default + if (subtype == QLatin1String("html")) + codec = QTextCodec::codecForHtml(rawData, codec); + else + codec = QTextCodec::codecForUtfText(rawData, codec); + return codec->toUnicode(rawData); } /*! diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 089cc43..d7eb111 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -786,7 +786,7 @@ static Atom send_selection(QClipboardData *d, Atom target, Window window, Atom p QByteArray data; QByteArray fmt = X11->xdndAtomToString(target); - if (fmt.isEmpty() || !QInternalMimeData::hasFormatHelper(QString::fromAscii(fmt), d->source())) { // Not a MIME type we have + if (fmt.isEmpty()) { // Not a MIME type we have DEBUG("QClipboard: send_selection(): converting to type '%s' is not supported", fmt.data()); return XNone; } diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm index 6571068..9a24645 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm @@ -183,27 +183,32 @@ static void cleanupCocoaApplicationDelegate() { Q_UNUSED(sender); // The reflection delegate gets precedence - NSApplicationTerminateReply reply = NSTerminateCancel; if (reflectionDelegate && [reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)]) { return [reflectionDelegate applicationShouldTerminate:sender]; } if (qtPrivate->canQuit()) { - reply = NSTerminateNow; if (!startedQuit) { startedQuit = true; qAppInstance()->quit(); startedQuit = false; } } - return reply; + + // Prevent Cocoa from terminating the application, since this simply + // exits the program whithout allowing QApplication::exec() to return. + // The call to QApplication::quit() above will instead quit the + // application from the Qt side. + return NSTerminateCancel; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { Q_UNUSED(aNotification); inLaunch = false; + extern void qt_release_apple_event_handler(); //qapplication_mac.mm + qt_release_apple_event_handler(); } - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 60ac062..1cbc960 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -199,6 +199,7 @@ extern "C" { composingText = new QString(); composing = false; sendKeyEvents = true; + currentCustomTypes = 0; [self setHidden:YES]; return self; } @@ -213,10 +214,16 @@ extern "C" { object:self]; } --(void)registerDragTypes:(bool)accept +-(void)registerDragTypes { QMacCocoaAutoReleasePool pool; - if (accept) { + // Calling registerForDraggedTypes is slow, so only do it once for each widget + // or when the custom types change. + const QStringList& customTypes = qEnabledDraggedTypes(); + if (currentCustomTypes == 0 || *currentCustomTypes != customTypes) { + if (currentCustomTypes == 0) + currentCustomTypes = new QStringList(); + *currentCustomTypes = customTypes; const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName"; NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, NSStringPboardType, @@ -228,13 +235,10 @@ extern "C" { NSFilesPromisePboardType, NSInkTextPboardType, NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; // Add custom types supported by the application. - const QStringList& customTypes = qEnabledDraggedTypes(); for (int i = 0; i < customTypes.size(); i++) { [supportedTypes addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(customTypes[i]))]; } [self registerForDraggedTypes:supportedTypes]; - } else { - [self unregisterDraggedTypes]; } } @@ -283,6 +287,8 @@ extern "C" { - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { + if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false) + return NSDragOperationNone; [self addDropData:sender]; QMimeData *mimeData = dropData; if (QDragManager::self()->source()) @@ -416,6 +422,8 @@ extern "C" { { delete composingText; [[NSNotificationCenter defaultCenter] removeObserver:self]; + delete currentCustomTypes; + [self unregisterDraggedTypes]; [super dealloc]; } diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h index ec1281e..1d4e3e4 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/gui/kernel/qcocoaview_mac_p.h @@ -84,6 +84,7 @@ Q_GUI_EXPORT int composingLength; bool sendKeyEvents; QString *composingText; + QStringList *currentCustomTypes; } - (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; - (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; @@ -92,7 +93,7 @@ Q_GUI_EXPORT - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender; - (void)draggingExited:(id < NSDraggingInfo >)sender; - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender; -- (void)registerDragTypes:(bool)accept; +- (void)registerDragTypes; - (void)removeDropData; - (void)addDropData:(id <NSDraggingInfo>)sender; - (void)setSupportedActions:(NSDragOperation)actions; diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 4c9c73c..9b2305d 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -542,6 +542,8 @@ bool QX11Data::xdndMimeDataForAtom(Atom a, QMimeData *mimeData, QByteArray *data dm->xdndMimeTransferedPixmapIndex = (dm->xdndMimeTransferedPixmapIndex + 1) % 2; } + } else { + DEBUG("QClipboard: xdndMimeDataForAtom(): converting to type '%s' is not supported", qPrintable(atomName)); } } return data; @@ -622,28 +624,12 @@ QVariant QX11Data::xdndMimeConvertToFormat(Atom a, const QByteArray &data, const if (format == QLatin1String("image/ppm")) { if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { Pixmap xpm = *((Pixmap*)data.data()); - Display *dpy = display; - Window r; - int x,y; - uint w,h,bw,d; if (!xpm) return QByteArray(); - XGetGeometry(dpy,xpm, &r,&x,&y,&w,&h,&bw,&d); + QPixmap qpm = QPixmap::fromX11Pixmap(xpm); QImageWriter imageWriter; - GC gc = XCreateGC(dpy, xpm, 0, 0); - QImage imageToWrite; - if (d == 1) { - QBitmap qbm(w,h); - XCopyArea(dpy,xpm,qbm.handle(),gc,0,0,w,h,0,0); - imageWriter.setFormat("PBMRAW"); - imageToWrite = qbm.toImage(); - } else { - QPixmap qpm(w,h); - XCopyArea(dpy,xpm,qpm.handle(),gc,0,0,w,h,0,0); - imageWriter.setFormat("PPMRAW"); - imageToWrite = qpm.toImage(); - } - XFreeGC(dpy,gc); + imageWriter.setFormat("PPMRAW"); + QImage imageToWrite = qpm.toImage(); QBuffer buf; buf.open(QIODevice::WriteOnly); imageWriter.setDevice(&buf); diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8c7e47d..0ab4423 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -675,12 +675,13 @@ QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease, or QEvent::ShortcutOverride. - If \a key is 0, the event is not a result of - a known key; for example, it may be the result of a compose - sequence or keyboard macro. The \a modifiers holds the keyboard - modifiers, and the given \a text is the Unicode text that the - key generated. If \a autorep is true, isAutoRepeat() will be - true. \a count is the number of keys involved in the event. + Int \a key is the code for the Qt::Key that the event loop should listen + for. If \a key is 0, the event is not a result of a known key; for + example, it may be the result of a compose sequence or keyboard macro. + The \a modifiers holds the keyboard modifiers, and the given \a text + is the Unicode text that the key generated. If \a autorep is true, + isAutoRepeat() will be true. \a count is the number of keys involved + in the event. */ QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text, bool autorep, ushort count) @@ -860,6 +861,17 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference uint platform = QApplicationPrivate::currentPlatform(); +#ifdef Q_WS_MAC + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + uint oldSearchKey = searchkey; + searchkey &= ~(Qt::ControlModifier | Qt::MetaModifier); + if (oldSearchKey & Qt::ControlModifier) + searchkey |= Qt::MetaModifier; + if (oldSearchKey & Qt::MetaModifier) + searchkey |= Qt::ControlModifier; + } +#endif + uint N = QKeySequencePrivate::numberOfKeyBindings; int first = 0; int last = N - 1; diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index cc94aad..8e762d6 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE // // ### Qt 5: remove -class Q_GUI_EXPORT QKeyEventEx : public QKeyEvent +class QKeyEventEx : public QKeyEvent { public: QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers, @@ -76,7 +76,7 @@ protected: }; // ### Qt 5: remove -class Q_GUI_EXPORT QMouseEventEx : public QMouseEvent +class QMouseEventEx : public QMouseEvent { public: QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos, diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp index e2d6108..a665c89 100644 --- a/src/gui/kernel/qformlayout.cpp +++ b/src/gui/kernel/qformlayout.cpp @@ -689,12 +689,16 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) // are split. maxLabelWidth = 0; if (!wrapAllRows) { + int maxFieldMinWidth = 0; //the maximum minimum size of the field for (int i = 0; i < rr; ++i) { const QFormLayoutItem *label = m_matrix(i, 0); const QFormLayoutItem *field = m_matrix(i, 1); - if (label && (label->sizeHint.width() + (field ? field->minSize.width() : 0) <= width)) + if (label && field && label->sideBySide) maxLabelWidth = qMax(maxLabelWidth, label->sizeHint.width()); + if (field) + maxFieldMinWidth = qMax(maxFieldMinWidth, field->minSize.width() + field->sbsHSpace); } + maxLabelWidth = qMin(maxLabelWidth, width - maxFieldMinWidth); } else { maxLabelWidth = width; } diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index 535d009..503a33b 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -116,6 +116,4 @@ QKeyMapperPrivate *qt_keymapper_private() return QKeyMapper::instance()->d_func(); } -Q_GUI_EXPORT QList<int> qt_keymapper_possibleKeys(QKeyEvent *e) { return QKeyMapper::instance()->possibleKeys(e); } - QT_END_NAMESPACE diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 39abc5e..01b2c13 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -161,6 +161,14 @@ Qt::KeyboardModifiers qt_mac_get_modifiers(int keys) ret |= Qt::KeyboardModifier(qt_mac_modifier_symbols[i].qt_code); } } + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + Qt::KeyboardModifiers oldModifiers = ret; + ret &= ~(Qt::MetaModifier | Qt::ControlModifier); + if (oldModifiers & Qt::ControlModifier) + ret |= Qt::MetaModifier; + if (oldModifiers & Qt::MetaModifier) + ret |= Qt::ControlModifier; + } return ret; } static int qt_mac_get_mac_modifiers(Qt::KeyboardModifiers keys) @@ -177,6 +185,15 @@ static int qt_mac_get_mac_modifiers(Qt::KeyboardModifiers keys) ret |= qt_mac_modifier_symbols[i].mac_code; } } + + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + int oldModifiers = ret; + ret &= ~(controlKeyBit | cmdKeyBit); + if (oldModifiers & controlKeyBit) + ret |= cmdKeyBit; + if (oldModifiers & cmdKeyBit) + ret |= controlKeyBit; + } return ret; } void qt_mac_send_modifiers_changed(quint32 modifiers, QObject *object) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 352d26a..d1cb572 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -105,20 +105,39 @@ static bool operator<(int key, const MacSpecialKey &entry) static const MacSpecialKey * const MacSpecialKeyEntriesEnd = entries + NumEntries; -static QChar macSymbolForQtKey(int key) +QChar qt_macSymbolForQtKey(int key) { const MacSpecialKey *i = qBinaryFind(entries, MacSpecialKeyEntriesEnd, key); if (i == MacSpecialKeyEntriesEnd) return QChar(); - return QChar(i->macSymbol); + ushort macSymbol = i->macSymbol; + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta) + && (macSymbol == kControlUnicode || macSymbol == kCommandUnicode)) { + if (macSymbol == kControlUnicode) + macSymbol = kCommandUnicode; + else + macSymbol = kControlUnicode; + } + + return QChar(macSymbol); } static int qtkeyForMacSymbol(const QChar ch) { + const ushort unicode = ch.unicode(); for (int i = 0; i < NumEntries; ++i) { const MacSpecialKey &entry = entries[i]; - if (entry.macSymbol == ch.unicode()) - return entry.key; + if (entry.macSymbol == unicode) { + int key = entry.key; + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta) + && (unicode == kControlUnicode || unicode == kCommandUnicode)) { + if (unicode == kControlUnicode) + key = Qt::Key_Control; + else + key = Qt::Key_Meta; + } + return key; + } } return -1; } @@ -213,12 +232,14 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \i Open \i Ctrl+O \i Ctrl+O \i Ctrl+O \i Ctrl+O \row \i Close \i Ctrl+F4, Ctrl+W \i Ctrl+W, Ctrl+F4 \i Ctrl+W \i Ctrl+W \row \i Save \i Ctrl+S \i Ctrl+S \i Ctrl+S \i Ctrl+S + \row \i Quit \i \i Ctrl+Q \i Qtrl+Q \i Qtrl+Q \row \i SaveAs \i \i Ctrl+Shift+S \i \i Ctrl+Shift+S \row \i New \i Ctrl+N \i Ctrl+N \i Ctrl+N \i Ctrl+N \row \i Delete \i Del \i Del, Meta+D \i Del, Ctrl+D \i Del, Ctrl+D \row \i Cut \i Ctrl+X, Shift+Del \i Ctrl+X \i Ctrl+X, F20, Shift+Del \i Ctrl+X, F20, Shift+Del \row \i Copy \i Ctrl+C, Ctrl+Ins \i Ctrl+C \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C, F16, Ctrl+Ins \row \i Paste \i Ctrl+V, Shift+Ins \i Ctrl+V \i Ctrl+V, F18, Shift+Ins \i Ctrl+V, F18, Shift+Ins + \row \i Preferences \i \i Ctrl+, \i \i \row \i Undo \i Ctrl+Z, Alt+Backspace \i Ctrl+Z \i Ctrl+Z, F14 \i Ctrl+Z, F14 \row \i Redo \i Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \i Ctrl+Shift+Z, Ctrl+Y \i Ctrl+Shift+Z \i Ctrl+Shift+Z \row \i Back \i Alt+Left, Backspace \i Ctrl+[ \i Alt+Left \i Alt+Left @@ -521,6 +542,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QApplicationPrivate::KB_Win}, {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QApplicationPrivate::KB_All}, {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_KDE}, + {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_Mac}, {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QApplicationPrivate::KB_All}, {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QApplicationPrivate::KB_KDE}, {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QApplicationPrivate::KB_Mac}, @@ -538,6 +560,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = { {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QApplicationPrivate::KB_All}, {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QApplicationPrivate::KB_All}, {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QApplicationPrivate::KB_All}, + {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_KDE | QApplicationPrivate::KB_Mac}, {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_KDE}, {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QApplicationPrivate::KB_All}, @@ -671,12 +694,14 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate \value NextChild Navigate to next tab or child window. \value Open Open document. \value Paste Paste. + \value Preferences Open the preferences dialog. \value PreviousChild Navigate to previous tab or child window. \value Print Print document. + \value Quit Quit the application. \value Redo Redo. \value Refresh Refresh or reload current document. \value Replace Find and replace. - \value SaveAs Save document after prompting the user for a file name. + \value SaveAs Save document after prompting the user for a file name. \value Save Save document. \value SelectAll Select all text. \value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on OS X. @@ -782,6 +807,21 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence) d->ref.ref(); } +#ifdef Q_WS_MAC +static inline int maybeSwapShortcut(int shortcut) +{ + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + uint oldshortcut = shortcut; + shortcut &= ~(Qt::CTRL | Qt::META); + if (oldshortcut & Qt::CTRL) + shortcut |= Qt::META; + if (oldshortcut & Qt::META) + shortcut |= Qt::CTRL; + } + return shortcut; +} +#endif + /*! \since 4.2 @@ -798,10 +838,16 @@ QList<QKeySequence> QKeySequence::keyBindings(StandardKey key) for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) { QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i]; if (keyBinding.standardKey == key && (keyBinding.platform & platform)) { - if (keyBinding.priority > 0) - list.prepend(QKeySequence(QKeySequencePrivate::keyBindings[i].shortcut)); - else - list.append(QKeySequence(QKeySequencePrivate::keyBindings[i].shortcut)); + uint shortcut = +#ifdef Q_WS_MAC + maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut); +#else + QKeySequencePrivate::keyBindings[i].shortcut; +#endif + if (keyBinding.priority > 0) + list.prepend(QKeySequence(shortcut)); + else + list.append(QKeySequence(shortcut)); } } return list; @@ -969,9 +1015,16 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence gmodifs = globalModifs(); if (gmodifs->isEmpty()) { #ifdef Q_WS_MAC - *gmodifs << QModifKeyName(Qt::CTRL, QChar(kCommandUnicode)); + const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta); + if (dontSwap) + *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode)); + else + *gmodifs << QModifKeyName(Qt::CTRL, QChar(kCommandUnicode)); *gmodifs << QModifKeyName(Qt::ALT, QChar(kOptionUnicode)); - *gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode)); + if (dontSwap) + *gmodifs << QModifKeyName(Qt::CTRL, QChar(kControlUnicode)); + else + *gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode)); *gmodifs << QModifKeyName(Qt::SHIFT, QChar(kShiftUnicode)); #endif *gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+")) @@ -1069,8 +1122,6 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence if (found) break; } -#ifdef Q_WS_MAC -#endif } return ret; } @@ -1099,15 +1150,30 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat QString s; #if defined(Q_WS_MAC) if (nativeText) { - // On MAC the order is Meta, Alt, Shift, Control. - if ((key & Qt::META) == Qt::META) - s += macSymbolForQtKey(Qt::Key_Meta); - if ((key & Qt::ALT) == Qt::ALT) - s += macSymbolForQtKey(Qt::Key_Alt); - if ((key & Qt::SHIFT) == Qt::SHIFT) - s += macSymbolForQtKey(Qt::Key_Shift); - if ((key & Qt::CTRL) == Qt::CTRL) - s += macSymbolForQtKey(Qt::Key_Control); + // On Mac OS X the order (by default) is Meta, Alt, Shift, Control. + // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order + // is Ctrl, Alt, Shift, Meta. The macSymbolForQtKey does this swap + // for us, which means that we have to adjust our order here. + // The upshot is a lot more infrastructure to keep the number of + // if tests down and the code relatively clean. + static const int ModifierOrder[] = { Qt::META, Qt::ALT, Qt::SHIFT, Qt::CTRL, 0 }; + static const int QtKeyOrder[] = { Qt::Key_Meta, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Control, 0 }; + static const int DontSwapModifierOrder[] = { Qt::CTRL, Qt::ALT, Qt::SHIFT, Qt::META, 0 }; + static const int DontSwapQtKeyOrder[] = { Qt::Key_Control, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Meta, 0 }; + const int *modifierOrder; + const int *qtkeyOrder; + if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { + modifierOrder = DontSwapModifierOrder; + qtkeyOrder = DontSwapQtKeyOrder; + } else { + modifierOrder = ModifierOrder; + qtkeyOrder = QtKeyOrder; + } + + for (int i = 0; modifierOrder[i] != 0; ++i) { + if (key & modifierOrder[i]) + s += qt_macSymbolForQtKey(qtkeyOrder[i]); + } } else #endif { @@ -1140,7 +1206,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat int i=0; #if defined(Q_WS_MAC) if (nativeText) { - QChar ch = macSymbolForQtKey(key); + QChar ch = qt_macSymbolForQtKey(key); if (!ch.isNull()) p = ch; else diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index 1c4776f..f78e34a 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -136,7 +136,9 @@ public: DeleteEndOfLine, InsertParagraphSeparator, InsertLineSeparator, - SaveAs + SaveAs, + Preferences, + Quit }; QKeySequence(); diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index 1d5a70d..4463aab 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -1028,8 +1028,13 @@ void QLayout::freeze(int w, int h) void QLayout::setMenuBar(QWidget *widget) { Q_D(QLayout); - if (widget) - addChildWidget(widget); + +#ifdef Q_OS_WINCE_WM + if (widget && widget->size().height() > 0) +#else + if (widget) +#endif + addChildWidget(widget); d->menubar = widget; } diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp index 0fd73b8..c70ab2d 100644 --- a/src/gui/kernel/qlayoutitem.cpp +++ b/src/gui/kernel/qlayoutitem.cpp @@ -54,7 +54,8 @@ QT_BEGIN_NAMESPACE inline static QRect fromLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) { - return priv->fromOrToLayoutItemRect(rect, -1); + return rect.adjusted(priv->leftLayoutItemMargin, priv->topLayoutItemMargin, + -priv->rightLayoutItemMargin, -priv->bottomLayoutItemMargin); } inline static QSize fromLayoutItemSize(QWidgetPrivate *priv, const QSize &size) @@ -64,7 +65,8 @@ inline static QSize fromLayoutItemSize(QWidgetPrivate *priv, const QSize &size) inline static QRect toLayoutItemRect(QWidgetPrivate *priv, const QRect &rect) { - return priv->fromOrToLayoutItemRect(rect, +1); + return rect.adjusted(-priv->leftLayoutItemMargin, -priv->topLayoutItemMargin, + priv->rightLayoutItemMargin, priv->bottomLayoutItemMargin); } inline static QSize toLayoutItemSize(QWidgetPrivate *priv, const QSize &size) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index ed9654b..f998bb2 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -61,8 +61,6 @@ QT_BEGIN_NAMESPACE -extern bool qt_mac_no_native_menubar; // qmenu_mac.cpp - // To enable verbose output uncomment below //#define DEBUG_QSHORTCUTMAP @@ -660,7 +658,7 @@ bool QShortcutMap::correctWidgetContext(Qt::ShortcutContext context, QWidget *w, { bool visible = w->isVisible(); #ifdef Q_WS_MAC - if (!qt_mac_no_native_menubar && qobject_cast<QMenuBar *>(w)) + if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) visible = true; #endif @@ -723,7 +721,7 @@ bool QShortcutMap::correctGraphicsWidgetContext(Qt::ShortcutContext context, QGr { bool visible = w->isVisible(); #ifdef Q_WS_MAC - if (!qt_mac_no_native_menubar && qobject_cast<QMenuBar *>(w)) + if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) visible = true; #endif @@ -753,6 +751,7 @@ bool QShortcutMap::correctGraphicsWidgetContext(Qt::ShortcutContext context, QGr tw = tw->parentWidget(); return tw == w; } + return false; } // Below is Qt::WindowShortcut context diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index f000292..9165836 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -826,13 +826,28 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev QWidget *qwidget = [theView qt_qwidget]; QWidget *widgetToGetMouse = qwidget; QWidget *popup = qAppInstance()->activePopupWidget(); - if (popup && popup != qwidget->window()) - widgetToGetMouse = popup; NSView *tmpView = theView; - if (widgetToGetMouse != qwidget) { - tmpView = qt_mac_nativeview_for(widgetToGetMouse); + + if (popup && popup != qwidget->window()) { + widgetToGetMouse = popup; + tmpView = qt_mac_nativeview_for(popup); windowPoint = [[tmpView window] convertScreenToBase:globalPoint]; + + QPoint qWindowPoint(windowPoint.x, windowPoint.y); + if (widgetToGetMouse->rect().contains(qWindowPoint)) { + // Keeping the mouse pressed on a combobox button will make + // the popup pop in front of the mouse. But all mouse events + // will be sendt to the button. Since we want mouse events + // to be sendt to widgets inside the popup, we search for the + // widget in front of the mouse: + tmpView = [tmpView hitTest:windowPoint]; + if (!tmpView) + return false; + widgetToGetMouse = + [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(tmpView) qt_qwidget]; + } } + NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil]; QPoint qlocalPoint(localPoint.x, localPoint.y); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index dd95053..ab529fe 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -167,39 +167,48 @@ static inline bool bypassGraphicsProxyWidget(QWidget *p) extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp -QWidgetPrivate::QWidgetPrivate(int version) : - QObjectPrivate(version), extra(0), focus_child(0) - ,layout(0), widgetItem(0) - ,leftmargin(0), topmargin(0), rightmargin(0), bottommargin(0) - ,leftLayoutItemMargin(0), topLayoutItemMargin(0), rightLayoutItemMargin(0) - ,bottomLayoutItemMargin(0) - ,fg_role(QPalette::NoRole) - ,bg_role(QPalette::NoRole) - ,hd(0) - ,dirty(0) - ,needsFlush(0) - ,dirtyOpaqueChildren(1) - ,isOpaque(0) - ,inDirtyList(0) - ,isScrolled(0) - ,isMoved(0) - ,usesDoubleBufferedGLContext(0) -#ifdef Q_WS_WIN - ,noPaintOnScreen(0) -#endif - ,inheritedFontResolveMask(0) - ,inheritedPaletteResolveMask(0) +QWidgetPrivate::QWidgetPrivate(int version) + : QObjectPrivate(version) + , extra(0) + , focus_next(0) + , focus_prev(0) + , focus_child(0) + , layout(0) + , needsFlush(0) + , redirectDev(0) + , widgetItem(0) + , extraPaintEngine(0) + , polished(0) + , inheritedFontResolveMask(0) + , inheritedPaletteResolveMask(0) + , leftmargin(0) + , topmargin(0) + , rightmargin(0) + , bottommargin(0) + , leftLayoutItemMargin(0) + , topLayoutItemMargin(0) + , rightLayoutItemMargin(0) + , bottomLayoutItemMargin(0) + , hd(0) + , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) + , fg_role(QPalette::NoRole) + , bg_role(QPalette::NoRole) + , dirtyOpaqueChildren(1) + , isOpaque(0) + , inDirtyList(0) + , isScrolled(0) + , isMoved(0) + , usesDoubleBufferedGLContext(0) #if defined(Q_WS_X11) - ,picture(0) -#endif -#ifdef Q_WS_MAC - ,needWindowChange(0) - ,isGLWidget(0) + , picture(0) +#elif defined(Q_WS_WIN) + , noPaintOnScreen(0) +#elif defined(Q_WS_MAC) + , needWindowChange(0) + , isGLWidget(0) + , window_event(0) + , qd_hd(0) #endif - ,polished(0) - - , size_policy(QSizePolicy::Preferred, QSizePolicy::Preferred) - , redirectDev(0) { if (!qApp) { qFatal("QWidget: Must construct a QApplication before a QPaintDevice"); @@ -1345,7 +1354,7 @@ QWidget::~QWidget() d->setDirtyOpaqueRegion(); if (isWindow() && isVisible() && internalWinId()) - hide(); + d->close_helper(QWidgetPrivate::CloseNoEvent); #if defined(Q_WS_WIN) || defined(Q_WS_X11) else if (!internalWinId() && isVisible()) qApp->d_func()->sendSyntheticEnterLeave(this); @@ -1412,36 +1421,26 @@ void QWidgetPrivate::createTLExtra() createExtra(); if (!extra->topextra) { QTLWExtra* x = extra->topextra = new QTLWExtra; + x->icon = 0; + x->iconPixmap = 0; + x->backingStore = 0; x->windowSurface = 0; + x->sharedPainter = 0; + x->incw = x->inch = 0; + x->basew = x->baseh = 0; + x->frameStrut.setCoords(0, 0, 0, 0); + x->normalGeometry = QRect(0,0,-1,-1); + x->savedFlags = 0; x->opacity = 255; x->posFromMove = false; x->sizeAdjusted = false; x->inTopLevelResize = false; x->inRepaint = false; - x->backingStore = 0; - x->icon = 0; - x->iconPixmap = 0; - x->frameStrut.setCoords(0, 0, 0, 0); - x->incw = x->inch = 0; - x->basew = x->baseh = 0; - x->normalGeometry = QRect(0,0,-1,-1); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) x->embedded = 0; -#endif -#if defined(Q_WS_X11) - x->parentWinId = 0; - x->spont_unmapped = 0; - x->dnd = 0; -#endif - x->savedFlags = 0; -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) - x->qwsManager = 0; -#endif - x->sharedPainter = 0; createTLSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG - static int count = 0; - qDebug() << "tlextra" << ++count; + static int count = 0; + qDebug() << "tlextra" << ++count; #endif } } @@ -1455,27 +1454,28 @@ void QWidgetPrivate::createExtra() { if (!extra) { // if not exists extra = new QWExtra; - extra->minw = extra->minh = 0; - extra->maxw = extra->maxh = QWIDGETSIZE_MAX; + extra->glContext = 0; + extra->topextra = 0; + extra->proxyWidget = 0; +#ifndef QT_NO_CURSOR + extra->curs = 0; +#endif + extra->minw = 0; + extra->minh = 0; + extra->maxw = QWIDGETSIZE_MAX; + extra->maxh = QWIDGETSIZE_MAX; + extra->customDpiX = 0; + extra->customDpiY = 0; extra->explicitMinSize = 0; extra->explicitMaxSize = 0; extra->autoFillBackground = 0; extra->nativeChildrenForced = 0; extra->inRenderWithPainter = 0; extra->hasMask = 0; -#ifndef QT_NO_CURSOR - extra->curs = 0; -#endif - extra->style = 0; - extra->topextra = 0; - extra->proxyWidget = 0; - extra->glContext = 0; - extra->customDpiX = 0; - extra->customDpiY = 0; createSysExtra(); #ifdef QWIDGET_EXTRA_DEBUG - static int count = 0; - qDebug() << "extra" << ++count; + static int count = 0; + qDebug() << "extra" << ++count; #endif } } @@ -1516,45 +1516,6 @@ void QWidgetPrivate::deleteExtra() } /* - Returns true if the background is inherited; otherwise returns - false. - - Mainly used in the paintOnScreen case. -*/ - -bool QWidgetPrivate::isBackgroundInherited() const -{ - Q_Q(const QWidget); - - // windows do not inherit their background - if (q->isWindow() || q->windowType() == Qt::SubWindow) - return false; - - if (q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_OpaquePaintEvent)) - return false; - - const QPalette &pal = q->palette(); - QPalette::ColorRole bg = q->backgroundRole(); - QBrush brush = pal.brush(bg); - - // non opaque brushes leaves us no choice, we must inherit - if (!q->autoFillBackground() || !brush.isOpaque()) - return true; - - if (brush.style() == Qt::SolidPattern) { - // the background is just a solid color. If there is no - // propagated contents, then we claim as performance - // optimization that it was not inheritet. This is the normal - // case in standard Windows or Motif style. - const QWidget *w = q->parentWidget(); - if (!w->d_func()->isBackgroundInherited()) - return false; - } - - return true; -} - -/* Returns true if there are widgets above this which overlap with \a rect, which is in parent's coordinate system (same as crect). */ @@ -1900,24 +1861,6 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion ®ion) const } } -bool QWidgetPrivate::hasBackground() const -{ - Q_Q(const QWidget); - if (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_PaintOnScreen)) - return true; - if (q->testAttribute(Qt::WA_PaintOnScreen)) - return true; - if (!q->testAttribute(Qt::WA_OpaquePaintEvent) && !q->testAttribute(Qt::WA_NoSystemBackground)) { - const QPalette &pal = q->palette(); - QPalette::ColorRole bg = q->backgroundRole(); - QBrush bgBrush = pal.brush(bg); - return (bgBrush.style() != Qt::NoBrush && - ((q->isWindow() || q->windowType() == Qt::SubWindow) - || (QPalette::ColorRole(bg_role) != QPalette::NoRole || (pal.resolve() & (1<<bg))))); - } - return false; -} - bool QWidgetPrivate::paintOnScreen() const { #if defined(Q_WS_QWS) @@ -4810,7 +4753,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, Q_ASSERT(engine); QPaintEnginePrivate *enginePriv = engine->d_func(); Q_ASSERT(enginePriv); - QPaintDevice *target = painter->worldMatrixEnabled() ? engine->paintDevice() : painter->device(); + QPaintDevice *target = engine->paintDevice(); Q_ASSERT(target); // Render via a pixmap when dealing with non-opaque painters or printers. @@ -6157,14 +6100,6 @@ int QWidgetPrivate::pointToRect(const QPoint &p, const QRect &r) return dx + dy; } -QRect QWidgetPrivate::fromOrToLayoutItemRect(const QRect &rect, int sign) const -{ - QRect r = rect; - r.adjust(-sign * leftLayoutItemMargin, -sign * topLayoutItemMargin, - +sign * rightLayoutItemMargin, +sign * bottomLayoutItemMargin); - return r; -} - /*! \property QWidget::frameSize \brief the size of the widget including any window frame @@ -11420,3 +11355,17 @@ void QWidget::clearMask() setMask(QRegion()); } +/*! \fn const QX11Info &QWidget::x11Info() const + Returns information about the configuration of the X display used to display + the widget. + + \warning This function is only available on X11. +*/ + +/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const + Returns the X11 Picture handle of the widget for XRender + support. Use of this function is not portable. This function will + return 0 if XRender support is not compiled into Qt, if the + XRender extension is not supported on the X11 display, or if the + handle could not be created. +*/ diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b238279..6d3da61 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1599,24 +1599,6 @@ bool QWidgetPrivate::qt_create_root_win() return true; } -bool QWidgetPrivate::qt_recreate_root_win() -{ - if(!qt_root_win) //sanity check - return false; - //store old - OSWindowRef old_root_win = qt_root_win; - //recreate - qt_root_win = 0; - qt_create_root_win(); - //cleanup old window -#ifdef QT_MAC_USE_COCOA - [old_root_win release]; -#else - CFRelease(old_root_win); -#endif - return true; -} - bool QWidgetPrivate::qt_widget_rgn(QWidget *widget, short wcode, RgnHandle rgn, bool force = false) { bool ret = false; @@ -2156,6 +2138,7 @@ void QWidgetPrivate::finishCreateWindow_sys_Carbon(OSWindowRef windowRef) setWindowModified_sys(q->isWindowModified()); updateFrameStrut(); qt_mac_update_sizer(q); + applyMaxAndMinSizeOnWindow(); } #else // QT_MAC_USE_COCOA void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWindowRef) @@ -2241,6 +2224,7 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin syncCocoaMask(); macUpdateIsOpaque(); qt_mac_update_sizer(q); + applyMaxAndMinSizeOnWindow(); } #endif // QT_MAC_USE_COCOA @@ -3995,7 +3979,7 @@ void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) } } -void QWidgetPrivate::applyMaxAndMinSizeConstraints(int &w, int &h) +void QWidgetPrivate::adjustWithinMaxAndMinSize(int &w, int &h) { if (QWExtra *extra = extraData()) { w = qMin(w, extra->maxw); @@ -4022,6 +4006,26 @@ void QWidgetPrivate::applyMaxAndMinSizeConstraints(int &w, int &h) } } +void QWidgetPrivate::applyMaxAndMinSizeOnWindow() +{ + Q_Q(QWidget); + const float max_f(20000); +#ifndef QT_MAC_USE_COCOA +#define SF(x) ((x > max_f) ? max_f : x) + HISize max = CGSizeMake(SF(extra->maxw), SF(extra->maxh)); + HISize min = CGSizeMake(SF(extra->minw), SF(extra->minh)); +#undef SF + SetWindowResizeLimits(qt_mac_window_for(q), &min, &max); +#else +#define SF(x) ((x > max_f) ? max_f : x) + NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh)); + NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh)); +#undef SF + [qt_mac_window_for(q) setMinSize:min]; + [qt_mac_window_for(q) setMaxSize:max]; +#endif +} + void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) { Q_Q(QWidget); @@ -4033,17 +4037,18 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QMacCocoaAutoReleasePool pool; bool realWindow = isRealWindow(); - if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen) + if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen)){ + adjustWithinMaxAndMinSize(w, h); #ifndef QT_MAC_USE_COCOA - && !(w == 0 && h == 0) -#endif - ){ - applyMaxAndMinSizeConstraints(w, h); - topData()->isSetGeometry = 1; - topData()->isMove = isMove; -#ifndef QT_MAC_USE_COCOA - Rect r; SetRect(&r, x, y, x + w, y + h); - SetWindowBounds(qt_mac_window_for(q), kWindowContentRgn, &r); + if (w != 0 && h != 0) { + topData()->isSetGeometry = 1; + topData()->isMove = isMove; + Rect r; SetRect(&r, x, y, x + w, y + h); + SetWindowBounds(qt_mac_window_for(q), kWindowContentRgn, &r); + topData()->isSetGeometry = 0; + } else { + setGeometry_sys_helper(x, y, w, h, isMove); + } #else NSWindow *window = qt_mac_window_for(q); const QRect &fStrut = frameStrut(); @@ -4071,7 +4076,6 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) [window setFrameOrigin:cocoaFrameRect.origin]; } #endif - topData()->isSetGeometry = 0; } else { setGeometry_sys_helper(x, y, w, h, isMove); } @@ -4096,40 +4100,19 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM data.crect = QRect(x, y, w, h); if (realWindow) { - if (QWExtra *extra = extraData()) { - applyMaxAndMinSizeConstraints(w, h); - qt_mac_update_sizer(q); + adjustWithinMaxAndMinSize(w, h); + qt_mac_update_sizer(q); - if (q->windowFlags() & Qt::WindowMaximizeButtonHint) { #ifndef QT_MAC_USE_COCOA - OSWindowRef window = qt_mac_window_for(q); - if(extra->maxw && extra->maxh && extra->maxw == extra->minw - && extra->maxh == extra->minh) { - ChangeWindowAttributes(window, kWindowNoAttributes, kWindowFullZoomAttribute); - } else { - ChangeWindowAttributes(window, kWindowFullZoomAttribute, kWindowNoAttributes); - } -#endif + if (q->windowFlags() & Qt::WindowMaximizeButtonHint) { + OSWindowRef window = qt_mac_window_for(q); + if (extra->maxw && extra->maxh && extra->maxw == extra->minw + && extra->maxh == extra->minh) { + ChangeWindowAttributes(window, kWindowNoAttributes, kWindowFullZoomAttribute); + } else { + ChangeWindowAttributes(window, kWindowFullZoomAttribute, kWindowNoAttributes); } - - // Update max and min constraints: - const float max_f(20000); -#ifndef QT_MAC_USE_COCOA -#define SF(x) ((x > max_f) ? max_f : x) - HISize max = CGSizeMake(SF(extra->maxw), SF(extra->maxh)); - HISize min = CGSizeMake(SF(extra->minw), SF(extra->minh)); -#undef SF - SetWindowResizeLimits(qt_mac_window_for(q), &min, &max); -#else -#define SF(x) ((x > max_f) ? max_f : x) - NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh)); - NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh)); -#undef SF - [qt_mac_window_for(q) setMinSize:min]; - [qt_mac_window_for(q) setMaxSize:max]; -#endif } -#ifndef QT_MAC_USE_COCOA HIRect bounds = CGRectMake(0, 0, w, h); HIViewSetFrame(qt_mac_nativeview_for(q), &bounds); #else @@ -4175,6 +4158,7 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM void QWidgetPrivate::setConstraints_sys() { updateMaximizeButton_sys(); + applyMaxAndMinSizeOnWindow(); } void QWidgetPrivate::updateMaximizeButton_sys() @@ -4436,11 +4420,13 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { + extra->topextra->resizer = 0; + extra->topextra->isSetGeometry = 0; + extra->topextra->isMove = 0; + extra->topextra->wattr = 0; extra->topextra->wclass = 0; extra->topextra->group = 0; extra->topextra->windowIcon = 0; - extra->topextra->resizer = 0; - extra->topextra->isSetGeometry = 0; extra->topextra->savedWindowAttributesFromMaximized = 0; } @@ -4489,8 +4475,8 @@ void QWidgetPrivate::registerDropSite(bool on) SetControlDragTrackingEnabled(qt_mac_nativeview_for(q), on); #else NSView *view = qt_mac_nativeview_for(q); - if ([view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) { - [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes:on]; + if (on && [view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) { + [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes]; } #endif } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 8731551..bf4f091 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -99,88 +99,92 @@ class QWidgetItemV2; class QStyle; struct QTLWExtra { + // *************************** Cross-platform variables ***************************** + + // Regular pointers (keep them together to avoid gaps on 64 bits architectures). + QIcon *icon; // widget icon + QPixmap *iconPixmap; + QWidgetBackingStore *backingStore; + QWindowSurface *windowSurface; + QPainter *sharedPainter; + + // Implicit pointers (shared_null). QString caption; // widget caption QString iconText; // widget icon text QString role; // widget role QString filePath; // widget file path - QIcon *icon; // widget icon - QPixmap *iconPixmap; + + // Other variables. short incw, inch; // size increments + short basew, baseh; // base sizes // frame strut, don't use these directly, use QWidgetPrivate::frameStrut() instead. QRect frameStrut; + QRect normalGeometry; // used by showMin/maximized/FullScreen + Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen + + // *************************** Cross-platform bit fields **************************** uint opacity : 8; uint posFromMove : 1; uint sizeAdjusted : 1; uint inTopLevelResize : 1; uint inRepaint : 1; - QWidgetBackingStore *backingStore; -#if defined(Q_WS_WIN) - ulong savedFlags; // Save window flags while showing fullscreen - uint embedded : 1; // window is embedded in another application -#else - Qt::WindowFlags savedFlags; // Save widget flags while showing fullscreen -#endif - short basew, baseh; // base sizes -#if defined(Q_WS_X11) - WId parentWinId; // parent window Id (valid after reparenting) - uint embedded : 1; // window is embedded in another Qt application + uint embedded : 1; + + // *************************** Platform specific values (bit fields first) ********** +#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 uint spont_unmapped: 1; // window was spontaneously unmapped uint dnd : 1; // DND properties installed uint validWMState : 1; // is WM_STATE valid? uint waitingForMapNotify : 1; // show() has been called, haven't got the MapNotify yet + WId parentWinId; // parent window Id (valid after reparenting) WId userTimeWindow; // window id that contains user-time timestamp when WM supports a _NET_WM_USER_TIME_WINDOW atom QPoint fullScreenOffset; -#endif -#if defined(Q_WS_MAC) +#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN + HICON winIconBig; // internal big Windows icon + HICON winIconSmall; // internal small Windows icon +#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC + uint resizer : 4; + uint isSetGeometry : 1; + uint isMove : 1; quint32 wattr; quint32 wclass; WindowGroupRef group; IconRef windowIcon; // the current window icon, if set with setWindowIcon_sys. quint32 savedWindowAttributesFromMaximized; // Saved attributes from when the calling updateMaximizeButton_sys() - uint resizer : 4; - uint isSetGeometry : 1; - uint isMove : 1; - uint embedded : 1; -#endif -#if defined(Q_WS_QWS) && !defined (QT_NO_QWS_MANAGER) +#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS +#ifndef QT_NO_QWS_MANAGER QWSManager *qwsManager; #endif -#if defined(Q_WS_WIN) - HICON winIconBig; // internal big Windows icon - HICON winIconSmall; // internal small Windows icon #endif - QRect normalGeometry; // used by showMin/maximized/FullScreen - QWindowSurface *windowSurface; - QPainter *sharedPainter; }; struct QWExtra { - qint32 minw, minh; // minimum size - qint32 maxw, maxh; // maximum size - QPointer<QWidget> focus_proxy; -#ifndef QT_NO_CURSOR - QCursor *curs; -#endif + // *************************** Cross-platform variables ***************************** + + // Regular pointers (keep them together to avoid gaps on 64 bits architectures). + void *glContext; // if the widget is hijacked by QGLWindowSurface QTLWExtra *topextra; // only useful for TLWs QGraphicsProxyWidget *proxyWidget; // if the widget is embedded - void *glContext; // if the widget is hijacked by QGLWindowSurface -#if defined(Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) - QOleDropTarget *dropTarget; // drop target - QList<QPointer<QWidget> > oleDropWidgets; -#endif -#if defined(Q_WS_X11) - WId xDndProxy; // XDND forwarding to embedded windows +#ifndef QT_NO_CURSOR + QCursor *curs; #endif + QPointer<QStyle> style; + QPointer<QWidget> focus_proxy; + + // Implicit pointers (shared_empty/shared_null). QRegion mask; // widget mask + QString styleSheet; + + // Other variables. + qint32 minw; + qint32 minh; // minimum size + qint32 maxw; + qint32 maxh; // maximum size + quint16 customDpiX; + quint16 customDpiY; QSize staticContentsSize; -//bit flags at the end to improve packing -#if defined(Q_WS_WIN) - uint shown_mode : 8; // widget show mode -#endif -#if defined(Q_WS_X11) - uint compress_events : 1; -#endif + // *************************** Cross-platform bit fields **************************** uint explicitMinSize : 2; uint explicitMaxSize : 2; uint autoFillBackground : 1; @@ -188,16 +192,22 @@ struct QWExtra { uint inRenderWithPainter : 1; uint hasMask : 1; - QPointer<QStyle> style; - QString styleSheet; - - quint16 customDpiX; - quint16 customDpiY; -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) + // *************************** Platform specific values (bit fields first) ********** +#if defined(Q_WS_WIN) // <----------------------------------------------------------- WIN +#ifndef QT_NO_DRAGANDDROP + QOleDropTarget *dropTarget; // drop target + QList<QPointer<QWidget> > oleDropWidgets; +#endif +#elif defined(Q_WS_X11) // <--------------------------------------------------------- X11 + uint compress_events : 1; + WId xDndProxy; // XDND forwarding to embedded windows +#elif defined(Q_WS_MAC) // <------------------------------------------------------ MAC +#ifdef QT_MAC_USE_COCOA // Cocoa Mask stuff QImage maskBits; CGImageRef imageMask; #endif +#endif }; class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate @@ -205,6 +215,24 @@ class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QWidget) public: + // *************************** Cross-platform *************************************** + enum DrawWidgetFlags { + DrawAsRoot = 0x01, + DrawPaintOnScreen = 0x02, + DrawRecursive = 0x04, + DrawInvisible = 0x08, + DontSubtractOpaqueChildren = 0x10, + DontSetCompositionMode = 0x20, + DontDrawOpaqueChildren = 0x40 + }; + + enum CloseMode { + CloseNoEvent, + CloseWithEvent, + CloseWithSpontaneousEvent + }; + + // Functions. explicit QWidgetPrivate(int version = QObjectPrivateVersion); ~QWidgetPrivate(); @@ -214,10 +242,6 @@ public: QPainter *sharedPainter() const; void setSharedPainter(QPainter *painter); QWidgetBackingStore *maybeBackingStore() const; -#ifdef Q_WS_QWS - void setMaxWindowState_helper(); - void setFullScreenSize_helper(); -#endif void init(QWidget *desktopWidget, Qt::WindowFlags f); void create_sys(WId window, bool initializeWindow, bool destroyOldWindow); void createRecursively(); @@ -238,23 +262,6 @@ public: QPalette naturalWidgetPalette(uint inheritedMask) const; void setMask_sys(const QRegion &); -#ifdef Q_WS_WIN - bool shouldShowMaximizeButton(); - void winUpdateIsOpaque(); -#endif - -#ifdef Q_WS_MAC - void macUpdateSizeAttribute(); - void macUpdateHideOnSuspend(); - void macUpdateOpaqueSizeGrip(); - void macUpdateIgnoreMouseEvents(); - void macUpdateMetalAttribute(); - void macUpdateIsOpaque(); - void setEnabled_helper_sys(bool enable); - bool isRealWindow() const; - void applyMaxAndMinSizeConstraints(int &w, int &h); -#endif - void raise_sys(); void lower_sys(); void stackUnder_sys(QWidget *); @@ -279,20 +286,9 @@ public: void setStyle_helper(QStyle *newStyle, bool propagate, bool metalHack = false); void inheritStyle(); - bool isBackgroundInherited() const; - void setUpdatesEnabled_helper(bool ); void paintBackground(QPainter *, const QRegion &, const QPoint & = QPoint(), int flags = DrawAsRoot) const; - enum DrawWidgetFlags { - DrawAsRoot = 0x01, - DrawPaintOnScreen = 0x02, - DrawRecursive = 0x04, - DrawInvisible = 0x08, - DontSubtractOpaqueChildren = 0x10, - DontSetCompositionMode = 0x20, - DontDrawOpaqueChildren = 0x40 - }; bool isAboutToShow() const; QRegion prepareToRender(const QRegion ®ion, QWidget::RenderFlags renderFlags); void render_helper(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, @@ -315,10 +311,6 @@ public: QWindowSurface *createDefaultWindowSurface(); QWindowSurface *createDefaultWindowSurface_sys(); void repaint_sys(const QRegion &rgn); -#ifdef Q_WS_MAC - void update_sys(const QRect &rect); - void update_sys(const QRegion &rgn); -#endif QRect clipRect() const; QRegion clipRegion() const; @@ -329,42 +321,20 @@ public: void updateIsOpaque(); void setOpaque(bool opaque); void updateIsTranslucent(); - bool hasBackground() const; bool paintOnScreen() const; QRegion getOpaqueRegion() const; const QRegion &getOpaqueChildren() const; void setDirtyOpaqueRegion(); - QRegion opaqueChildren; - - enum CloseMode { - CloseNoEvent, - CloseWithEvent, - CloseWithSpontaneousEvent - }; bool close_helper(CloseMode mode); - bool compositeEvent(QEvent *e); void setWindowIcon_helper(); void setWindowIcon_sys(bool forceReset = false); void setWindowOpacity_sys(qreal opacity); - void adjustQuitOnCloseAttribute(); -#if defined(Q_WS_X11) - void setWindowRole(); - void sendStartupMessage(const char *message) const; - void setNetWmWindowTypes(); - void x11UpdateIsOpaque(); -#endif - -#if defined (Q_WS_WIN) - void reparentChildren(); -#endif - void scrollChildren(int dx, int dy); - void moveRect(const QRect &, int dx, int dy); void scrollRect(const QRect &, int dx, int dy); void invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize); @@ -378,7 +348,6 @@ public: void reparentFocusWidgets(QWidget *oldtlw); static int pointToRect(const QPoint &p, const QRect &r); - QRect fromOrToLayoutItemRect(const QRect &rect, int sign) const; void setWinId(WId); void showChildren(bool spontaneous); @@ -388,9 +357,6 @@ public: void scroll_sys(int dx, int dy, const QRect &r); void deactivateWidgetCleanup(); void setGeometry_sys(int, int, int, int, bool); -#ifdef Q_WS_MAC - void setGeometry_sys_helper(int, int, int, int, bool); -#endif void sendPendingMoveAndResizeEvents(bool recursive = false, bool disableUpdates = false); void activateChildLayoutsRecursively(); void show_recursive(); @@ -402,10 +368,6 @@ public: void setEnabled_helper(bool); void registerDropSite(bool); -#if defined(Q_WS_WIN) && !defined(QT_NO_DRAGANDDROP) - QOleDropTarget *registerOleDnd(QWidget *widget); - void unregisterOleDnd(QWidget *widget, QOleDropTarget *target); -#endif static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0); void updateFrameStrut(); @@ -415,32 +377,11 @@ public: void setWindowIconText_helper(const QString &cap); void setWindowTitle_sys(const QString &cap); -#ifdef Q_OS_WIN - void grabMouseWhileInWindow(); -#endif - #ifndef QT_NO_CURSOR void setCursor_sys(const QCursor &cursor); void unsetCursor_sys(); #endif -#ifdef Q_WS_MAC - void setWindowModified_sys(bool b); - void updateMaximizeButton_sys(); - void setWindowFilePath_sys(const QString &filePath); - void createWindow_sys(); - void recreateMacWindow(); -#ifndef QT_MAC_USE_COCOA - void initWindowPtr(); - void finishCreateWindow_sys_Carbon(OSWindowRef windowRef); -#else - void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef); - void syncCocoaMask(); - void finishCocoaMaskSetup(); -#endif - void determineWindowClass(); - void transferChildren(); -#endif void setWindowTitle_helper(const QString &cap); void setWindowFilePath_helper(const QString &filePath); @@ -456,59 +397,89 @@ public: QInputContext *inputContext() const; -#if defined(Q_WS_QWS) - void moveSurface(QWindowSurface *surface, const QPoint &offset); + void setModal_sys(); - QRegion localRequestedRegion() const; - QRegion localAllocatedRegion() const; + inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) + { + Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); + redirectDev = replacement; + redirectOffset = offset; + } - void blitToScreen(const QRegion &globalrgn); -#ifndef QT_NO_CURSOR - void updateCursor() const; -#endif + inline QPaintDevice *redirected(QPoint *offset) const + { + if (offset) + *offset = redirectDev ? redirectOffset : QPoint(); + return redirectDev; + } - QScreen* getScreen() const; + inline void restoreRedirected() + { redirectDev = 0; } - friend class QWSManager; - friend class QWSManagerPrivate; - friend class QDecoration; -#endif + inline void enforceNativeChildren() + { + if (!extra) + createExtra(); - static int instanceCounter; // Current number of widget instances - static int maxInstances; // Maximum number of widget instances + if (extra->nativeChildrenForced) + return; + extra->nativeChildrenForced = 1; -#ifdef QT_KEYPAD_NAVIGATION - static QPointer<QWidget> editingWidget; -#endif + for (int i = 0; i < children.size(); ++i) { + if (QWidget *child = qobject_cast<QWidget *>(children.at(i))) + child->setAttribute(Qt::WA_NativeWindow); + } + } - QWidgetData data; + inline bool nativeChildrenForced() const + { + return extra ? extra->nativeChildrenForced : false; + } + + QSize adjustedSize() const; + +#ifndef Q_WS_QWS // Almost cross-platform :-) + void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); + + inline QPoint mapToWS(const QPoint &p) const + { return p - data.wrect.topLeft(); } + + inline QPoint mapFromWS(const QPoint &p) const + { return p + data.wrect.topLeft(); } + + inline QRect mapToWS(const QRect &r) const + { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; } + + inline QRect mapFromWS(const QRect &r) const + { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } +#endif + // Variables. + // Regular pointers (keep them together to avoid gaps on 64 bit architectures). QWExtra *extra; QWidget *focus_next; QWidget *focus_prev; QWidget *focus_child; -#ifndef QT_NO_ACTION - QList<QAction*> actions; -#endif QLayout *layout; + QRegion *needsFlush; + QPaintDevice *redirectDev; QWidgetItemV2 *widgetItem; -#if !defined(QT_NO_IM) - QPointer<QInputContext> ic; -#endif + QPaintEngine *extraPaintEngine; + mutable const QMetaObject *polished; // All widgets are initially added into the uncreatedWidgets set. Once // they receive a window id they are removed and added to the mapper static QWidgetMapper *mapper; static QWidgetSet *uncreatedWidgets; +#if !defined(QT_NO_IM) + QPointer<QInputContext> ic; +#endif +#ifdef QT_KEYPAD_NAVIGATION + static QPointer<QWidget> editingWidget; +#endif - short leftmargin, topmargin, rightmargin, bottommargin; - - signed char leftLayoutItemMargin; - signed char topLayoutItemMargin; - signed char rightLayoutItemMargin; - signed char bottomLayoutItemMargin; - - // ### TODO: reorganize private/extra/topextra to save memory - QPointer<QWidget> compositeChildGrab; + // Implicit pointers (shared_null/shared_empty). + QRegion opaqueChildren; + QRegion dirty; #ifndef QT_NO_TOOLTIP QString toolTip; #endif @@ -518,14 +489,37 @@ public: #ifndef QT_NO_WHATSTHIS QString whatsThis; #endif - QString accessibleName, accessibleDescription; +#ifndef QT_NO_ACCESSIBILITY + QString accessibleName; + QString accessibleDescription; +#endif + // Other variables. + uint inheritedFontResolveMask; + uint inheritedPaletteResolveMask; + short leftmargin; + short topmargin; + short rightmargin; + short bottommargin; + signed char leftLayoutItemMargin; + signed char topLayoutItemMargin; + signed char rightLayoutItemMargin; + signed char bottomLayoutItemMargin; + static int instanceCounter; // Current number of widget instances + static int maxInstances; // Maximum number of widget instances + Qt::HANDLE hd; + QWidgetData data; + QSizePolicy size_policy; + QLocale locale; + QPoint redirectOffset; +#ifndef QT_NO_ACTION + QList<QAction*> actions; +#endif + + // Bit fields. + uint high_attributes[3]; // the low ones are in QWidget::widget_attributes QPalette::ColorRole fg_role : 8; QPalette::ColorRole bg_role : 8; - uint high_attributes[3]; // the low ones are in QWidget::widget_attributes - Qt::HANDLE hd; - QRegion dirty; - QRegion *needsFlush; uint dirtyOpaqueChildren : 1; uint isOpaque : 1; uint inDirtyList : 1; @@ -533,35 +527,33 @@ public: uint isMoved : 1; uint usesDoubleBufferedGLContext : 1; -#ifdef Q_WS_WIN - uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() -#endif - - uint inheritedFontResolveMask; - uint inheritedPaletteResolveMask; -#if defined(Q_WS_X11) + // *************************** Platform specific ************************************ +#if defined(Q_WS_X11) // <----------------------------------------------------------- X11 QX11Info xinfo; Qt::HANDLE picture; + static QWidget *mouseGrabber; + static QWidget *keyboardGrabber; + + void setWindowRole(); + void sendStartupMessage(const char *message) const; + void setNetWmWindowTypes(); + void x11UpdateIsOpaque(); + bool isBackgroundInherited() const; +#elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN + uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() + + bool shouldShowMaximizeButton(); + void winUpdateIsOpaque(); + void reparentChildren(); +#ifndef QT_NO_DRAGANDDROP + QOleDropTarget *registerOleDnd(QWidget *widget); + void unregisterOleDnd(QWidget *widget, QOleDropTarget *target); #endif -#if defined(Q_WS_MAC) - enum PaintChildrenOPs { - PC_None = 0x00, - PC_Now = 0x01, - PC_NoPaint = 0x04, - PC_Later = 0x10 - }; - EventHandlerRef window_event; - bool qt_mac_dnd_event(uint, DragRef); - void toggleDrawers(bool); - //mac event functions - static bool qt_create_root_win(); - static void qt_clean_root_win(); - static bool qt_recreate_root_win(); - static bool qt_mac_update_sizer(QWidget *, int up = 0); - static OSStatus qt_window_event(EventHandlerCallRef er, EventRef event, void *); - static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *); - static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool); - static bool qt_widget_shape(QWidget *, short, HIMutableShapeRef, bool); + void grabMouseWhileInWindow(); +#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC + // This is new stuff + uint needWindowChange : 1; + uint isGLWidget : 1; // Each wiget keeps a list of all its child and grandchild OpenGL widgets. // This list is used to update the gl context whenever a parent and a granparent @@ -574,95 +566,70 @@ public: QWidget * widget; QWidget * lastUpdateWidget; }; - QList<GlWidgetInfo> glWidgets; // dirtyOnWidget contains the areas in the widget that needs to be repained, // in the same way as dirtyOnScreen does for the window. Areas are added in // dirtyWidget_sys and cleared in the paint event. In scroll_sys we then use // this information repaint invalid areas when widgets are scrolled. QRegion dirtyOnWidget; + EventHandlerRef window_event; + QList<GlWidgetInfo> glWidgets; //these are here just for code compat (HIViews) Qt::HANDLE qd_hd; - // This is new stuff - uint needWindowChange : 1; - uint isGLWidget : 1; -#endif - -#if defined(Q_WS_X11) || defined (Q_WS_WIN) || defined(Q_WS_MAC) -#ifdef Q_WS_MAC - void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); + void macUpdateSizeAttribute(); + void macUpdateHideOnSuspend(); + void macUpdateOpaqueSizeGrip(); + void macUpdateIgnoreMouseEvents(); + void macUpdateMetalAttribute(); + void macUpdateIsOpaque(); + void setEnabled_helper_sys(bool enable); + bool isRealWindow() const; + void adjustWithinMaxAndMinSize(int &w, int &h); + void applyMaxAndMinSizeOnWindow(); + void update_sys(const QRect &rect); + void update_sys(const QRegion &rgn); + void setGeometry_sys_helper(int, int, int, int, bool); + void setWindowModified_sys(bool b); + void updateMaximizeButton_sys(); + void setWindowFilePath_sys(const QString &filePath); + void createWindow_sys(); + void recreateMacWindow(); +#ifndef QT_MAC_USE_COCOA + void initWindowPtr(); + void finishCreateWindow_sys_Carbon(OSWindowRef windowRef); #else - void setWSGeometry(bool dontShow=false); + void finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ windowRef); + void syncCocoaMask(); + void finishCocoaMaskSetup(); #endif + void determineWindowClass(); + void transferChildren(); + bool qt_mac_dnd_event(uint, DragRef); + void toggleDrawers(bool); + //mac event functions + static bool qt_create_root_win(); + static void qt_clean_root_win(); + static bool qt_mac_update_sizer(QWidget *, int up = 0); + static OSStatus qt_window_event(EventHandlerCallRef er, EventRef event, void *); + static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *); + static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool); +#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS + void setMaxWindowState_helper(); + void setFullScreenSize_helper(); + void moveSurface(QWindowSurface *surface, const QPoint &offset); + QRegion localRequestedRegion() const; + QRegion localAllocatedRegion() const; - inline QPoint mapToWS(const QPoint &p) const - { return p - data.wrect.topLeft(); } - - inline QPoint mapFromWS(const QPoint &p) const - { return p + data.wrect.topLeft(); } - - inline QRect mapToWS(const QRect &r) const - { QRect rr(r); rr.translate(-data.wrect.topLeft()); return rr; } - - inline QRect mapFromWS(const QRect &r) const - { QRect rr(r); rr.translate(data.wrect.topLeft()); return rr; } + friend class QWSManager; + friend class QWSManagerPrivate; + friend class QDecoration; +#ifndef QT_NO_CURSOR + void updateCursor() const; #endif - - QPaintEngine *extraPaintEngine; - - mutable const QMetaObject *polished; - - void setModal_sys(); - QSizePolicy size_policy; - QLocale locale; - -#ifdef Q_WS_X11 - static QWidget *mouseGrabber; - static QWidget *keyboardGrabber; + QScreen* getScreen() const; #endif - QPaintDevice *redirectDev; - QPoint redirectOffset; - - inline void setRedirected(QPaintDevice *replacement, const QPoint &offset) - { - Q_ASSERT(q_func()->testAttribute(Qt::WA_WState_InPaintEvent)); - redirectDev = replacement; - redirectOffset = offset; - } - - inline QPaintDevice *redirected(QPoint *offset) const - { - if (offset) - *offset = redirectDev ? redirectOffset : QPoint(); - return redirectDev; - } - - inline void restoreRedirected() - { redirectDev = 0; } - - inline void enforceNativeChildren() - { - if (!extra) - createExtra(); - - if (extra->nativeChildrenForced) - return; - extra->nativeChildrenForced = 1; - - for (int i = 0; i < children.size(); ++i) { - if (QWidget *child = qobject_cast<QWidget *>(children.at(i))) - child->setAttribute(Qt::WA_NativeWindow); - } - } - - inline bool nativeChildrenForced() const - { - return extra ? extra->nativeChildrenForced : false; - } - - QSize adjustedSize() const; }; inline QWExtra *QWidgetPrivate::extraData() const diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp index 1445f57..94bdb85 100644 --- a/src/gui/kernel/qwidget_qws.cpp +++ b/src/gui/kernel/qwidget_qws.cpp @@ -565,20 +565,6 @@ void QWidget::activateWindow() } } -/* - Should we require that q is a toplevel window ??? - - Used by QWSManager - */ -void QWidgetPrivate::blitToScreen(const QRegion &globalrgn) -{ - Q_Q(QWidget); - QWidget *win = q->window(); - QBrush bgBrush = win->palette().brush(win->backgroundRole()); - bool opaque = bgBrush.style() == Qt::NoBrush || bgBrush.isOpaque(); - QWidget::qwsDisplay()->repaintRegion(win->data->winid, win->windowFlags(), opaque, globalrgn); -} - void QWidgetPrivate::show_sys() { Q_Q(QWidget); @@ -1037,6 +1023,9 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { +#ifndef QT_NO_QWS_MANAGER + extra->topextra->qwsManager = 0; +#endif } void QWidgetPrivate::deleteTLSysExtra() diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index cfdabaf..0f341fd 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -1025,13 +1025,13 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowFullScreen) { if (d->topData()->normalGeometry.width() < 0 && !(oldstate & Qt::WindowMaximized)) d->topData()->normalGeometry = geometry(); - d->topData()->savedFlags = GetWindowLongA(internalWinId(), GWL_STYLE); + d->topData()->savedFlags = Qt::WindowFlags(GetWindowLongA(internalWinId(), GWL_STYLE)); #ifndef Q_FLATTEN_EXPOSE UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; #else UINT style = WS_POPUP; #endif - if (d->topData()->savedFlags & WS_SYSMENU) + if (ulong(d->topData()->savedFlags) & WS_SYSMENU) style |= WS_SYSMENU; if (isVisible()) style |= WS_VISIBLE; @@ -1234,7 +1234,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w) (In all comments below: s/X/Windows/g) */ -void QWidgetPrivate::setWSGeometry(bool dontShow) +void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &) { Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); @@ -1704,7 +1704,6 @@ int QWidget::metric(PaintDeviceMetric m) const return val; } -#ifndef Q_WS_WINCE void QWidgetPrivate::createSysExtra() { #ifndef QT_NO_DRAGANDDROP @@ -1712,6 +1711,7 @@ void QWidgetPrivate::createSysExtra() #endif } +#ifndef Q_WS_WINCE void QWidgetPrivate::deleteSysExtra() { } @@ -1719,8 +1719,9 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { - extra->topextra->winIconSmall = 0; + extra->topextra->savedFlags = 0; extra->topextra->winIconBig = 0; + extra->topextra->winIconSmall = 0; } void QWidgetPrivate::deleteTLSysExtra() diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index cca928e..435fd31 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -535,7 +535,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowFullScreen) { if (d->topData()->normalGeometry.width() < 0 && !(oldstate & Qt::WindowMaximized)) d->topData()->normalGeometry = geometry(); - d->topData()->savedFlags = GetWindowLongA(internalWinId(), GWL_STYLE); + d->topData()->savedFlags = (Qt::WindowFlags) GetWindowLongA(internalWinId(), GWL_STYLE); UINT style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; if (isVisible()) style |= WS_VISIBLE; @@ -598,13 +598,6 @@ void QWidget::setWindowState(Qt::WindowStates newstate) QApplication::sendEvent(this, &e); } - -void QWidgetPrivate::createSysExtra() { -#ifndef QT_NO_DRAGANDDROP - extra->dropTarget = 0; -#endif -} - void QWidgetPrivate::deleteSysExtra() { Q_Q(QWidget); diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 76734d4..b35740a 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -906,6 +906,44 @@ void QWidgetPrivate::x11UpdateIsOpaque() #endif } +/* + Returns true if the background is inherited; otherwise returns + false. + + Mainly used in the paintOnScreen case. +*/ +bool QWidgetPrivate::isBackgroundInherited() const +{ + Q_Q(const QWidget); + + // windows do not inherit their background + if (q->isWindow() || q->windowType() == Qt::SubWindow) + return false; + + if (q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_OpaquePaintEvent)) + return false; + + const QPalette &pal = q->palette(); + QPalette::ColorRole bg = q->backgroundRole(); + QBrush brush = pal.brush(bg); + + // non opaque brushes leaves us no choice, we must inherit + if (!q->autoFillBackground() || !brush.isOpaque()) + return true; + + if (brush.style() == Qt::SolidPattern) { + // the background is just a solid color. If there is no + // propagated contents, then we claim as performance + // optimization that it was not inheritet. This is the normal + // case in standard Windows or Motif style. + const QWidget *w = q->parentWidget(); + if (!w->d_func()->isBackgroundInherited()) + return false; + } + + return true; +} + void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); @@ -2152,7 +2190,7 @@ static void do_size_hints(QWidget* widget, QWExtra *x) parentWRect is the geometry of the parent's X rect, measured in parent's coord sys */ -void QWidgetPrivate::setWSGeometry(bool dontShow) +void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &) { Q_Q(QWidget); Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); @@ -2610,8 +2648,8 @@ int QWidget::metric(PaintDeviceMetric m) const void QWidgetPrivate::createSysExtra() { - extra->xDndProxy = 0; extra->compress_events = true; + extra->xDndProxy = 0; } void QWidgetPrivate::deleteSysExtra() @@ -2620,8 +2658,11 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { + extra->topextra->spont_unmapped = 0; + extra->topextra->dnd = 0; extra->topextra->validWMState = 0; extra->topextra->waitingForMapNotify = 0; + extra->topextra->parentWinId = 0; extra->topextra->userTimeWindow = 0; } @@ -2747,12 +2788,6 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal opacity) 32, PropModeReplace, (uchar*)&value, 1); } -/*! - Returns information about the configuration of the X display used to display - the widget. - - \warning This function is only available on X11. -*/ const QX11Info &QWidget::x11Info() const { Q_D(const QWidget); @@ -2789,13 +2824,6 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() return new QX11WindowSurface(q_func()); } -/*! - Returns the X11 Picture handle of the widget for XRender - support. Use of this function is not portable. This function will - return 0 if XRender support is not compiled into Qt, if the - XRender extension is not supported on the X11 display, or if the - handle could not be created. -*/ Qt::HANDLE QWidget::x11PictureHandle() const { #ifndef QT_NO_XRENDER diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 6329135..ae93efe 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -1297,9 +1297,6 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event) // focus is set to our focus proxy. We want to intercept all // keypresses. if (o == window() && d->client) { - if (!d->isEmbedded() && d->activeContainer == this) - d->moveInputToProxy(); - if (d->clientIsXEmbed) { sendXEmbedMessage(d->client, x11Info().display(), XEMBED_WINDOW_ACTIVATE); } else { @@ -1307,6 +1304,8 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event) if (hasFocus()) XSetInputFocus(x11Info().display(), d->client, XRevertToParent, x11Time()); } + if (!d->isEmbedded()) + d->moveInputToProxy(); } break; case QEvent::WindowDeactivate: @@ -1729,10 +1728,10 @@ void QX11EmbedContainerPrivate::acceptClient(WId window) checkGrab(); if (q->hasFocus()) { XSetInputFocus(q->x11Info().display(), client, XRevertToParent, x11Time()); - } else { - if (!isEmbedded()) - moveInputToProxy(); } + } else { + if (!isEmbedded()) + moveInputToProxy(); } emit q->clientIsEmbedded(); @@ -1749,11 +1748,9 @@ void QX11EmbedContainerPrivate::acceptClient(WId window) void QX11EmbedContainerPrivate::moveInputToProxy() { Q_Q(QX11EmbedContainer); - WId focus; - int revert_to; - XGetInputFocus(q->x11Info().display(), &focus, &revert_to); - if (focus != focusProxy->internalWinId()) - XSetInputFocus(q->x11Info().display(), focusProxy->internalWinId(), XRevertToParent, x11Time()); + // Following Owen Taylor's advice from the XEmbed specification to + // always use CurrentTime when no explicit user action is involved. + XSetInputFocus(q->x11Info().display(), focusProxy->internalWinId(), XRevertToParent, CurrentTime); } /*! \internal diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 341331b..0a3a8dd 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -491,8 +491,9 @@ static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately) if (!widget) return; -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately) { +#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE) + if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately + && !widget->testAttribute(Qt::WA_DontShowOnScreen)) { // Tell Windows to send us a paint event if we're in WM_SIZE/WM_MOVE; posted events // are blocked until the mouse button is released. See task 146849. const QRegion rgn(qt_dirtyRegion(widget)); diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 16dd617..8f4a2bf 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -44,8 +44,6 @@ QT_BEGIN_NAMESPACE -static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; - struct SourceOnlyAlpha { inline uchar alpha(uchar src) const { return src; } @@ -140,14 +138,11 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha { template <typename SRC, typename T> void qt_scale_image_16bit(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, - const QRectF &target, + const QRectF &targetRect, const QRectF &srcRect, const QRect &clip, T blender) { - const QRectF targetRect = target.translated(aliasedCoordinateDelta, - aliasedCoordinateDelta); - qreal sx = targetRect.width() / (qreal) srcRect.width(); qreal sy = targetRect.height() / (qreal) srcRect.height(); @@ -617,14 +612,11 @@ struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha { template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, - const QRectF &target, + const QRectF &targetRect, const QRectF &srcRect, const QRect &clip, T blender) { - const QRectF targetRect = target.translated(aliasedCoordinateDelta, - aliasedCoordinateDelta); - qreal sx = targetRect.width() / (qreal) srcRect.width(); qreal sy = targetRect.height() / (qreal) srcRect.height(); diff --git a/src/gui/painting/qcolormap_win.cpp b/src/gui/painting/qcolormap_win.cpp index 0606f64..9ca2521 100644 --- a/src/gui/painting/qcolormap_win.cpp +++ b/src/gui/painting/qcolormap_win.cpp @@ -138,7 +138,11 @@ void QColormap::cleanup() } QColormap QColormap::instance(int) -{ return QColormap(); } +{ + Q_ASSERT_X(screenMap, "QColormap", + "A QApplication object needs to be constructed before QColormap is used."); + return QColormap(); +} QColormap::QColormap() : d(screenMap) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ec4737c..fdd0c21 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2106,8 +2106,7 @@ static inline int color_burn_op(int dst, int src, int da, int sa) if (src == 0 || src_da + dst_sa <= sa_da) return qt_div_255(temp); - else - return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); + return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); } template <typename T> diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index 3397c45..175f1ab 100644 --- a/src/gui/painting/qemulationpaintengine.cpp +++ b/src/gui/painting/qemulationpaintengine.cpp @@ -123,14 +123,30 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen) real_engine->stroke(path, bgPen); } - QBrush brush = pen.brush(); + QPen copy = pen; Qt::BrushStyle style = qbrush_style(brush); if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { const QGradient *g = brush.gradient(); + if (g->coordinateMode() > QGradient::LogicalMode) { - QPaintEngineEx::stroke(path, pen); - return; + if (g->coordinateMode() == QGradient::StretchToDeviceMode) { + QTransform mat = brush.transform(); + mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height()); + brush.setTransform(mat); + copy.setBrush(brush); + real_engine->stroke(path, copy); + return; + } else if (g->coordinateMode() == QGradient::ObjectBoundingMode) { + QTransform mat = brush.transform(); + QRealRect r = path.controlPointRect(); + mat.translate(r.x1, r.y1); + mat.scale(r.x2 - r.x1, r.y2 - r.y1); + brush.setTransform(mat); + copy.setBrush(brush); + real_engine->stroke(path, copy); + return; + } } } diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 4058143..471f544 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -528,6 +528,26 @@ void qt_memrotate270(const srctype *src, int w, int h, int sstride, \ qt_memrotate270_template(src, w, h, sstride, dest, dstride); \ } +#define QT_IMPL_SIMPLE_MEMROTATE(srctype, desttype) \ +void qt_memrotate90(const srctype *src, int w, int h, int sstride, \ + desttype *dest, int dstride) \ +{ \ + qt_memrotate90_tiled_unpacked<desttype,srctype>(src, w, h, sstride, dest, dstride); \ +} \ +void qt_memrotate180(const srctype *src, int w, int h, int sstride, \ + desttype *dest, int dstride) \ +{ \ + qt_memrotate180_template(src, w, h, sstride, dest, dstride); \ +} \ +void qt_memrotate270(const srctype *src, int w, int h, int sstride, \ + desttype *dest, int dstride) \ +{ \ + qt_memrotate270_tiled_unpacked<desttype,srctype>(src, w, h, sstride, dest, dstride); \ +} + + + + QT_IMPL_MEMROTATE(quint32, quint32) QT_IMPL_MEMROTATE(quint32, quint16) QT_IMPL_MEMROTATE(quint16, quint32) @@ -539,6 +559,14 @@ QT_IMPL_MEMROTATE(quint32, quint8) QT_IMPL_MEMROTATE(quint16, quint8) QT_IMPL_MEMROTATE(qrgb444, quint8) QT_IMPL_MEMROTATE(quint8, quint8) + +#if defined(QT_QWS_ROTATE_BGR) +QT_IMPL_SIMPLE_MEMROTATE(quint16, qbgr565) +QT_IMPL_SIMPLE_MEMROTATE(quint32, qbgr565) +QT_IMPL_SIMPLE_MEMROTATE(qrgb555, qbgr555) +QT_IMPL_SIMPLE_MEMROTATE(quint32, qbgr555) +#endif + #ifdef QT_QWS_DEPTH_GENERIC QT_IMPL_MEMROTATE(quint32, qrgb_generic16) QT_IMPL_MEMROTATE(quint16, qrgb_generic16) diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h index c1eb93e..87cfb1a 100644 --- a/src/gui/painting/qmemrotate_p.h +++ b/src/gui/painting/qmemrotate_p.h @@ -92,6 +92,14 @@ QT_DECL_MEMROTATE(quint32, quint8); QT_DECL_MEMROTATE(quint16, quint8); QT_DECL_MEMROTATE(qrgb444, quint8); QT_DECL_MEMROTATE(quint8, quint8); + +#ifdef QT_QWS_ROTATE_BGR +QT_DECL_MEMROTATE(quint16, qbgr565); +QT_DECL_MEMROTATE(quint32, qbgr565); +QT_DECL_MEMROTATE(qrgb555, qbgr555); +QT_DECL_MEMROTATE(quint32, qbgr555); +#endif + #ifdef QT_QWS_DEPTH_GENERIC QT_DECL_MEMROTATE(quint32, qrgb_generic16); QT_DECL_MEMROTATE(quint16, qrgb_generic16); diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/src/gui/painting/qpaintdevice_qws.cpp index 6a68d28..c67be86 100644 --- a/src/gui/painting/qpaintdevice_qws.cpp +++ b/src/gui/painting/qpaintdevice_qws.cpp @@ -81,9 +81,6 @@ int QPaintDevice::metric(PaintDeviceMetric m) const } } -/*! - \internal -*/ QWSDisplay *QPaintDevice::qwsDisplay() { return qt_fbdpy; diff --git a/src/gui/painting/qpaintdevice_win.cpp b/src/gui/painting/qpaintdevice_win.cpp index 6cae744..7cd3392 100644 --- a/src/gui/painting/qpaintdevice_win.cpp +++ b/src/gui/painting/qpaintdevice_win.cpp @@ -71,16 +71,11 @@ int QPaintDevice::metric(PaintDeviceMetric) const return 0; } - -/*! \internal -*/ HDC QPaintDevice::getDC() const { return 0; } -/*! \internal -*/ void QPaintDevice::releaseDC(HDC) const { } diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp index 4ea9f57..95cb115 100644 --- a/src/gui/painting/qpaintdevice_x11.cpp +++ b/src/gui/painting/qpaintdevice_x11.cpp @@ -106,33 +106,11 @@ int QPaintDevice::metric(PaintDeviceMetric) const #ifdef QT3_SUPPORT -/*! - Use QX11Info::display() instead. - - \oldcode - Display *display = widget->x11Display(); - \newcode - Display *display = QX11Info::display(); - \endcode - - \sa QWidget::x11Info(), QX11Info::display() -*/ Display *QPaintDevice::x11Display() const { return X11->display; } -/*! - Use QX11Info::screen() instead. - - \oldcode - int screen = widget->x11Screen(); - \newcode - int screen = widget->x11Info().screen(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11Screen() const { const QX11Info *info = qt_x11Info(this); @@ -141,17 +119,6 @@ int QPaintDevice::x11Screen() const return QX11Info::appScreen(); } -/*! - Use QX11Info::visual() instead. - - \oldcode - void *visual = widget->x11Visual(); - \newcode - void *visual = widget->x11Info().visual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ void *QPaintDevice::x11Visual() const { const QX11Info *info = qt_x11Info(this); @@ -160,17 +127,6 @@ void *QPaintDevice::x11Visual() const return QX11Info::appVisual(); } -/*! - Use QX11Info::depth() instead. - - \oldcode - int depth = widget->x11Depth(); - \newcode - int depth = widget->x11Info().depth(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11Depth() const { const QX11Info *info = qt_x11Info(this); @@ -179,17 +135,6 @@ int QPaintDevice::x11Depth() const return QX11Info::appDepth(); } -/*! - Use QX11Info::cells() instead. - - \oldcode - int cells = widget->x11Cells(); - \newcode - int cells = widget->x11Info().cells(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11Cells() const { const QX11Info *info = qt_x11Info(this); @@ -198,17 +143,6 @@ int QPaintDevice::x11Cells() const return QX11Info::appCells(); } -/*! - Use QX11Info::colormap() instead. - - \oldcode - unsigned long screen = widget->x11Colormap(); - \newcode - unsigned long screen = widget->x11Info().colormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Qt::HANDLE QPaintDevice::x11Colormap() const { const QX11Info *info = qt_x11Info(this); @@ -217,17 +151,6 @@ Qt::HANDLE QPaintDevice::x11Colormap() const return QX11Info::appColormap(); } -/*! - Use QX11Info::defaultColormap() instead. - - \oldcode - bool isDefault = widget->x11DefaultColormap(); - \newcode - bool isDefault = widget->x11Info().defaultColormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11DefaultColormap() const { const QX11Info *info = qt_x11Info(this); @@ -236,17 +159,6 @@ bool QPaintDevice::x11DefaultColormap() const return QX11Info::appDefaultColormap(); } -/*! - Use QX11Info::defaultVisual() instead. - - \oldcode - bool isDefault = widget->x11DefaultVisual(); - \newcode - bool isDefault = widget->x11Info().defaultVisual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11DefaultVisual() const { const QX11Info *info = qt_x11Info(this); @@ -255,176 +167,48 @@ bool QPaintDevice::x11DefaultVisual() const return QX11Info::appDefaultVisual(); } -/*! - Use QX11Info::visual() instead. - - \oldcode - void *visual = QPaintDevice::x11AppVisual(screen); - \newcode - void *visual = qApp->x11Info(screen).visual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ void *QPaintDevice::x11AppVisual(int screen) { return QX11Info::appVisual(screen); } -/*! - Use QX11Info::colormap() instead. - - \oldcode - unsigned long colormap = QPaintDevice::x11AppColormap(screen); - \newcode - unsigned long colormap = qApp->x11Info(screen).colormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Qt::HANDLE QPaintDevice::x11AppColormap(int screen) { return QX11Info::appColormap(screen); } -/*! - Use QX11Info::display() instead. - - \oldcode - Display *display = QPaintDevice::x11AppDisplay(); - \newcode - Display *display = qApp->x11Info().display(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Display *QPaintDevice::x11AppDisplay() { return QX11Info::display(); } -/*! - Use QX11Info::screen() instead. - - \oldcode - int screen = QPaintDevice::x11AppScreen(); - \newcode - int screen = qApp->x11Info().screen(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppScreen() { return QX11Info::appScreen(); } -/*! - Use QX11Info::depth() instead. - - \oldcode - int depth = QPaintDevice::x11AppDepth(screen); - \newcode - int depth = qApp->x11Info(screen).depth(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppDepth(int screen) { return QX11Info::appDepth(screen); } -/*! - Use QX11Info::cells() instead. - - \oldcode - int cells = QPaintDevice::x11AppCells(screen); - \newcode - int cells = qApp->x11Info(screen).cells(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppCells(int screen) { return QX11Info::appCells(screen); } -/*! - Use QX11Info::appRootWindow() instead. - - \oldcode - unsigned long window = QPaintDevice::x11AppRootWindow(screen); - \newcode - unsigned long window = qApp->x11Info(screen).appRootWindow(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen) { return QX11Info::appRootWindow(screen); } -/*! - Use QX11Info::defaultColormap() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDefaultColormap(screen); - \newcode - bool isDefault = qApp->x11Info(screen).defaultColormap(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11AppDefaultColormap(int screen) { return QX11Info::appDefaultColormap(screen); } -/*! - Use QX11Info::defaultVisual() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDefaultVisual(screen); - \newcode - bool isDefault = qApp->x11Info(screen).defaultVisual(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ bool QPaintDevice::x11AppDefaultVisual(int screen) { return QX11Info::appDefaultVisual(screen); } -/*! - Use QX11Info::setAppDpiX() instead. -*/ void QPaintDevice::x11SetAppDpiX(int dpi, int screen) { QX11Info::setAppDpiX(dpi, screen); } -/*! - Use QX11Info::setAppDpiY() instead. -*/ void QPaintDevice::x11SetAppDpiY(int dpi, int screen) { QX11Info::setAppDpiY(dpi, screen); } - -/*! - Use QX11Info::appDpiX() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDpiX(screen); - \newcode - bool isDefault = qApp->x11Info(screen).appDpiX(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppDpiX(int screen) { return QX11Info::appDpiX(screen); } -/*! - Use QX11Info::appDpiY() instead. - - \oldcode - bool isDefault = QPaintDevice::x11AppDpiY(screen); - \newcode - bool isDefault = qApp->x11Info(screen).appDpiY(); - \endcode - - \sa QWidget::x11Info(), QPixmap::x11Info() -*/ int QPaintDevice::x11AppDpiY(int screen) { return QX11Info::appDpiY(screen); diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index 0644a02..5889388 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -996,15 +996,14 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co } else if (differentSize) { #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - CGImageRef img = (CGImageRef)pm.macCGHandle(); + QCFType<CGImageRef> img = pm.toMacCGImageRef(); image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height()))); - CGImageRelease(img); } else #endif { const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height()); const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm.data); - quint32 *pantherData = pmData->pixels + (sy * pm.width() + sx); + quint32 *pantherData = pmData->pixels + sy * (pmData->bytesPerRow / 4) + sx; QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, pantherData, sw*sh*pmData->bytesPerRow, 0); image = CGImageCreate(sw, sh, 8, 32, pmData->bytesPerRow, macGenericColorSpace(), diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a2ce62e..87e9283 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1023,7 +1023,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, int alpha, const QRect &sr) { - if (!clip.isValid()) + if (alpha == 0 || !clip.isValid()) return; if (alpha ==0) @@ -2614,7 +2614,12 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe QRasterPaintEngineState *s = state(); const bool aa = s->flags.antialiased || s->flags.bilinear; if (!aa && sr.size() == QSize(1, 1)) { + // as fillRect will apply the aliased coordinate delta we need to + // subtract it here as we don't use it for image drawing + QTransform old = s->matrix; + s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y()))); + s->matrix = old; return; } @@ -2648,6 +2653,18 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe return; d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); + if (!aa && s->matrix.type() == QTransform::TxScale) { + QRectF rr = s->matrix.mapRect(r); + + const int x1 = qRound(rr.x()); + const int y1 = qRound(rr.y()); + const int x2 = qRound(rr.right()); + const int y2 = qRound(rr.bottom()); + + fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); + return; + } + #ifdef QT_FAST_SPANS ensureState(); if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) { @@ -2705,7 +2722,13 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe QRectF rr = r; rr.translate(s->matrix.dx(), s->matrix.dy()); - fillRect_normalized(toRect_normalized(rr), &d->image_filler, d); + + const int x1 = qRound(rr.x()); + const int y1 = qRound(rr.y()); + const int x2 = qRound(rr.right()); + const int y2 = qRound(rr.bottom()); + + fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler, d); } } @@ -5188,7 +5211,11 @@ void QSpanData::adjustSpanMethods() void QSpanData::setupMatrix(const QTransform &matrix, int bilin) { - QTransform inv = matrix.inverted(); + QTransform delta; + // make sure we round off correctly in qdrawhelper.cpp + delta.translate(1.0 / 65536, 1.0 / 65536); + + QTransform inv = (delta * matrix).inverted(); m11 = inv.m11(); m12 = inv.m12(); m13 = inv.m13(); diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 4b2fbca..9cc9683 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -1543,6 +1543,8 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p QX11PaintEnginePrivate::GCMode gcMode, QPaintEngine::PolygonDrawMode mode) { + Q_Q(QX11PaintEngine); + int clippedCount = 0; qt_float_point *clippedPoints = 0; @@ -1617,7 +1619,29 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p } else #endif if (fill.style() != Qt::NoBrush) { - if (clippedCount > 0) { + if (clippedCount > 200000) { + QPolygon poly; + for (int i = 0; i < clippedCount; ++i) + poly << QPoint(qFloor(clippedPoints[i].x), qFloor(clippedPoints[i].y)); + + const QRect bounds = poly.boundingRect(); + const QRect aligned = bounds + & QRect(QPoint(), QSize(pdev->width(), pdev->height())); + + QImage img(aligned.size(), QImage::Format_ARGB32_Premultiplied); + img.fill(0); + + QPainter painter(&img); + painter.translate(-aligned.x(), -aligned.y()); + painter.setPen(Qt::NoPen); + painter.setBrush(fill); + if (gcMode == BrushGC) + painter.setBrushOrigin(q->painter()->brushOrigin()); + painter.drawPolygon(poly); + painter.end(); + + q->drawImage(aligned, img, img.rect(), Qt::AutoColor); + } else if (clippedCount > 0) { QVarLengthArray<XPoint> xpoints(clippedCount); for (int i = 0; i < clippedCount; ++i) { xpoints[i].x = qFloor(clippedPoints[i].x); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b158392..4744f14 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5142,6 +5142,11 @@ void QPainter::drawConvexPolygon(const QPointF *points, int pointCount) d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); } +static inline QPointF roundInDeviceCoordinates(const QPointF &p, const QTransform &m) +{ + return m.inverted().map(QPointF(m.map(p).toPoint())); +} + /*! \fn void QPainter::drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source) @@ -5210,11 +5215,12 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) { save(); - // If there is no scaling or transformation involved we have to make sure we use the + // If there is no rotation involved we have to make sure we use the // antialiased and not the aliased coordinate system by rounding the coordinates. - if (d->state->matrix.type() <= QTransform::TxTranslate) { - x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx(); - y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy(); + if (d->state->matrix.type() <= QTransform::TxScale) { + const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); + x = p.x(); + y = p.y(); } translate(x, y); setBackgroundMode(Qt::TransparentMode); @@ -5324,16 +5330,21 @@ void QPainter::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) || ((sw != w || sh != h) && !d->engine->hasFeature(QPaintEngine::PixmapTransform))) { save(); - // If there is no scaling or transformation involved we have to make sure we use the + // If there is no rotation involved we have to make sure we use the // antialiased and not the aliased coordinate system by rounding the coordinates. + if (d->state->matrix.type() <= QTransform::TxScale) { + const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); + x = p.x(); + y = p.y(); + } + if (d->state->matrix.type() <= QTransform::TxTranslate && sw == w && sh == h) { - x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx(); - y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy(); sx = qRound(sx); sy = qRound(sy); sw = qRound(sw); sh = qRound(sh); } + translate(x, y); scale(w / sw, h / sh); setBackgroundMode(Qt::TransparentMode); @@ -5483,11 +5494,12 @@ void QPainter::drawImage(const QPointF &p, const QImage &image) || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) { save(); - // If there is no scaling or transformation involved we have to make sure we use the + // If there is no rotation involved we have to make sure we use the // antialiased and not the aliased coordinate system by rounding the coordinates. - if (d->state->matrix.type() <= QTransform::TxTranslate) { - x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx(); - y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy(); + if (d->state->matrix.type() <= QTransform::TxScale) { + const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); + x = p.x(); + y = p.y(); } translate(x, y); setBackgroundMode(Qt::TransparentMode); @@ -5586,11 +5598,15 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR || (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity))) { save(); - // If there is no scaling or transformation involved we have to make sure we use the + // If there is no rotation involved we have to make sure we use the // antialiased and not the aliased coordinate system by rounding the coordinates. + if (d->state->matrix.type() <= QTransform::TxScale) { + const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); + x = p.x(); + y = p.y(); + } + if (d->state->matrix.type() <= QTransform::TxTranslate && sw == w && sh == h) { - x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx(); - y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy(); sx = qRound(sx); sy = qRound(sy); sw = qRound(sw); @@ -6333,17 +6349,18 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo setBrush(QBrush(d->state->pen.color(), pixmap)); setPen(Qt::NoPen); - // If there is no scaling or transformation involved we have to make sure we use the + // If there is no rotation involved we have to make sure we use the // antialiased and not the aliased coordinate system by rounding the coordinates. - if (d->state->matrix.type() <= QTransform::TxTranslate) { - qreal x = qRound(r.x() + d->state->matrix.dx()) - d->state->matrix.dx(); - qreal y = qRound(r.y() + d->state->matrix.dy()) - d->state->matrix.dy(); - qreal w = qRound(r.width()); - qreal h = qRound(r.height()); - sx = qRound(sx); - sy = qRound(sy); + if (d->state->matrix.type() <= QTransform::TxScale) { + const QPointF p = roundInDeviceCoordinates(r.topLeft(), d->state->matrix); + + if (d->state->matrix.type() <= QTransform::TxTranslate) { + sx = qRound(sx); + sy = qRound(sy); + } + setBrushOrigin(QPointF(r.x()-sx, r.y()-sy)); - drawRect(QRectF(x, y, w, h)); + drawRect(QRectF(p, r.size())); } else { setBrushOrigin(QPointF(r.x()-sx, r.y()-sy)); drawRect(r); @@ -7142,14 +7159,14 @@ QPoint QPainter::xFormDev(const QPoint &p) const \fn QRect QPainter::xFormDev(const QRect &rectangle) const \overload - Use combineMatrix() combined with QMatrix::inverted() instead. + Use mapRect() combined with QMatrix::inverted() instead. \oldcode QPainter painter(this); QRect transformed = painter.xFormDev(rectangle); \newcode QPainter painter(this); - QRect transformed = rectangle * painter.combinedMatrix().inverted(); + QRect transformed = painter.combinedMatrix().inverted(rectangle); \endcode */ @@ -8554,4 +8571,252 @@ void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivat p->draw_helper(path, operation); } +/*! \fn Display *QPaintDevice::x11Display() const + Use QX11Info::display() instead. + + \oldcode + Display *display = widget->x11Display(); + \newcode + Display *display = QX11Info::display(); + \endcode + + \sa QWidget::x11Info(), QX11Info::display() +*/ + +/*! \fn int QPaintDevice::x11Screen() const + Use QX11Info::screen() instead. + + \oldcode + int screen = widget->x11Screen(); + \newcode + int screen = widget->x11Info().screen(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn void *QPaintDevice::x11Visual() const + Use QX11Info::visual() instead. + + \oldcode + void *visual = widget->x11Visual(); + \newcode + void *visual = widget->x11Info().visual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11Depth() const + Use QX11Info::depth() instead. + + \oldcode + int depth = widget->x11Depth(); + \newcode + int depth = widget->x11Info().depth(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11Cells() const + Use QX11Info::cells() instead. + + \oldcode + int cells = widget->x11Cells(); + \newcode + int cells = widget->x11Info().cells(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Qt::HANDLE QPaintDevice::x11Colormap() const + Use QX11Info::colormap() instead. + + \oldcode + unsigned long screen = widget->x11Colormap(); + \newcode + unsigned long screen = widget->x11Info().colormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11DefaultColormap() const + Use QX11Info::defaultColormap() instead. + + \oldcode + bool isDefault = widget->x11DefaultColormap(); + \newcode + bool isDefault = widget->x11Info().defaultColormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11DefaultVisual() const + Use QX11Info::defaultVisual() instead. + + \oldcode + bool isDefault = widget->x11DefaultVisual(); + \newcode + bool isDefault = widget->x11Info().defaultVisual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn void *QPaintDevice::x11AppVisual(int screen) + Use QX11Info::visual() instead. + + \oldcode + void *visual = QPaintDevice::x11AppVisual(screen); + \newcode + void *visual = qApp->x11Info(screen).visual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Qt::HANDLE QPaintDevice::x11AppColormap(int screen) + Use QX11Info::colormap() instead. + + \oldcode + unsigned long colormap = QPaintDevice::x11AppColormap(screen); + \newcode + unsigned long colormap = qApp->x11Info(screen).colormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Display *QPaintDevice::x11AppDisplay() + Use QX11Info::display() instead. + + \oldcode + Display *display = QPaintDevice::x11AppDisplay(); + \newcode + Display *display = qApp->x11Info().display(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppScreen() + Use QX11Info::screen() instead. + + \oldcode + int screen = QPaintDevice::x11AppScreen(); + \newcode + int screen = qApp->x11Info().screen(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppDepth(int screen) + Use QX11Info::depth() instead. + + \oldcode + int depth = QPaintDevice::x11AppDepth(screen); + \newcode + int depth = qApp->x11Info(screen).depth(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppCells(int screen) + Use QX11Info::cells() instead. + + \oldcode + int cells = QPaintDevice::x11AppCells(screen); + \newcode + int cells = qApp->x11Info(screen).cells(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen) + Use QX11Info::appRootWindow() instead. + + \oldcode + unsigned long window = QPaintDevice::x11AppRootWindow(screen); + \newcode + unsigned long window = qApp->x11Info(screen).appRootWindow(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11AppDefaultColormap(int screen) + Use QX11Info::defaultColormap() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDefaultColormap(screen); + \newcode + bool isDefault = qApp->x11Info(screen).defaultColormap(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn bool QPaintDevice::x11AppDefaultVisual(int screen) + Use QX11Info::defaultVisual() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDefaultVisual(screen); + \newcode + bool isDefault = qApp->x11Info(screen).defaultVisual(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn void QPaintDevice::x11SetAppDpiX(int dpi, int screen) + Use QX11Info::setAppDpiX() instead. +*/ + +/*! \fn void QPaintDevice::x11SetAppDpiY(int dpi, int screen) + Use QX11Info::setAppDpiY() instead. +*/ + +/*! \fn int QPaintDevice::x11AppDpiX(int screen) + Use QX11Info::appDpiX() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDpiX(screen); + \newcode + bool isDefault = qApp->x11Info(screen).appDpiX(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn int QPaintDevice::x11AppDpiY(int screen) + Use QX11Info::appDpiY() instead. + + \oldcode + bool isDefault = QPaintDevice::x11AppDpiY(screen); + \newcode + bool isDefault = qApp->x11Info(screen).appDpiY(); + \endcode + + \sa QWidget::x11Info(), QPixmap::x11Info() +*/ + +/*! \fn HDC QPaintDevice::getDC() const + \internal +*/ + +/*! \fn void QPaintDevice::releaseDC(HDC) const + \internal +*/ + +/*! \fn QWSDisplay *QPaintDevice::qwsDisplay() + \internal +*/ + QT_END_NAMESPACE diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 29c48df..6fb439d 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -124,7 +124,7 @@ private: Q_DISABLE_COPY(QVectorPathConverter) }; -class Q_GUI_EXPORT QPainterPathData : public QPainterPathPrivate +class QPainterPathData : public QPainterPathPrivate { public: QPainterPathData() : diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 5161e32..154d90c 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -284,8 +284,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke to send PostScript or PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default. - - Note that setting parameters like paper size and resolution on an + + Note that setting parameters like paper size and resolution on an invalid printer is undefined. You can use QPrinter::isValid() to verify this before changing any parameters. @@ -744,7 +744,7 @@ void QPrinter::setOutputFormat(OutputFormat format) #ifndef QT_NO_PDF Q_D(QPrinter); - if (d->outputFormat == format) + if (d->validPrinter && d->outputFormat == format) return; d->outputFormat = format; @@ -773,8 +773,8 @@ void QPrinter::setOutputFormat(OutputFormat format) if (def_engine) delete oldPrintEngine; - d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat; - + if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat) + d->validPrinter = true; #else Q_UNUSED(format); #endif diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 72141aa..ca1f270 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -179,7 +179,7 @@ private: }; -class Q_GUI_EXPORT QStroker : public QStrokerOps +class QStroker : public QStrokerOps { public: diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index dd4f7fd..3e7b015 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -142,8 +142,7 @@ void QRasterWindowSurface::beginPaint(const QRegion &rgn) p.fillRect(*it, blank); } } -#endif -#if defined(Q_WS_WINCE) +#else Q_UNUSED(rgn); #endif } @@ -250,6 +249,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi // d->image->image.save("flush.png"); + Q_UNUSED(offset); // Get a context for the widget. #ifndef QT_MAC_USE_COCOA CGContextRef context; diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index f8ae1a6..c0899f8 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1780,46 +1780,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, case CE_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { drawControl(CE_TabBarTabShape, tab, p, widget); - - QStyleOptionTabV3 tabV3(*tab); - QRect labelRect = tabV3.rect; - QSize &left= tabV3.leftButtonSize; - QSize &right = tabV3.rightButtonSize; - const int spacing = 6 + 2; - - // left widget - if (!left.isEmpty()) { - if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast ) - labelRect.setTop(labelRect.top() + spacing + left.height()); - else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest) - labelRect.setBottom(labelRect.bottom() - spacing - left.height()); - else - labelRect.setLeft(labelRect.left() + spacing + left.width()); - } - - // right widget - if (!right.isEmpty()) { - if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast ) - labelRect.setBottom(labelRect.bottom() - spacing - right.height()); - else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest) - labelRect.setTop(labelRect.top() + spacing + right.height()); - else - labelRect.setRight(labelRect.right() - spacing - right.width()); - } - - tabV3.rect = visualRect(opt->direction, opt->rect, labelRect); - drawControl(CE_TabBarTabLabel, &tabV3, p, widget); - if (tabV3.state & State_HasFocus) { - const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - int x1, x2; - x1 = tab->rect.left(); - x2 = tab->rect.right() - 1; - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(x1 + 1 + OFFSET, tab->rect.y() + OFFSET, - x2 - x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); - } + drawControl(CE_TabBarTabLabel, tab, p, widget); } break; case CE_TabBarTabShape: @@ -2023,8 +1984,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, (tabV2.state & State_Selected) ? QIcon::On : QIcon::Off); - int offset = 6; + int offset = 4; int left = opt->rect.left(); + if (tabV2.leftButtonSize.isEmpty()) + offset += 2; + else + left += tabV2.leftButtonSize.width() + (6 + 2) + 2; QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2, tabIconSize.width(), tabIconSize.height()); if (!verticalTabs) @@ -2035,6 +2000,20 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); if (verticalTabs) p->restore(); + + if (tabV2.state & State_HasFocus) { + const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); + + int x1, x2; + x1 = tabV2.rect.left(); + x2 = tabV2.rect.right() - 1; + + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*tab); + fropt.rect.setRect(x1 + 1 + OFFSET, tabV2.rect.y() + OFFSET, + x2 - x1 - 2*OFFSET, tabV2.rect.height() - 2*OFFSET); + drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + } } break; #endif // QT_NO_TABBAR @@ -2873,15 +2852,23 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, tr.setRect(0, 0, tr.height(), tr.width()); int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); + int hpadding = pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; + int vpadding = pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; if (tabV2.shape == QTabBar::RoundedSouth || tabV2.shape == QTabBar::TriangularSouth) verticalShift = -verticalShift; - tr.adjust(0, 0, horizontalShift, verticalShift); + tr.adjust(hpadding, vpadding, horizontalShift - hpadding, verticalShift - vpadding); bool selected = tabV2.state & State_Selected; if (selected) { tr.setBottom(tr.bottom() - verticalShift); tr.setRight(tr.right() - horizontalShift); } + // left widget + if (!tabV2.leftButtonSize.isEmpty()) { + tr.setLeft(tr.left() + 6 + 2 + + (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width())); + } + // icon if (!tabV2.icon.isNull()) { QSize iconSize = tabV2.iconSize; @@ -2903,6 +2890,12 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, tr.setLeft(tr.left() + tabIconSize.width() + offset + 2); } + // right widget + if (!tabV2.rightButtonSize.isEmpty()) { + tr.setRight(tr.right() - 6 - 2 - + (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width())); + } + if (!verticalTabs) tr = visualRect(opt->direction, opt->rect, tr); r = tr; @@ -3194,6 +3187,25 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; #endif //QT_NO_ITEMVIEWS +#ifndef QT_NO_TOOLBAR + case SE_ToolBarHandle: + if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) { + if (tbopt->features & QStyleOptionToolBar::Movable) { + ///we need to access the widget here because the style option doesn't + //have all the information we need (ie. the layout's margin) + const QToolBar *tb = qobject_cast<const QToolBar*>(widget); + const int margin = tb && tb->layout() ? tb->layout()->margin() : 2; + const int handleExtent = pixelMetric(QStyle::PM_ToolBarExtensionExtent, opt, tb); + if (tbopt->state & QStyle::State_Horizontal) { + r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin); + r = QStyle::visualRect(tbopt->direction, tbopt->rect, r); + } else { + r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent); + } + } + } + break; +#endif //QT_NO_TOOLBAR default: break; } diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e32c5e2..5e538cb 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -564,7 +564,6 @@ extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp QMacCGStyle globals *****************************************************************************/ const int qt_mac_hitheme_version = 0; //the HITheme version we speak -const int macSpinBoxSep = 5; // distance between spinwidget and the lineedit const int macItemFrame = 2; // menu item frame width const int macItemHMargin = 3; // menu item hor text margin const int macItemVMargin = 2; // menu item ver text margin @@ -2161,8 +2160,11 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint /*! \reimp */ void QMacStyle::polish(QPalette &pal) { - if (qt_mac_backgroundPattern == 0) + if (!qt_mac_backgroundPattern) { + if (!qApp) + return; qt_mac_backgroundPattern = new QPixmap(d->generateBackgroundPattern()); + } QColor pc(Qt::black); pc = qcolorForTheme(kThemeBrushDialogBackgroundActive); @@ -2388,7 +2390,14 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW break; case PM_SpinBoxFrameWidth: GetThemeMetric(kThemeMetricEditTextFrameOutset, &ret); - ret += 2; + switch (d->aquaSizeConstrain(opt, widget)) { + default: + ret += 2; + break; + case QAquaSizeMini: + ret += 1; + break; + } break; case PM_ButtonShiftHorizontal: case PM_ButtonShiftVertical: @@ -5061,11 +5070,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex bdi.kind = kThemeIncDecButton; break; case QAquaSizeMini: + bdi.kind = kThemeIncDecButtonMini; + break; case QAquaSizeSmall: - if (aquaSize == QAquaSizeMini) - bdi.kind = kThemeIncDecButtonMini; - else - bdi.kind = kThemeIncDecButtonSmall; + bdi.kind = kThemeIncDecButtonSmall; break; } if (!(sb->stepEnabled & (QAbstractSpinBox::StepUpEnabled @@ -5085,8 +5093,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex bdi.value = kThemeButtonOff; bdi.adornment = kThemeAdornmentNone; - QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, - widget); + QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); + updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); HIRect newRect = qt_hirectForQRect(updown); QRect off_rct; @@ -5097,15 +5105,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex int(outRect.size.width - newRect.size.width), int(outRect.size.height - newRect.size.height)); - // HIThemeGetButtonBackgroundBounds offsets non-focused normal sized - // buttons by one in de y direction, account for that here. - if (bdi.adornment == kThemeAdornmentNone && bdi.kind == kThemeIncDecButton) - off_rct.adjust(0, 1, 0, 0); - - // Adjust the rect for small buttos also. - if (bdi.adornment == kThemeAdornmentFocus && bdi.kind == kThemeIncDecButtonSmall) - off_rct.adjust(0, 0, 0, -1); - newRect = qt_hirectForQRect(updown, off_rct); HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0); } @@ -5275,7 +5274,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { -// p->fillRect(tb->rect, QColor(155, 0, 155, 155)); if (tb->subControls & SC_ToolButtonMenu) { QStyleOption arrowOpt(0); arrowOpt.rect = subControlRect(cc, tb, SC_ToolButtonMenu, widget); @@ -5781,39 +5779,61 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op break; case CC_SpinBox: if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { - const int spinner_w = 14, - fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); + QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget); + int spinner_w; + int spinBoxSep; + int fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); + switch (aquaSize) { + default: + case QAquaSizeUnknown: + case QAquaSizeLarge: + spinner_w = 14; + spinBoxSep = 2; + break; + case QAquaSizeSmall: + spinner_w = 12; + spinBoxSep = 2; + break; + case QAquaSizeMini: + spinner_w = 10; + spinBoxSep = 1; + break; + } + switch (sc) { case SC_SpinBoxUp: case SC_SpinBoxDown: { if (spin->buttonSymbols == QAbstractSpinBox::NoButtons) break; - const int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spin, widget); - const int spinner_w = 18; - const int y = frameWidth; - const int x = spin->rect.width() - spinner_w + frameWidth; + + const int y = fw; + const int x = spin->rect.width() - spinner_w; ret.setRect(x + spin->rect.x(), y + spin->rect.y(), spinner_w, spin->rect.height() - y * 2); HIThemeButtonDrawInfo bdi; bdi.version = qt_mac_hitheme_version; bdi.kind = kThemeIncDecButton; - QAquaWidgetSize aquaSize = d->aquaSizeConstrain(opt, widget); + int hackTranslateX; switch (aquaSize) { - case QAquaSizeUnknown: - case QAquaSizeLarge: - bdi.kind = kThemeIncDecButton; - break; - case QAquaSizeMini: - case QAquaSizeSmall: - if (aquaSize == QAquaSizeMini) - bdi.kind = kThemeIncDecButtonMini; - else - bdi.kind = kThemeIncDecButtonSmall; - break; + default: + case QAquaSizeUnknown: + case QAquaSizeLarge: + bdi.kind = kThemeIncDecButton; + hackTranslateX = 0; + break; + case QAquaSizeSmall: + bdi.kind = kThemeIncDecButtonSmall; + hackTranslateX = -2; + break; + case QAquaSizeMini: + bdi.kind = kThemeIncDecButtonMini; + hackTranslateX = -1; + break; } bdi.state = kThemeStateActive; bdi.value = kThemeButtonOff; bdi.adornment = kThemeAdornmentNone; HIRect hirect = qt_hirectForQRect(ret); + HIRect outRect; HIThemeGetButtonBackgroundBounds(&hirect, &bdi, &outRect); ret = qt_qrectForHIRect(outRect); @@ -5828,13 +5848,13 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op Q_ASSERT(0); break; } - ret.translate(-1, -2); // hack: position the buttons correctly (weird that we need this) + ret.translate(hackTranslateX, 0); // hack: position the buttons correctly (weird that we need this) ret = visualRect(spin->direction, spin->rect, ret); break; } case SC_SpinBoxEditField: ret.setRect(fw, fw, - spin->rect.width() - spinner_w - fw * 2 - macSpinBoxSep + 1, + spin->rect.width() - spinner_w - fw * 2 - spinBoxSep, spin->rect.height() - fw * 2); ret = visualRect(spin->direction, spin->rect, ret); break; @@ -5866,8 +5886,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, switch (ct) { case QStyle::CT_SpinBox: - sz.setWidth(sz.width() + macSpinBoxSep); - sz.setHeight(sz.height() - 3); // hack to work around horrible sizeHint() code in QAbstractSpinBox + // hack to work around horrible sizeHint() code in QAbstractSpinBox + sz.setHeight(sz.height() - 3); break; case QStyle::CT_TabBarTab: if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) { diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index 982f48f..b73332f 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -1048,6 +1048,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value SE_TabBarTabRightButton Area for a widget on the right side of a tab in a tab bar. \value SE_TabBarTabText Area for the text on a tab in a tab bar. + \value SE_ToolBarHandle Area for the handle of a tool bar. + \sa subElementRect() */ diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h index c1cbbdd..cc92459 100644 --- a/src/gui/styles/qstyle.h +++ b/src/gui/styles/qstyle.h @@ -373,6 +373,8 @@ public: SE_ShapedFrameContents, + SE_ToolBarHandle, + // do not add any values below/greater than this SE_CustomBase = 0xf0000000 }; diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h index 711bd2d..5385d9f 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/gui/styles/qstylehelper_p.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include <QtCore/qglobal.h> #include <QtCore/qpoint.h> #include <QtGui/qpolygon.h> diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index ac17e8d..dcc11b8 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4758,7 +4758,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op case CT_LineEdit: #ifndef QT_NO_SPINBOX // ### hopelessly broken QAbstractSpinBox (part 2) - if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w->parentWidget())) { + if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0)) { QRenderRule rule = renderRule(spinBox, opt); if (rule.hasBox() || !rule.hasNativeBorder()) return csz; @@ -5674,7 +5674,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c bool QStyleSheetStyle::event(QEvent *e) { - return baseStyle()->event(e) || ParentStyle::event(e); + return (baseStyle()->event(e) && e->isAccepted()) || ParentStyle::event(e); } void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index db1e781..8214e54 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -278,19 +278,15 @@ static const QCssKnownValue values[NumKnownValues - 1] = { { "xx-large", Value_XXLarge } }; +//Map id to strings as they appears in the 'values' array above +static const int indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46, + 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16, + 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0, + 51, 44, 43 }; + QString Value::toString() const { - static int indexOfId[NumKnownValues - 1]; - static bool hasCachedIndexes = false; - if (type == KnownIdentifier) { - if (!hasCachedIndexes) { - for (int i = 0; i < NumKnownValues - 1; ++i) - indexOfId[values[i].id] = i; - - hasCachedIndexes = true; - } - return QLatin1String(values[indexOfId[variant.toInt()]].name); } else { return variant.toString(); diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 97a0aef..fbd6c16 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -403,7 +403,7 @@ struct BorderData { // 4. QVector<Declaration> - { prop1: value1; prop2: value2; } // 5. Declaration - prop1: value1; -struct Q_GUI_EXPORT Declaration +struct Declaration { struct DeclarationData : public QSharedData { @@ -495,7 +495,7 @@ const quint64 PseudoClass_Alternate = Q_UINT64_C(0x0000100000000000); const quint64 PseudoClass_Any = Q_UINT64_C(0x0000ffffffffffff); const int NumPseudos = 46; -struct Q_GUI_EXPORT Pseudo +struct Pseudo { Pseudo() : negated(false) { } quint64 type; @@ -504,7 +504,7 @@ struct Q_GUI_EXPORT Pseudo bool negated; }; -struct Q_GUI_EXPORT AttributeSelector +struct AttributeSelector { enum ValueMatchType { NoMatch, @@ -519,7 +519,7 @@ struct Q_GUI_EXPORT AttributeSelector ValueMatchType valueMatchCriterium; }; -struct Q_GUI_EXPORT BasicSelector +struct BasicSelector { inline BasicSelector() : relationToNext(NoRelation) {} @@ -539,7 +539,7 @@ struct Q_GUI_EXPORT BasicSelector Relation relationToNext; }; -struct Q_GUI_EXPORT Selector +struct Selector { QVector<BasicSelector> basicSelectors; int specificity() const; @@ -552,7 +552,7 @@ struct MediaRule; struct PageRule; struct ImportRule; -struct Q_GUI_EXPORT ValueExtractor +struct ValueExtractor { ValueExtractor(const QVector<Declaration> &declarations, const QPalette & = QPalette()); @@ -586,7 +586,7 @@ private: QPalette pal; }; -struct Q_GUI_EXPORT StyleRule +struct StyleRule { StyleRule() : order(0) { } QVector<Selector> selectors; @@ -594,19 +594,19 @@ struct Q_GUI_EXPORT StyleRule int order; }; -struct Q_GUI_EXPORT MediaRule +struct MediaRule { QStringList media; QVector<StyleRule> styleRules; }; -struct Q_GUI_EXPORT PageRule +struct PageRule { QString selector; QVector<Declaration> declarations; }; -struct Q_GUI_EXPORT ImportRule +struct ImportRule { QString href; QStringList media; @@ -620,7 +620,7 @@ enum StyleSheetOrigin { StyleSheetOrigin_Inline }; -struct Q_GUI_EXPORT StyleSheet +struct StyleSheet { StyleSheet() : origin(StyleSheetOrigin_Unspecified), depth(0) { } QVector<StyleRule> styleRules; //only contains rules that are not indexed diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 24ff10b..f73ffb5 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -913,7 +913,7 @@ void QFont::setPointSize(int pointSize) void QFont::setPointSizeF(qreal pointSize) { if (pointSize <= 0) { - qWarning("QFont::setPointSizeF: Point size <= 0 (%d), must be greater than 0", pointSize); + qWarning("QFont::setPointSizeF: Point size <= 0 (%f), must be greater than 0", pointSize); return; } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 47fe5c2..d7a9c23 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -624,6 +624,45 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q return rgbMask; } +QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) +{ + glyph_metrics_t gm = boundingBox(glyph); + int glyph_x = qFloor(gm.x.toReal()); + int glyph_y = qFloor(gm.y.toReal()); + int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x; + int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y; + + if (glyph_width <= 0 || glyph_height <= 0) + return QImage(); + QFixedPoint pt; + pt.x = 0; + pt.y = -glyph_y; // the baseline + QPainterPath path; + QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); + im.fill(Qt::transparent); + QPainter p(&im); + p.setRenderHint(QPainter::Antialiasing); + addGlyphsToPath(&glyph, &pt, 1, &path, 0); + p.setPen(Qt::NoPen); + p.setBrush(Qt::black); + p.drawPath(path); + p.end(); + + QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); + QVector<QRgb> colors(256); + for (int i=0; i<256; ++i) + colors[i] = qRgba(0, 0, 0, i); + indexed.setColorTable(colors); + + for (int y=0; y<im.height(); ++y) { + uchar *dst = (uchar *) indexed.scanLine(y); + uint *src = (uint *) im.scanLine(y); + for (int x=0; x<im.width(); ++x) + dst[x] = qAlpha(src[x]); + } + + return indexed; +} void QFontEngine::removeGlyphFromCache(glyph_t) { diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index cb0b436..6f5ee1f 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -613,7 +613,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd) subpixelType = Subpixel_None; lcdFilterType = 0; #if defined(FT_LCD_FILTER_H) - lcdFilterType = (int) FT_LCD_FILTER_DEFAULT; + lcdFilterType = (int)((quintptr) FT_LCD_FILTER_DEFAULT); #endif defaultFormat = Format_None; canUploadGlyphsToServer = false; @@ -1521,6 +1521,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs return false; } +#if !defined(QT_NO_FONTCONFIG) + extern QMutex *qt_fontdatabase_mutex(); + QMutex *mtx = 0; +#endif + bool mirrored = flags & QTextEngine::RightToLeft; int glyph_pos = 0; if (freetype->symbol_map) { @@ -1533,6 +1538,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs if ( !glyphs->glyphs[glyph_pos] ) { glyph_t glyph; #if !defined(QT_NO_FONTCONFIG) + if (!mtx) { + mtx = qt_fontdatabase_mutex(); + mtx->lock(); + } + if (FcCharSetHasChar(freetype->charset, uc)) { #else if (false) { @@ -1561,20 +1571,26 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs if (mirrored) uc = QChar::mirroredChar(uc); glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0; - if (!glyphs->glyphs[glyph_pos] + if (!glyphs->glyphs[glyph_pos]) { #if !defined(QT_NO_FONTCONFIG) - && FcCharSetHasChar(freetype->charset, uc) + if (!mtx) { + mtx = qt_fontdatabase_mutex(); + mtx->lock(); + } + + if (FcCharSetHasChar(freetype->charset, uc)) #endif - ) { - redo: - glyph_t glyph = FT_Get_Char_Index(face, uc); - if (!glyph && (uc == 0xa0 || uc == 0x9)) { - uc = 0x20; - goto redo; + { + redo: + glyph_t glyph = FT_Get_Char_Index(face, uc); + if (!glyph && (uc == 0xa0 || uc == 0x9)) { + uc = 0x20; + goto redo; + } + glyphs->glyphs[glyph_pos] = glyph; + if (uc < QFreetypeFace::cmapCacheSize) + freetype->cmapCache[uc] = glyph; } - glyphs->glyphs[glyph_pos] = glyph; - if (uc < QFreetypeFace::cmapCacheSize) - freetype->cmapCache[uc] = glyph; } ++glyph_pos; } @@ -1583,6 +1599,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs *nglyphs = glyph_pos; glyphs->numGlyphs = glyph_pos; +#if !defined(QT_NO_FONTCONFIG) + if (mtx) + mtx->unlock(); +#endif + if (flags & QTextEngine::GlyphIndicesOnly) return true; @@ -1788,9 +1809,11 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g) GlyphFormat glyph_format = antialias ? Format_A8 : Format_Mono; - Glyph *glyph = loadGlyph(g, glyph_format); - if (!glyph) - return QImage(); + Glyph *glyph = defaultGlyphSet.outline_drawing ? 0 : loadGlyph(g, glyph_format); + if (!glyph) { + unlockFace(); + return QFontEngine::alphaMapForGlyph(g); + } const int pitch = antialias ? (glyph->width + 3) & ~3 : ((glyph->width + 31)/32) * 4; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 8f6b92a..92efb6c 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -178,7 +178,7 @@ public: * Create a qimage with the alpha values for the glyph. * Returns an image indexed_8 with index values ranging from 0=fully transparant to 255=opaque */ - virtual QImage alphaMapForGlyph(glyph_t) = 0; + virtual QImage alphaMapForGlyph(glyph_t); virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t); virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t); diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index c327b9f..d12e3fe 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -145,7 +145,6 @@ void QTextCursorPrivate::remove() { if (anchor == position) return; - priv->beginEditBlock(); currentCharFormat = -1; int pos1 = position; int pos2 = adjusted_anchor; @@ -159,15 +158,18 @@ void QTextCursorPrivate::remove() // deleting inside table? -> delete only content QTextTable *table = complexSelectionTable(); if (table) { + priv->beginEditBlock(); int startRow, startCol, numRows, numCols; selectedTableCells(&startRow, &numRows, &startCol, &numCols); clearCells(table, startRow, startCol, numRows, numCols, op); + adjusted_anchor = anchor = position; + priv->endEditBlock(); } else { priv->remove(pos1, pos2-pos1, op); + adjusted_anchor = anchor = position; + priv->finishEdit(); } - adjusted_anchor = anchor = position; - priv->endEditBlock(); } void QTextCursorPrivate::clearCells(QTextTable *table, int startRow, int startCol, int numRows, int numCols, QTextUndoCommand::Operation op) @@ -1074,7 +1076,10 @@ QTextCursor::QTextCursor(const QTextCursor &cursor) } /*! - Makes a copy of \a cursor and assigns it to this QTextCursor. + Makes a copy of \a cursor and assigns it to this QTextCursor. Note + that QTextCursor is an \l{Implicitly Shared Classes}{implicitly + shared} class. + */ QTextCursor &QTextCursor::operator=(const QTextCursor &cursor) { @@ -1288,9 +1293,14 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format QTextCharFormat format = _format; format.clearProperty(QTextFormat::ObjectIndex); - d->priv->beginEditBlock(); + bool hasEditBlock = false; + + if (d->anchor != d->position) { + hasEditBlock = true; + d->priv->beginEditBlock(); + d->remove(); + } - d->remove(); if (!text.isEmpty()) { QTextFormatCollection *formats = d->priv->formatCollection(); int formatIdx = formats->indexForFormat(format); @@ -1320,6 +1330,11 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format || ch == QChar::ParagraphSeparator || ch == QLatin1Char('\r')) { + if (!hasEditBlock) { + hasEditBlock = true; + d->priv->beginEditBlock(); + } + if (blockEnd > blockStart) d->priv->insert(d->position, textStart + blockStart, blockEnd - blockStart, formatIdx); @@ -1330,7 +1345,8 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format if (textStart + blockStart < textEnd) d->priv->insert(d->position, textStart + blockStart, textEnd - textStart - blockStart, formatIdx); } - d->priv->endEditBlock(); + if (hasEditBlock) + d->priv->endEditBlock(); d->setX(); } diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index e84b324..873f846 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -287,7 +287,7 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba) that inform connected editor widgets about the state of the undo/redo system. - \sa QTextCursor QTextEdit \link richtext.html Rich Text Processing\endlink + \sa QTextCursor, QTextEdit, \link richtext.html Rich Text Processing\endlink , {Text Object Example} */ /*! diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 05ddf47..e1da4be 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -404,7 +404,7 @@ int QTextDocumentPrivate::insertBlock(const QChar &blockSeparator, int b = blocks.findNode(pos); QTextBlockData *B = blocks.fragment(b); - QTextUndoCommand c = { QTextUndoCommand::BlockInserted, true, + QTextUndoCommand c = { QTextUndoCommand::BlockInserted, editBlock != 0, op, charFormat, strPos, pos, { blockFormat }, B->revision }; @@ -439,20 +439,19 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format Q_ASSERT(pos >= 0 && pos < fragments.length()); Q_ASSERT(formats.format(format).isCharFormat()); - beginEditBlock(); insert_string(pos, strPos, strLength, format, QTextUndoCommand::MoveCursor); if (undoEnabled) { int b = blocks.findNode(pos); QTextBlockData *B = blocks.fragment(b); - QTextUndoCommand c = { QTextUndoCommand::Inserted, true, + QTextUndoCommand c = { QTextUndoCommand::Inserted, editBlock != 0, QTextUndoCommand::MoveCursor, format, strPos, pos, { strLength }, B->revision }; appendUndoItem(c); B->revision = undoState; Q_ASSERT(undoState == undoStack.size()); } - endEditBlock(); + finishEdit(); } void QTextDocumentPrivate::insert(int pos, const QString &str, int format) @@ -584,8 +583,6 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O Q_ASSERT(startAndEndInSameFrame || endIsEndOfChildFrame || startIsStartOfFrameAndEndIsEndOfFrameWithCommonParent || isFirstTableCell); #endif - beginEditBlock(); - split(pos); split(pos+length); @@ -605,10 +602,10 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O int blockRevision = B->revision; QTextFragmentData *X = fragments.fragment(x); - QTextUndoCommand c = { QTextUndoCommand::Removed, true, + QTextUndoCommand c = { QTextUndoCommand::Removed, editBlock != 0, op, X->format, X->stringPosition, key, { X->size_array[0] }, blockRevision }; - QTextUndoCommand cInsert = { QTextUndoCommand::Inserted, true, + QTextUndoCommand cInsert = { QTextUndoCommand::Inserted, editBlock != 0, op, X->format, X->stringPosition, dstKey, { X->size_array[0] }, blockRevision }; @@ -648,7 +645,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O Q_ASSERT(blocks.length() == fragments.length()); - endEditBlock(); + finishEdit(); } void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operation op) @@ -1004,8 +1001,12 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) if (!undoStack.isEmpty() && modified) { QTextUndoCommand &last = undoStack[undoState - 1]; - if (last.tryMerge(c)) - return; + if ( (last.block && c.block) // part of the same block => can merge + || (!c.block && !last.block // two single undo items => can merge + && (undoState < 2 || !undoStack[undoState-2].block))) { + if (last.tryMerge(c)) + return; + } } if (modifiedState > undoState) modifiedState = -1; @@ -1013,6 +1014,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c) undoState++; emitUndoAvailable(true); emitRedoAvailable(false); + + if (!c.block) + emit document()->undoCommandAdded(); } void QTextDocumentPrivate::truncateUndoStack() @@ -1082,7 +1086,6 @@ void QTextDocumentPrivate::joinPreviousEditBlock() void QTextDocumentPrivate::endEditBlock() { - Q_Q(QTextDocument); if (--editBlock) return; @@ -1093,6 +1096,16 @@ void QTextDocumentPrivate::endEditBlock() emit document()->undoCommandAdded(); } + finishEdit(); +} + +void QTextDocumentPrivate::finishEdit() +{ + Q_Q(QTextDocument); + + if (editBlock) + return; + if (framesDirty) scan_frames(docChangeFrom, docChangeOldLength, docChangeLength); @@ -1279,7 +1292,7 @@ void QTextDocumentPrivate::changeObjectFormat(QTextObject *obj, int format) if (f) documentChange(f->firstPosition(), f->lastPosition() - f->firstPosition()); - QTextUndoCommand c = { QTextUndoCommand::GroupFormatChange, true, QTextUndoCommand::MoveCursor, oldFormatIndex, + QTextUndoCommand c = { QTextUndoCommand::GroupFormatChange, editBlock != 0, QTextUndoCommand::MoveCursor, oldFormatIndex, 0, 0, { obj->d_func()->objectIndex }, 0 }; appendUndoItem(c); diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index 25763e1..d754ff0 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -139,7 +139,7 @@ public: MoveCursor = 1 }; quint16 command; - quint8 block; ///< All undo commands that have this set to zero/false are combined with the preceding command on undo/redo. + quint8 block; ///< All undo commands that have this set to true are combined with the preceding command on undo/redo. quint8 operation; int format; quint32 strPos; @@ -202,6 +202,7 @@ public: inline void beginEditBlock() { editBlock++; } void joinPreviousEditBlock(); void endEditBlock(); + void finishEdit(); inline bool isInEditBlock() const { return editBlock; } void enableUndoRedo(bool enable); inline bool isUndoRedoEnabled() const { return undoEnabled; } diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 0571d75..8eaeeb1 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -232,6 +232,12 @@ public: ImageWidth = 0x5010, ImageHeight = 0x5011, + // internal + /* + SuppressText = 0x5012, + SuppressBackground = 0x513 + */ + // selection properties FullWidthSelection = 0x06000, diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 434d1ca..fa624ef 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -61,6 +61,8 @@ QT_BEGIN_NAMESPACE #define ObjectSelectionBrush (QTextFormat::ForegroundBrush + 1) +#define SuppressText 0x5012 +#define SuppressBackground 0x513 static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line) { @@ -1143,6 +1145,7 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang } QPainterPath excludedRegion; + QPainterPath textDoneRegion; for (int i = 0; i < selections.size(); ++i) { FormatRange selection = selections.at(i); const QBrush bg = selection.format.background(); @@ -1202,23 +1205,55 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang } + + bool hasText = (selection.format.foreground().style() != Qt::NoBrush); + bool hasBackground= (selection.format.background().style() != Qt::NoBrush); + + if (hasBackground) { + selection.format.setProperty(ObjectSelectionBrush, selection.format.property(QTextFormat::BackgroundBrush)); + // don't just clear the property, set an empty brush that overrides a potential + // background brush specified in the text + selection.format.setProperty(QTextFormat::BackgroundBrush, QBrush()); + selection.format.clearProperty(QTextFormat::OutlinePen); + } + + selection.format.setProperty(SuppressText, !hasText); + + if (hasText && !hasBackground && !(textDoneRegion & region).isEmpty()) + continue; + p->save(); p->setClipPath(region, Qt::IntersectClip); - selection.format.setProperty(ObjectSelectionBrush, selection.format.property(QTextFormat::BackgroundBrush)); - // don't just clear the property, set an empty brush that overrides a potential - // background brush specified in the text - selection.format.setProperty(QTextFormat::BackgroundBrush, QBrush()); - selection.format.clearProperty(QTextFormat::OutlinePen); - for (int line = firstLine; line < lastLine; ++line) { QTextLine l(line, d); l.draw(p, position, &selection); } p->restore(); - if (selection.format.foreground().style() != Qt::NoBrush) // i.e. we have drawn text - excludedRegion += region; + if (hasText) { + textDoneRegion += region; + } else { + if (hasBackground) + textDoneRegion -= region; + } + + excludedRegion += region; + } + + QPainterPath needsTextButNoBackground = excludedRegion - textDoneRegion; + if (!needsTextButNoBackground.isEmpty()){ + p->save(); + p->setClipPath(needsTextButNoBackground, Qt::IntersectClip); + FormatRange selection; + selection.start = 0; + selection.length = INT_MAX; + selection.format.setProperty(SuppressBackground, true); + for (int line = firstLine; line < lastLine; ++line) { + QTextLine l(line, d); + l.draw(p, position, &selection); + } + p->restore(); } if (!excludedRegion.isEmpty()) { @@ -1912,14 +1947,17 @@ static void drawMenuText(QPainter *p, QFixed x, QFixed y, const QScriptItem &si, static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const QTextCharFormat &chf, const QRectF &r) { QBrush c = chf.foreground(); - if (c.style() == Qt::NoBrush) + if (c.style() == Qt::NoBrush) { p->setPen(defaultPen); + } QBrush bg = chf.background(); - if (bg.style() != Qt::NoBrush) + if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool()) p->fillRect(r, bg); - if (c.style() != Qt::NoBrush) + if (c.style() != Qt::NoBrush) { p->setPen(QPen(c, 0)); + } + } /*! @@ -1933,7 +1971,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR const QScriptLine &line = eng->lines[i]; QPen pen = p->pen(); - bool noText = (selection && selection->format.foreground().style() == Qt::NoBrush); + bool noText = (selection && selection->format.property(SuppressText).toBool()); if (!line.length) { if (selection diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 3f4c8e5..71b68e0 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE objects, you will also need to reimplement QTextDocument::createObject() which acts as a factory method for creating text objects. - \sa QTextDocument + \sa QTextDocument, {Text Object Example} */ /*! diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index ba1c04f..48708c9 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -525,7 +525,12 @@ void QTextTablePrivate::update() const Rows and columns within a QTextTable can be merged and split using the mergeCells() and splitCell() functions. However, only cells that span multiple rows or columns can be split. (Merging or splitting does not increase or decrease - the number of rows and columns.) + the number of rows and columns.) + + Note that if you have merged multiple columns and rows into one cell, you will not + be able to split the merged cell into new cells spanning over more than one row + or column. To be able to split cells spanning over several rows and columns you + need to do this over several iterations. \table 80% \row diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index a622385..faa4e7b 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -824,7 +824,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted) Q_Q(QCompleter); QString completion; - if (!index.isValid() || (index.row() >= proxy->engine->matchCount())) { + if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) { completion = prefix; } else { QModelIndex si = proxy->mapToSource(index); diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index f2a9ceb..1900016 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -215,11 +215,8 @@ void QButtonGroup::setExclusive(bool exclusive) d->exclusive = exclusive; } -/*! - Adds the given \a button to the end of the group's internal list of buttons. - \sa removeButton() -*/ +// TODO: Qt 5: Merge with addButton(QAbstractButton *button, int id) void QButtonGroup::addButton(QAbstractButton *button) { addButton(button, -1); @@ -232,8 +229,18 @@ void QButtonGroup::addButton(QAbstractButton *button, int id) previous->removeButton(button); button->d_func()->group = this; d->buttonList.append(button); - if (id != -1) + if (id == -1) { + QList<int> ids = d->mapping.values(); + if (ids.isEmpty()) + d->mapping[button] = -2; + else { + qSort(ids); + d->mapping[button] = ids.first()-1; + } + } else { d->mapping[button] = id; + } + if (d->exclusive && button->isChecked()) button->d_func()->notifyChecked(); } diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h index e4c47e9..f153711 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/gui/widgets/qabstractscrollarea_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QScrollBar; class QAbstractScrollAreaScrollBarContainer; -class Q_GUI_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate +class QAbstractScrollAreaPrivate: public QFramePrivate { Q_DECLARE_PUBLIC(QAbstractScrollArea) diff --git a/src/gui/widgets/qbuttongroup.cpp b/src/gui/widgets/qbuttongroup.cpp index 06bcf1e..ebfafe3 100644 --- a/src/gui/widgets/qbuttongroup.cpp +++ b/src/gui/widgets/qbuttongroup.cpp @@ -176,11 +176,21 @@ */ /*! - \fn void QButtonGroup::addButton(QAbstractButton *button, int id = -1); + \fn void QButtonGroup::addButton(QAbstractButton *button); + + Adds the given \a button to the end of the group's internal list of buttons. + An \a id will be assigned to the button by this QButtonGroup. Automatically + assigned ids are guaranteed to be negative, starting with -2. If you are also + assigning your own ids, use positive values to avoid conflicts. + + \sa removeButton() buttons() +*/ + +/*! + \fn void QButtonGroup::addButton(QAbstractButton *button, int id); Adds the given \a button to the button group, with the given \a - id. If \a id is -1 (the default), an id will be assigned to the - button by this QButtonGroup. + id. It is recommended to assign only positive ids. \sa removeButton() buttons() */ diff --git a/src/gui/widgets/qframe_p.h b/src/gui/widgets/qframe_p.h index 4fd341d..3ea0c8b 100644 --- a/src/gui/widgets/qframe_p.h +++ b/src/gui/widgets/qframe_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QFramePrivate : public QWidgetPrivate +class QFramePrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QFrame) public: diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 1afb28a..502c1e9 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -480,9 +480,6 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) oldMenuBar->hide(); oldMenuBar->deleteLater(); } -#ifdef Q_WS_WINCE - if (menuBar && menuBar->size().height() > 0) -#endif d->layout->setMenuBar(menuBar); } diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index ad848c9..cce083f 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -71,7 +71,6 @@ QT_BEGIN_NAMESPACE /***************************************************************************** QMenu globals *****************************************************************************/ -bool qt_mac_no_native_menubar = false; bool qt_mac_no_menubar_merge = false; bool qt_mac_quit_menu_item_enabled = true; int qt_mac_menus_open_count = 0; @@ -143,6 +142,39 @@ static int qt_mac_CountMenuItems(OSMenuRef menu) return 0; } +static quint32 constructModifierMask(quint32 accel_key) +{ + quint32 ret = 0; + const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta); +#ifndef QT_MAC_USE_COCOA + if ((accel_key & Qt::ALT) == Qt::ALT) + ret |= kMenuOptionModifier; + if ((accel_key & Qt::SHIFT) == Qt::SHIFT) + ret |= kMenuShiftModifier; + if (dontSwap) { + if ((accel_key & Qt::META) != Qt::META) + ret |= kMenuNoCommandModifier; + if ((accel_key & Qt::CTRL) == Qt::CTRL) + ret |= kMenuControlModifier; + } else { + if ((accel_key & Qt::CTRL) != Qt::CTRL) + ret |= kMenuNoCommandModifier; + if ((accel_key & Qt::META) == Qt::META) + ret |= kMenuControlModifier; + } +#else + if ((accel_key & Qt::CTRL) == Qt::CTRL) + ret |= (dontSwap ? NSControlKeyMask : NSCommandKeyMask); + if ((accel_key & Qt::META) == Qt::META) + ret |= (dontSwap ? NSCommandKeyMask : NSControlKeyMask); + if ((accel_key & Qt::ALT) == Qt::ALT) + ret |= NSAlternateKeyMask; + if ((accel_key & Qt::SHIFT) == Qt::SHIFT) + ret |= NSShiftKeyMask; +#endif + return ret; +} + static bool actualMenuItemVisibility(const QMenuBarPrivate::QMacMenuBarPrivate *mbp, const QMacMenuAction *action) { @@ -166,7 +198,7 @@ bool qt_mac_activate_action(MenuRef menu, uint command, QAction::ActionEvent act QMenuMergeList *list = 0; GetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, sizeof(list), 0, &list); - if (!list && qt_mac_current_menubar.qmenubar) { + if (!list && qt_mac_current_menubar.qmenubar && qt_mac_current_menubar.qmenubar->isNativeMenuBar()) { MenuRef apple_menu = qt_mac_current_menubar.qmenubar->d_func()->mac_menubar->apple_menu; GetMenuItemProperty(apple_menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, sizeof(list), 0, &list); if (list) @@ -526,15 +558,7 @@ static bool qt_mac_auto_apple_menu(MenuCommand cmd) static void qt_mac_get_accel(quint32 accel_key, quint32 *modif, quint32 *key) { if (modif) { - *modif = 0; - if ((accel_key & Qt::CTRL) != Qt::CTRL) - *modif |= kMenuNoCommandModifier; - if ((accel_key & Qt::META) == Qt::META) - *modif |= kMenuControlModifier; - if ((accel_key & Qt::ALT) == Qt::ALT) - *modif |= kMenuOptionModifier; - if ((accel_key & Qt::SHIFT) == Qt::SHIFT) - *modif |= kMenuShiftModifier; + *modif = constructModifierMask(accel_key); } accel_key &= ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL); @@ -728,6 +752,18 @@ QMacMenuAction::~QMacMenuAction() { #ifdef QT_MAC_USE_COCOA [menu release]; + if (action) { + QAction::MenuRole role = action->menuRole(); + // Check if the item is owned by Qt, and should be hidden to keep it from causing + // problems. Do it for everything but the quit menu item since that should always + // be visible. + if (role > QAction::ApplicationSpecificRole && role < QAction::QuitRole) { + [menuItem setHidden:YES]; + } else if (role == QAction::TextHeuristicRole + && menuItem != [getMenuLoader() quitMenuItem]) { + [menuItem setHidden:YES]; + } + } [menuItem setTag:nil]; [menuItem release]; #endif @@ -917,21 +953,22 @@ static QKeySequence qt_mac_menu_merge_accel(QMacMenuAction *action) ret = action->action->shortcut(); #ifndef QT_MAC_USE_COCOA else if (action->command == kHICommandPreferences) - ret = QKeySequence(Qt::CTRL+Qt::Key_Comma); + ret = QKeySequence(QKeySequence::Preferences); else if (action->command == kHICommandQuit) - ret = QKeySequence(Qt::CTRL+Qt::Key_Q); + ret = QKeySequence(QKeySequence::Quit); #else else if (action->menuItem == [loader preferencesMenuItem]) - ret = QKeySequence(Qt::CTRL+Qt::Key_Comma); + ret = QKeySequence(QKeySequence::Preferences); else if (action->menuItem == [loader quitMenuItem]) - ret = QKeySequence(Qt::CTRL+Qt::Key_Q); + ret = QKeySequence(QKeySequence::Quit); #endif return ret; } void Q_GUI_EXPORT qt_mac_set_menubar_icons(bool b) { QApplication::instance()->setAttribute(Qt::AA_DontShowIconsInMenus, !b); } -void Q_GUI_EXPORT qt_mac_set_native_menubar(bool b) { qt_mac_no_native_menubar = !b; } +void Q_GUI_EXPORT qt_mac_set_native_menubar(bool b) +{ QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, !b); } void Q_GUI_EXPORT qt_mac_set_menubar_merge(bool b) { qt_mac_no_menubar_merge = !b; } /***************************************************************************** @@ -1208,58 +1245,21 @@ QMenuPrivate::QMacMenuPrivate::addAction(QMacMenuAction *action, QMacMenuAction NSString *keySequenceToKeyEqivalent(const QKeySequence &accel) { quint32 accel_key = (accel[0] & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL)); - unichar keyEquiv[1] = { 0 }; - if (accel_key == Qt::Key_Return) - keyEquiv[0] = kReturnCharCode; - else if (accel_key == Qt::Key_Enter) - keyEquiv[0] = kEnterCharCode; - else if (accel_key == Qt::Key_Tab) - keyEquiv[0] = kTabCharCode; - else if (accel_key == Qt::Key_Backspace) - keyEquiv[0] = kBackspaceCharCode; - else if (accel_key == Qt::Key_Delete) - keyEquiv[0] = NSDeleteFunctionKey; - else if (accel_key == Qt::Key_Escape) - keyEquiv[0] = kEscapeCharCode; - else if (accel_key == Qt::Key_PageUp) - keyEquiv[0] = NSPageUpFunctionKey; - else if (accel_key == Qt::Key_PageDown) - keyEquiv[0] = NSPageDownFunctionKey; - else if (accel_key == Qt::Key_Up) - keyEquiv[0] = NSUpArrowFunctionKey; - else if (accel_key == Qt::Key_Down) - keyEquiv[0] = NSDownArrowFunctionKey; - else if (accel_key == Qt::Key_Left) - keyEquiv[0] = NSLeftArrowFunctionKey; - else if (accel_key == Qt::Key_Right) - keyEquiv[0] = NSRightArrowFunctionKey; - else if (accel_key == Qt::Key_CapsLock) - keyEquiv[0] = kMenuCapsLockGlyph; // ### Cocoa has no equivalent - else if (accel_key >= Qt::Key_F1 && accel_key <= Qt::Key_F15) - keyEquiv[0] = (accel_key - Qt::Key_F1) + NSF1FunctionKey; - else if (accel_key == Qt::Key_Home) - keyEquiv[0] = NSHomeFunctionKey; - else if (accel_key == Qt::Key_End) - keyEquiv[0] = NSEndFunctionKey; - else - keyEquiv[0] = unichar(QChar(accel_key).toLower().unicode()); - return [NSString stringWithCharacters:keyEquiv length:1]; + extern QChar qt_macSymbolForQtKey(int key); // qkeysequence.cpp + QChar keyEquiv = qt_macSymbolForQtKey(accel_key); + if (keyEquiv.isNull()) { + if (accel_key >= Qt::Key_F1 && accel_key <= Qt::Key_F15) + keyEquiv = (accel_key - Qt::Key_F1) + NSF1FunctionKey; + else + keyEquiv = unichar(QChar(accel_key).toLower().unicode()); + } + return [NSString stringWithCharacters:&keyEquiv.unicode() length:1]; } // return the cocoa modifier mask for the QKeySequence (currently only looks at the first one). NSUInteger keySequenceModifierMask(const QKeySequence &accel) { - NSUInteger ret = 0; - quint32 accel_key = accel[0]; - if ((accel_key & Qt::CTRL) == Qt::CTRL) - ret |= NSCommandKeyMask; - if ((accel_key & Qt::META) == Qt::META) - ret |= NSControlKeyMask; - if ((accel_key & Qt::ALT) == Qt::ALT) - ret |= NSAlternateKeyMask; - if ((accel_key & Qt::SHIFT) == Qt::SHIFT) - ret |= NSShiftKeyMask; - return ret; + return constructModifierMask(accel[0]); } void @@ -1728,9 +1728,14 @@ QMenuBarPrivate::macCreateMenuBar(QWidget *parent) { Q_Q(QMenuBar); static int checkEnv = -1; + // We call the isNativeMenuBar function here + // becasue that will make sure that local overrides + // are dealt with correctly. + bool qt_mac_no_native_menubar = !q->isNativeMenuBar(); if (qt_mac_no_native_menubar == false && checkEnv < 0) { checkEnv = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); - qt_mac_no_native_menubar = checkEnv; + QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, checkEnv); + qt_mac_no_native_menubar = !q->isNativeMenuBar(); } if (!qt_mac_no_native_menubar) { extern void qt_event_request_menubarupdate(); //qapplication_mac.cpp @@ -1765,7 +1770,7 @@ void QMenuBarPrivate::macDestroyMenuBar() OSMenuRef QMenuBarPrivate::macMenu() { Q_Q(QMenuBar); - if (!mac_menubar) { + if (!q->isNativeMenuBar() || !mac_menubar) { return 0; } else if (!mac_menubar->menu) { mac_menubar->menu = qt_mac_create_menu(q); @@ -1886,9 +1891,6 @@ static void cancelAllMenuTracking() */ bool QMenuBar::macUpdateMenuBar() { - if (qt_mac_no_native_menubar) //nothing to be done.. - return true; - cancelAllMenuTracking(); QMenuBar *mb = 0; //find a menu bar @@ -1922,7 +1924,7 @@ bool QMenuBar::macUpdateMenuBar() mb = fallback; //now set it bool ret = false; - if (mb) { + if (mb && mb->isNativeMenuBar()) { #ifdef QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; #endif @@ -1943,7 +1945,7 @@ bool QMenuBar::macUpdateMenuBar() qt_mac_current_menubar.qmenubar = mb; qt_mac_current_menubar.modal = QApplicationPrivate::modalState(); ret = true; - } else if (qt_mac_current_menubar.qmenubar) { + } else if (qt_mac_current_menubar.qmenubar && qt_mac_current_menubar.qmenubar->isNativeMenuBar()) { const bool modal = QApplicationPrivate::modalState(); if (modal != qt_mac_current_menubar.modal) { ret = true; diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index 315bd51..0befa6d 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -58,6 +58,9 @@ #include <QtCore/qlibrary.h> #include <commctrl.h> +#if Q_OS_WINCE_WM +# include <windowsm.h> +#endif #include "qguifunctions_wince.h" @@ -71,6 +74,12 @@ #define SHCMBM_GETSUBMENU (WM_USER + 401) #endif +#ifdef Q_OS_WINCE_WM +# define SHMBOF_NODEFAULT 0x00000001 +# define SHMBOF_NOTIFY 0x00000002 +# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193) +#endif + extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp @@ -204,8 +213,15 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i mbi.dwFlags = flags; mbi.nToolBarId = toolbarID; - if (ptrCreateMenuBar(&mbi)) + if (ptrCreateMenuBar(&mbi)) { +#ifdef Q_WS_WINCE_WM + // Tell the menu bar that we want to override hot key behaviour. + LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, + SHMBOF_NODEFAULT | SHMBOF_NOTIFY); + SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); +#endif return mbi.hwndMB; + } } return 0; } diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index f235cd5..d2e6bfb 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -194,7 +194,7 @@ void QMenuBarPrivate::updateGeometries() } #ifdef Q_WS_MAC - if(mac_menubar) {//nothing to see here folks, move along.. + if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. itemsDirty = false; return; } @@ -1025,14 +1025,8 @@ void QMenuBar::paintEvent(QPaintEvent *e) */ void QMenuBar::setVisible(bool visible) { -#ifdef Q_WS_MAC - Q_D(QMenuBar); - if(d->mac_menubar) - return; -#endif -#ifdef Q_WS_WINCE - Q_D(QMenuBar); - if(d->wce_menubar) +#if defined(Q_WS_MAC) || defined(Q_OS_WINCE) + if (isNativeMenuBar()) return; #endif QWidget::setVisible(visible); @@ -1272,24 +1266,21 @@ void QMenuBar::actionEvent(QActionEvent *e) { Q_D(QMenuBar); d->itemsDirty = true; +#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) + if (isNativeMenuBar()) { #ifdef Q_WS_MAC - if(d->mac_menubar) { - if(e->type() == QEvent::ActionAdded) - d->mac_menubar->addAction(e->action(), d->mac_menubar->findAction(e->before())); - else if(e->type() == QEvent::ActionRemoved) - d->mac_menubar->removeAction(e->action()); - else if(e->type() == QEvent::ActionChanged) - d->mac_menubar->syncAction(e->action()); - } + QMenuBarPrivate::QMacMenuBarPrivate *nativeMenuBar = d->mac_menubar; +#else + QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar; #endif -#ifdef Q_WS_WINCE - if(d->wce_menubar) { + if (!nativeMenuBar) + return; if(e->type() == QEvent::ActionAdded) - d->wce_menubar->addAction(e->action(), d->wce_menubar->findAction(e->before())); + nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before())); else if(e->type() == QEvent::ActionRemoved) - d->wce_menubar->removeAction(e->action()); + nativeMenuBar->removeAction(e->action()); else if(e->type() == QEvent::ActionChanged) - d->wce_menubar->syncAction(e->action()); + nativeMenuBar->syncAction(e->action()); } #endif if(e->type() == QEvent::ActionAdded) { @@ -1612,10 +1603,8 @@ QRect QMenuBar::actionGeometry(QAction *act) const QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); -#ifdef Q_WS_MAC - const bool as_gui_menubar = !d->mac_menubar; -#elif defined (Q_WS_WINCE) - const bool as_gui_menubar = !d->wce_menubar; +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) + const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; #endif @@ -1672,14 +1661,13 @@ QSize QMenuBar::minimumSizeHint() const QSize QMenuBar::sizeHint() const { Q_D(const QMenuBar); -#ifdef Q_WS_MAC - const bool as_gui_menubar = !d->mac_menubar; -#elif defined (Q_WS_WINCE) - const bool as_gui_menubar = !d->wce_menubar; +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) + const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; #endif + ensurePolished(); QSize ret(0, 0); const int hmargin = style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, this); @@ -1735,13 +1723,12 @@ QSize QMenuBar::sizeHint() const int QMenuBar::heightForWidth(int) const { Q_D(const QMenuBar); -#ifdef Q_WS_MAC - const bool as_gui_menubar = !d->mac_menubar; -#elif defined (Q_WS_WINCE) - const bool as_gui_menubar = !d->wce_menubar; +#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) + const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; #endif + int height = 0; const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); @@ -1856,6 +1843,60 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const } /*! + \property QMenuBar::nativeMenuBar + \brief Whether or not a menubar will be used as a native menubar on platforms that support it + \since 4.6 + + This property specifies whether or not the menubar should be used as a native menubar on platforms + that support it. The currently supported platforms are Mac OS X and Windows CE. On these platforms + if this property is true, the menubar is used in the native menubar and is not in the window of + its parent, if false the menubar remains in the window. On other platforms the value of this + attribute has no effect. + + The default is to follow whether the Qt::AA_DontUseNativeMenuBar attribute + is set for the application. Explicitly settings this property overrides + the presence (or abscence) of the attribute. +*/ + +void QMenuBar::setNativeMenuBar(bool nativeMenuBar) +{ + Q_D(QMenuBar); + if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) { + d->nativeMenuBar = nativeMenuBar; +#ifdef Q_WS_MAC + if (!d->nativeMenuBar) { + extern void qt_mac_clear_menubar(); + qt_mac_clear_menubar(); + d->macDestroyMenuBar(); + const QList<QAction *> &menubarActions = actions(); + for (int i = 0; i < menubarActions.size(); ++i) { + const QAction *action = menubarActions.at(i); + if (QMenu *menu = action->menu()) { + delete menu->d_func()->mac_menu; + menu->d_func()->mac_menu = 0; + } + } + } else { + d->macCreateMenuBar(parentWidget()); + } + macUpdateMenuBar(); + updateGeometry(); + setVisible(false); + setVisible(true); +#endif + } +} + +bool QMenuBar::isNativeMenuBar() const +{ + Q_D(const QMenuBar); + if (d->nativeMenuBar == -1) { + return !QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar); + } + return d->nativeMenuBar; +} + +/*! \since 4.4 Sets the default action to \a act. diff --git a/src/gui/widgets/qmenubar.h b/src/gui/widgets/qmenubar.h index 8e6dfb5..58a03ff 100644 --- a/src/gui/widgets/qmenubar.h +++ b/src/gui/widgets/qmenubar.h @@ -64,6 +64,7 @@ class Q_GUI_EXPORT QMenuBar : public QWidget Q_OBJECT Q_PROPERTY(bool defaultUp READ isDefaultUp WRITE setDefaultUp) + Q_PROPERTY(bool nativeMenuBar READ isNativeMenuBar WRITE setNativeMenuBar) public: explicit QMenuBar(QWidget *parent = 0); @@ -118,6 +119,9 @@ public: static void wceRefresh(); #endif + bool isNativeMenuBar() const; + void setNativeMenuBar(bool nativeMenuBar); + public Q_SLOTS: virtual void setVisible(bool visible); diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index c0bcb00..5dab310 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -70,7 +70,8 @@ class QMenuBarPrivate : public QWidgetPrivate Q_DECLARE_PUBLIC(QMenuBar) public: QMenuBarPrivate() : itemsDirty(0), itemsWidth(0), itemsStart(-1), currentAction(0), mouseDown(0), - closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0) + closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), + nativeMenuBar(-1) #ifdef Q_WS_MAC , mac_menubar(0) #endif @@ -119,6 +120,8 @@ public: uint keyboardState : 1, altPressed : 1; QPointer<QWidget> keyboardFocusWidget; + + int nativeMenuBar : 3; // Only has values -1, 0, and 1 //firing of events void activateAction(QAction *, QAction::ActionEvent); diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index a51ed2d..f317742 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -560,7 +560,8 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { if (!currentBlock.isValid()) return QRectF(); Q_ASSERT(currentBlock.blockNumber() == currentBlockNumber); - QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout()); + QTextDocument *doc = document(); + QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout()); Q_ASSERT(documentLayout); QPointF offset; @@ -571,13 +572,22 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const { offset.ry() += r.height(); currentBlock = currentBlock.next(); ++currentBlockNumber; + if (!currentBlock.isVisible()) { + currentBlock = doc->findBlockByLineNumber(currentBlock.firstLineNumber()); + currentBlockNumber = currentBlock.blockNumber(); + } r = documentLayout->blockBoundingRect(currentBlock); } while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) { currentBlock = currentBlock.previous(); + --currentBlockNumber; + while (!currentBlock.isVisible()) { + currentBlock = currentBlock.previous(); + --currentBlockNumber; + } if (!currentBlock.isValid()) break; - --currentBlockNumber; + r = documentLayout->blockBoundingRect(currentBlock); offset.ry() -= r.height(); } @@ -629,7 +639,7 @@ void QPlainTextEditPrivate::setTopBlock(int blockNumber, int lineNumber, int dx) if (viewport->updatesEnabled() && viewport->isVisible()) { int dy = 0; - if (doc->findBlockByLineNumber(control->topBlock).isValid()) { + if (doc->findBlockByNumber(control->topBlock).isValid()) { dy = (int)(-q->blockBoundingGeometry(block).y()) + verticalOffset() - verticalOffset(blockNumber, lineNumber); } diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 16334b8..d4e5122 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -98,29 +98,8 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QRectF paperRect(0,0, paperSize.width(), paperSize.height()); - painter->setClipRect(paperRect & option->exposedRect); - painter->fillRect(paperRect, Qt::white); - if (!pagePicture) - return; - painter->drawPicture(pageRect.topLeft(), *pagePicture); - - // Effect: make anything drawn in the margins look washed out. - QPainterPath path; - path.addRect(paperRect); - path.addRect(pageRect); - painter->setPen(QPen(Qt::NoPen)); - painter->setBrush(QColor(255, 255, 255, 180)); - painter->drawPath(path); - - painter->setClipRect(option->exposedRect); -#if 0 - // Draw frame around paper. - painter->setPen(QPen(Qt::black, 0)); - painter->setBrush(Qt::NoBrush); - painter->drawRect(paperRect); -#endif - // Draw shadow + painter->setClipRect(option->exposedRect); qreal shWidth = paperRect.width()/100; QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth), paperRect.bottomRight() + QPointF(shWidth, 0)); @@ -141,6 +120,27 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, cgrad.setColorAt(1.0, QColor(0,0,0,0)); painter->fillRect(cshadow, QBrush(cgrad)); + painter->setClipRect(paperRect & option->exposedRect); + painter->fillRect(paperRect, Qt::white); + if (!pagePicture) + return; + painter->drawPicture(pageRect.topLeft(), *pagePicture); + + // Effect: make anything drawn in the margins look washed out. + QPainterPath path; + path.addRect(paperRect); + path.addRect(pageRect); + painter->setPen(QPen(Qt::NoPen)); + painter->setBrush(QColor(255, 255, 255, 180)); + painter->drawPath(path); + +#if 0 + // Draw frame around paper. + painter->setPen(QPen(Qt::black, 0)); + painter->setBrush(Qt::NoBrush); + painter->drawRect(paperRect); +#endif + // todo: drawtext "Page N" below paper } diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 49de8c1..0b4ce9d 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -176,12 +176,11 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const if (tw->cornerWidget(Qt::TopRightCorner) || tw->cornerWidget(Qt::BottomRightCorner)) option->cornerWidgets |= QStyleOptionTab::RightCornerWidget; } +#endif QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this); - option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(), Qt::TextShowMnemonic); -#endif } /*! @@ -1085,7 +1084,7 @@ void QTabBar::setTabData(int index, const QVariant & data) } /*! - Returns the datad of the tab at position \a index, or a null + Returns the data of the tab at position \a index, or a null variant if \a index is out of range. */ QVariant QTabBar::tabData(int index) const @@ -2224,6 +2223,7 @@ void QTabBar::setTabButton(int index, ButtonPosition position, QWidget *widget) d->tabList[index].rightWidget = widget; } d->layoutTabs(); + d->refresh(); update(); } diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index fadccbc..d765794 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -274,9 +274,11 @@ void QToolBarPrivate::endDrag() bool QToolBarPrivate::mousePressEvent(QMouseEvent *event) { - if (layout->handleRect().contains(event->pos()) == false) { + Q_Q(QToolBar); + QStyleOptionToolBar opt; + q->initStyleOption(&opt); + if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) { #ifdef Q_WS_MAC - Q_Q(QToolBar); // When using the unified toolbar on Mac OS X the user can can click and // drag between toolbar contents to move the window. Make this work by // implementing the standard mouse-dragging code and then call @@ -1041,7 +1043,7 @@ void QToolBar::paintEvent(QPaintEvent *) style->drawControl(QStyle::CE_ToolBar, &opt, &p, this); } - opt.rect = d->layout->handleRect(); + opt.rect = style->subElementRect(QStyle::SE_ToolBarHandle, &opt, this); if (opt.rect.isValid()) style->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &opt, &p, this); } @@ -1142,7 +1144,9 @@ bool QToolBar::event(QEvent *event) case QEvent::HoverMove: { #ifndef QT_NO_CURSOR QHoverEvent *e = static_cast<QHoverEvent*>(event); - if (d->layout->handleRect().contains(e->pos())) + QStyleOptionToolBar opt; + initStyleOption(&opt); + if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos())) setCursor(Qt::SizeAllCursor); else unsetCursor(); diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index 7771f46..0bfa493 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -334,7 +334,7 @@ void QToolBarLayout::updateGeomArray() const if (QMainWindow *mw = qobject_cast<QMainWindow *>(parentWidget()->parentWidget())) { if (mw->unifiedTitleAndToolBarOnMac() && mw->toolBarArea(static_cast<QToolBar *>(parentWidget())) == Qt::TopToolBarArea) { - if (that->expandFlag) { + if (expandFlag) { tb->setMaximumSize(0xFFFFFF, 0xFFFFFF); } else { tb->setMaximumSize(hint); @@ -360,23 +360,11 @@ void QToolBarLayout::setGeometry(const QRect &rect) QStyle *style = tb->style(); QStyleOptionToolBar opt; tb->initStyleOption(&opt); - const int handleExtent = movable() - ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0; const int margin = this->margin(); const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb); Qt::Orientation o = tb->orientation(); QLayout::setGeometry(rect); - if (movable()) { - if (o == Qt::Horizontal) { - handRect = QRect(margin, margin, handleExtent, rect.height() - 2*margin); - handRect = QStyle::visualRect(parentWidget()->layoutDirection(), rect, handRect); - } else { - handRect = QRect(margin, margin, rect.width() - 2*margin, handleExtent); - } - } else { - handRect = QRect(); - } bool ranOutOfSpace = false; if (!animating) @@ -742,11 +730,6 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action) return result; } -QRect QToolBarLayout::handleRect() const -{ - return handRect; -} - QT_END_NAMESPACE #endif // QT_NO_TOOLBAR diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h index 2eca773..37755b1 100644 --- a/src/gui/widgets/qtoolbarlayout_p.h +++ b/src/gui/widgets/qtoolbarlayout_p.h @@ -65,7 +65,7 @@ class QAction; class QToolBarExtension; class QMenu; -class Q_GUI_EXPORT QToolBarItem : public QWidgetItem +class QToolBarItem : public QWidgetItem { public: QToolBarItem(QWidget *widget); @@ -75,7 +75,7 @@ public: bool customWidget; }; -class Q_GUI_EXPORT QToolBarLayout : public QLayout +class QToolBarLayout : public QLayout { Q_OBJECT @@ -100,8 +100,6 @@ public: int indexOf(QAction *action) const; int indexOf(QWidget *widget) const { return QLayout::indexOf(widget); } - QRect handleRect() const; - bool layoutActions(const QSize &size); QSize expandedSize(const QSize &size) const; bool expanded, animating; diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 5940fba..d4bf008 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qhttpnetworkconnection_p.h" +#include "private/qnoncontiguousbytedevice_p.h" #include <private/qnetworkrequest_p.h> #include <private/qobject_p.h> #include <private/qauthenticator_p.h> @@ -71,6 +72,7 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host #ifndef QT_NO_NETWORKPROXY , networkProxy(QNetworkProxy::NoProxy) #endif + { } @@ -205,12 +207,19 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // add missing fields for the request QByteArray value; // check if Content-Length is provided - QIODevice *data = request.data(); - if (data && request.contentLength() == -1) { - if (!data->isSequential()) - request.setContentLength(data->size()); - else - bufferData(messagePair); // ### or do chunked upload + QNonContiguousByteDevice* uploadByteDevice = request.uploadByteDevice(); + if (uploadByteDevice) { + if (request.contentLength() != -1 && uploadByteDevice->size() != -1) { + // both values known, take the smaller one. + request.setContentLength(qMin(uploadByteDevice->size(), request.contentLength())); + } else if (request.contentLength() == -1 && uploadByteDevice->size() != -1) { + // content length not supplied by user, but the upload device knows it + request.setContentLength(uploadByteDevice->size()); + } else if (request.contentLength() != -1 && uploadByteDevice->size() == -1) { + // everything OK, the user supplied us the contentLength + } else if (request.contentLength() == -1 && uploadByteDevice->size() == -1) { + qFatal("QHttpNetworkConnectionPrivate: Neither content-length nor upload device size were given"); + } } // set the Connection/Proxy-Connection: Keep-Alive headers #ifndef QT_NO_NETWORKPROXY @@ -361,18 +370,12 @@ bool QHttpNetworkConnectionPrivate::sendRequest(QAbstractSocket *socket) false); #endif socket->write(header); - QIODevice *data = channels[i].request.d->data; - QHttpNetworkReply *reply = channels[i].reply; - if (reply && reply->d_func()->requestDataBuffer.size()) - data = &channels[i].reply->d_func()->requestDataBuffer; - if (data && (data->isOpen() || data->open(QIODevice::ReadOnly))) { - if (data->isSequential()) { - channels[i].bytesTotal = -1; - QObject::connect(data, SIGNAL(readyRead()), q, SLOT(_q_dataReadyReadNoBuffer())); - QObject::connect(data, SIGNAL(readChannelFinished()), q, SLOT(_q_dataReadyReadNoBuffer())); - } else { - channels[i].bytesTotal = data->size(); - } + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + // connect the signals so this function gets called again + QObject::connect(uploadByteDevice, SIGNAL(readyRead()), q, SLOT(_q_uploadDataReadyRead())); + + channels[i].bytesTotal = channels[i].request.contentLength(); } else { channels[i].state = WaitingState; break; @@ -380,30 +383,81 @@ bool QHttpNetworkConnectionPrivate::sendRequest(QAbstractSocket *socket) // write the initial chunk together with the headers // fall through } - case WritingState: { // write the data - QIODevice *data = channels[i].request.d->data; - if (channels[i].reply->d_func()->requestDataBuffer.size()) - data = &channels[i].reply->d_func()->requestDataBuffer; - if (!data || channels[i].bytesTotal == channels[i].written) { + case WritingState: + { + // write the data + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (!uploadByteDevice || channels[i].bytesTotal == channels[i].written) { + if (uploadByteDevice) + emit channels[i].reply->dataSendProgress(channels[i].written, channels[i].bytesTotal); channels[i].state = WaitingState; // now wait for response + sendRequest(socket); break; } - QByteArray chunk; - chunk.resize(ChunkSize); - qint64 readSize = data->read(chunk.data(), ChunkSize); - if (readSize == -1) { - // source has reached EOF - channels[i].state = WaitingState; // now wait for response - } else if (readSize > 0) { - // source gave us something useful - channels[i].written += socket->write(chunk.data(), readSize); - if (channels[i].reply) - emit channels[i].reply->dataSendProgress(channels[i].written, channels[i].bytesTotal); + // only feed the QTcpSocket buffer when there is less than 32 kB in it + const qint64 socketBufferFill = 32*1024; + const qint64 socketWriteMaxSize = 16*1024; + + +#ifndef QT_NO_OPENSSL + QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket); + while ((sslSocket->encryptedBytesToWrite() + sslSocket->bytesToWrite()) <= socketBufferFill + && channels[i].bytesTotal != channels[i].written) +#else + while (socket->bytesToWrite() <= socketBufferFill + && channels[i].bytesTotal != channels[i].written) +#endif + { + // get pointer to upload data + qint64 currentReadSize; + qint64 desiredReadSize = qMin(socketWriteMaxSize, channels[i].bytesTotal - channels[i].written); + const char *readPointer = uploadByteDevice->readPointer(desiredReadSize, currentReadSize); + + if (currentReadSize == -1) { + // premature eof happened + emitReplyError(socket, channels[i].reply, QNetworkReply::UnknownNetworkError); + return false; + break; + } else if (readPointer == 0 || currentReadSize == 0) { + // nothing to read currently, break the loop + break; + } else { + qint64 currentWriteSize = socket->write(readPointer, currentReadSize); + if (currentWriteSize == -1 || currentWriteSize != currentReadSize) { + // socket broke down + emitReplyError(socket, channels[i].reply, QNetworkReply::UnknownNetworkError); + return false; + } else { + channels[i].written += currentWriteSize; + uploadByteDevice->advanceReadPointer(currentWriteSize); + + emit channels[i].reply->dataSendProgress(channels[i].written, channels[i].bytesTotal); + + if (channels[i].written == channels[i].bytesTotal) { + // make sure this function is called once again + channels[i].state = WaitingState; + sendRequest(socket); + break; + } + } + } } break; } + case WaitingState: + { + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + QObject::disconnect(uploadByteDevice, SIGNAL(readyRead()), q, SLOT(_q_uploadDataReadyRead())); + } + // ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called + // this is needed if the sends an reply before we have finished sending the request. In that + // case receiveReply had been called before but ignored the server reply + receiveReply(socket, channels[i].reply); + break; + } case ReadingState: case Wait4AuthState: // ignore _q_bytesWritten in these states @@ -479,6 +533,9 @@ bool QHttpNetworkConnectionPrivate::expand(QAbstractSocket *socket, QHttpNetwork // make sure that the reply is valid if (channels[i].reply != reply) return true; + // emit dataReadProgress signal (signal is currently not connected + // to the rest of QNAM) since readProgress of the + // QNonContiguousByteDevice is used emit reply->dataReadProgress(reply->d_func()->totalProgress, 0); // make sure that the reply is valid if (channels[i].reply != reply) @@ -529,10 +586,20 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState; switch (state) { case QHttpNetworkReplyPrivate::NothingDoneState: - case QHttpNetworkReplyPrivate::ReadingStatusState: - bytes += reply->d_func()->readStatus(socket); + case QHttpNetworkReplyPrivate::ReadingStatusState: { + qint64 statusBytes = reply->d_func()->readStatus(socket); + if (statusBytes == -1) { + // error reading the status, close the socket and emit error + socket->close(); + reply->d_func()->errorString = errorDetail(QNetworkReply::ProtocolFailure, socket); + emit reply->finishedWithError(QNetworkReply::ProtocolFailure, reply->d_func()->errorString); + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + break; + } + bytes += statusBytes; channels[i].lastStatus = reply->d_func()->statusCode; break; + } case QHttpNetworkReplyPrivate::ReadingHeaderState: bytes += reply->d_func()->readHeader(socket); if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) { @@ -569,6 +636,9 @@ void QHttpNetworkConnectionPrivate::receiveReply(QAbstractSocket *socket, QHttpN // make sure that the reply is valid if (channels[i].reply != reply) return; + // emit dataReadProgress signal (signal is currently not connected + // to the rest of QNAM) since readProgress of the + // QNonContiguousByteDevice is used emit reply->dataReadProgress(reply->d_func()->totalProgress, reply->d_func()->bodyLength); // make sure that the reply is valid if (channels[i].reply != reply) @@ -635,8 +705,25 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN case 407: handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend); if (resend) { + int i = indexOf(socket); + + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + if (uploadByteDevice->reset()) { + channels[i].written = 0; + } else { + emitReplyError(socket, reply, QNetworkReply::ContentReSendError); + break; + } + } + eraseData(reply); - sendRequest(socket); + + // also use async _q_startNextRequest so we dont break with closed + // proxy or server connections.. + channels[i].resendCurrent = true; + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + } break; default: @@ -970,6 +1057,7 @@ void QHttpNetworkConnectionPrivate::_q_bytesWritten(qint64 bytes) QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(q->sender()); if (!socket) return; // ### error + // bytes have been written to the socket. write even more of them :) if (isSocketWriting(socket)) sendRequest(socket); // otherwise we do nothing @@ -1128,80 +1216,21 @@ void QHttpNetworkConnectionPrivate::_q_proxyAuthenticationRequired(const QNetwor } #endif -void QHttpNetworkConnectionPrivate::_q_dataReadyReadNoBuffer() +void QHttpNetworkConnectionPrivate::_q_uploadDataReadyRead() { Q_Q(QHttpNetworkConnection); - // data emitted either readyRead() + // upload data emitted readyRead() // find out which channel it is for - QIODevice *sender = qobject_cast<QIODevice *>(q->sender()); + QObject *sender = q->sender(); - // won't match anything if the qobject_cast above failed for (int i = 0; i < channelCount; ++i) { - if (sender == channels[i].request.data()) { + if (sender == channels[i].request.uploadByteDevice()) { sendRequest(channels[i].socket); break; } } } -void QHttpNetworkConnectionPrivate::_q_dataReadyReadBuffer() -{ - Q_Q(QHttpNetworkConnection); - QIODevice *sender = qobject_cast<QIODevice *>(q->sender()); - HttpMessagePair *thePair = 0; - for (int i = 0; !thePair && i < lowPriorityQueue.size(); ++i) - if (lowPriorityQueue.at(i).first.data() == sender) - thePair = &lowPriorityQueue[i]; - - for (int i = 0; !thePair && i < highPriorityQueue.size(); ++i) - if (highPriorityQueue.at(i).first.data() == sender) - thePair = &highPriorityQueue[i]; - - if (thePair) { - bufferData(*thePair); - - // are we finished buffering? - if (!thePair->second->d_func()->requestIsBuffering) - _q_startNextRequest(); - } -} - -void QHttpNetworkConnectionPrivate::bufferData(HttpMessagePair &messagePair) -{ - Q_Q(QHttpNetworkConnection); - QHttpNetworkRequest &request = messagePair.first; - QHttpNetworkReply *reply = messagePair.second; - Q_ASSERT(request.data()); - if (!reply->d_func()->requestIsBuffering) { // first time - QObject::connect(request.data(), SIGNAL(readyRead()), q, SLOT(_q_dataReadyReadBuffer())); - QObject::connect(request.data(), SIGNAL(readChannelFinished()), q, SLOT(_q_dataReadyReadBuffer())); - reply->d_func()->requestIsBuffering = true; - reply->d_func()->requestDataBuffer.open(QIODevice::ReadWrite); - } - - // always try to read at least one byte - // ### FIXME! use a QRingBuffer - qint64 bytesToRead = qMax<qint64>(1, request.data()->bytesAvailable()); - QByteArray newData; - newData.resize(bytesToRead); - qint64 bytesActuallyRead = request.data()->read(newData.data(), bytesToRead); - - if (bytesActuallyRead > 0) { - // we read something - newData.chop(bytesToRead - bytesActuallyRead); - reply->d_func()->requestDataBuffer.write(newData); - } else if (bytesActuallyRead == -1) { // last time - QObject::disconnect(request.data(), SIGNAL(readyRead()), q, SLOT(_q_dataReadyReadBuffer())); - QObject::disconnect(request.data(), SIGNAL(readChannelFinished()), q, SLOT(_q_dataReadyReadBuffer())); - - request.setContentLength(reply->d_func()->requestDataBuffer.size()); - reply->d_func()->requestDataBuffer.seek(0); - reply->d_func()->requestIsBuffering = false; - } -} - -// QHttpNetworkConnection - QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QObject *parent) : QObject(*(new QHttpNetworkConnectionPrivate(hostName, port, encrypt)), parent) { diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 09bd459..9b127dd 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -146,8 +146,7 @@ private: #ifndef QT_NO_NETWORKPROXY Q_PRIVATE_SLOT(d_func(), void _q_proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)) #endif - Q_PRIVATE_SLOT(d_func(), void _q_dataReadyReadBuffer()) - Q_PRIVATE_SLOT(d_func(), void _q_dataReadyReadNoBuffer()) + Q_PRIVATE_SLOT(d_func(), void _q_uploadDataReadyRead()) #ifndef QT_NO_OPENSSL Q_PRIVATE_SLOT(d_func(), void _q_encrypted()) @@ -209,8 +208,8 @@ public: #ifndef QT_NO_NETWORKPROXY void _q_proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); // from transparent proxy #endif - void _q_dataReadyReadNoBuffer(); - void _q_dataReadyReadBuffer(); + + void _q_uploadDataReadyRead(); void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request); bool ensureConnection(QAbstractSocket *socket); @@ -219,7 +218,6 @@ public: #ifndef QT_NO_COMPRESS bool expand(QAbstractSocket *socket, QHttpNetworkReply *reply, bool dataComplete); #endif - void bufferData(HttpMessagePair &request); void removeReply(QHttpNetworkReply *reply); QString hostName; diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index fe3f6af..310994c 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -409,39 +409,62 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) if (fragment.endsWith('\r')) { fragment.truncate(fragment.length()-1); } - parseStatus(fragment); + bool ok = parseStatus(fragment); state = ReadingHeaderState; fragment.clear(); // next fragment + + if (!ok) + return -1; break; } else { c = 0; bytes += socket->read(&c, 1); fragment.append(c); } + + // is this a valid reply? + if (fragment.length() >= 5 && !fragment.startsWith("HTTP/")) + return -1; + } + return bytes; } -void QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) +bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) { - const QByteArrayMatcher sp(" "); - int i = sp.indexIn(status); - const QByteArray version = status.mid(0, i); - int j = sp.indexIn(status, i + 1); + // from RFC 2616: + // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF + // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT + // that makes: 'HTTP/n.n xxx Message' + // byte count: 0123456789012 + + static const int minLength = 11; + static const int dotPos = 6; + static const int spacePos = 8; + static const char httpMagic[] = "HTTP/"; + + if (status.length() < minLength + || !status.startsWith(httpMagic) + || status.at(dotPos) != '.' + || status.at(spacePos) != ' ') { + // I don't know how to parse this status line + return false; + } + + // optimize for the valid case: defer checking until the end + majorVersion = status.at(dotPos - 1) - '0'; + minorVersion = status.at(dotPos + 1) - '0'; + + int i = spacePos; + int j = status.indexOf(' ', i + 1); // j == -1 || at(j) == ' ' so j+1 == 0 && j+1 <= length() const QByteArray code = status.mid(i + 1, j - i - 1); - const QByteArray reason = status.mid(j + 1, status.count() - j); - const QByteArrayMatcher slash("/"); - int k = slash.indexIn(version); - const QByteArrayMatcher dot("."); - int l = dot.indexIn(version, k); - const QByteArray major = version.mid(k + 1, l - k - 1); - const QByteArray minor = version.mid(l + 1, version.count() - l); + bool ok; + statusCode = code.toInt(&ok); + reasonPhrase = QString::fromLatin1(status.constData() + j + 1); - majorVersion = QString::fromAscii(major.constData()).toInt(); - minorVersion = QString::fromAscii(minor.constData()).toInt(); - statusCode = QString::fromAscii(code.constData()).toInt(); - reasonPhrase = QString::fromAscii(reason.constData()); + return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9; } qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) @@ -521,13 +544,13 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *ou { qint64 bytes = 0; if (isChunked()) { - bytes += transferChunked(socket, out); // chunked transfer encoding (rfc 2616, sec 3.6) + bytes += readReplyBodyChunked(socket, out); // chunked transfer encoding (rfc 2616, sec 3.6) } else if (bodyLength > 0) { // we have a Content-Length - bytes += transferRaw(socket, out, bodyLength - contentRead); + bytes += readReplyBodyRaw(socket, out, bodyLength - contentRead); if (contentRead + bytes == bodyLength) state = AllDoneState; } else { - bytes += transferRaw(socket, out, socket->bytesAvailable()); + bytes += readReplyBodyRaw(socket, out, socket->bytesAvailable()); } if (state == AllDoneState) socket->readAll(); // Read the rest to clean (CRLF) @@ -535,7 +558,7 @@ qint64 QHttpNetworkReplyPrivate::readBody(QAbstractSocket *socket, QIODevice *ou return bytes; } -qint64 QHttpNetworkReplyPrivate::transferRaw(QIODevice *in, QIODevice *out, qint64 size) +qint64 QHttpNetworkReplyPrivate::readReplyBodyRaw(QIODevice *in, QIODevice *out, qint64 size) { qint64 bytes = 0; Q_ASSERT(in); @@ -561,7 +584,7 @@ qint64 QHttpNetworkReplyPrivate::transferRaw(QIODevice *in, QIODevice *out, qint } -qint64 QHttpNetworkReplyPrivate::transferChunked(QIODevice *in, QIODevice *out) +qint64 QHttpNetworkReplyPrivate::readReplyBodyChunked(QIODevice *in, QIODevice *out) { qint64 bytes = 0; while (in->bytesAvailable()) { // while we can read from input @@ -660,4 +683,4 @@ void QHttpNetworkReply::ignoreSslErrors() QT_END_NAMESPACE -#endif // QT_NO_HTTP
\ No newline at end of file +#endif // QT_NO_HTTP diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index c17c65c..cc5cce8 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -139,7 +139,7 @@ Q_SIGNALS: void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); void headerChanged(); void dataReadProgress(int done, int total); - void dataSendProgress(int done, int total); + void dataSendProgress(qint64 done, qint64 total); private: Q_DECLARE_PRIVATE(QHttpNetworkReply) @@ -154,7 +154,7 @@ public: QHttpNetworkReplyPrivate(const QUrl &newUrl = QUrl()); ~QHttpNetworkReplyPrivate(); qint64 readStatus(QAbstractSocket *socket); - void parseStatus(const QByteArray &status); + bool parseStatus(const QByteArray &status); qint64 readHeader(QAbstractSocket *socket); void parseHeader(const QByteArray &header); qint64 readBody(QAbstractSocket *socket, QIODevice *out); @@ -162,8 +162,8 @@ public: QAuthenticatorPrivate::Method authenticationMethod(bool isProxy) const; void clear(); - qint64 transferRaw(QIODevice *in, QIODevice *out, qint64 size); - qint64 transferChunked(QIODevice *in, QIODevice *out); + qint64 readReplyBodyRaw(QIODevice *in, QIODevice *out, qint64 size); + qint64 readReplyBodyChunked(QIODevice *in, QIODevice *out); qint64 getChunkSize(QIODevice *in, qint64 *chunkSize); qint64 bytesAvailable() const; @@ -206,7 +206,6 @@ public: QByteArray responseData; // uncompressed body QByteArray compressedData; // compressed body (temporary) - QBuffer requestDataBuffer; bool requestIsBuffering; bool requestIsPrepared; }; diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 420cb69..7df68fc 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -40,12 +40,13 @@ ****************************************************************************/ #include "qhttpnetworkrequest_p.h" +#include "private/qnoncontiguousbytedevice_p.h" QT_BEGIN_NAMESPACE QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op, QHttpNetworkRequest::Priority pri, const QUrl &newUrl) - : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), data(0), + : QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0), autoDecompress(false) { } @@ -55,7 +56,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest { operation = other.operation; priority = other.priority; - data = other.data; + uploadByteDevice = other.uploadByteDevice; autoDecompress = other.autoDecompress; } @@ -67,7 +68,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot { return QHttpNetworkHeaderPrivate::operator==(other) && (operation == other.operation) - && (data == other.data); + && (uploadByteDevice == other.uploadByteDevice); } QByteArray QHttpNetworkRequestPrivate::methodName() const @@ -109,7 +110,7 @@ QByteArray QHttpNetworkRequestPrivate::uri(bool throughProxy) const QUrl::FormattingOptions format(QUrl::RemoveFragment); // for POST, query data is send as content - if (operation == QHttpNetworkRequest::Post && !data) + if (operation == QHttpNetworkRequest::Post && !uploadByteDevice) format |= QUrl::RemoveQuery; // for requests through proxy, the Request-URI contains full url if (throughProxy) @@ -140,7 +141,7 @@ QByteArray QHttpNetworkRequestPrivate::header(const QHttpNetworkRequest &request // add content type, if not set in the request if (request.headerField("content-type").isEmpty()) ba += "Content-Type: application/x-www-form-urlencoded\r\n"; - if (!request.d->data && request.d->url.hasQuery()) { + if (!request.d->uploadByteDevice && request.d->url.hasQuery()) { QByteArray query = request.d->url.encodedQuery(); ba += "Content-Length: "+ QByteArray::number(query.size()) + "\r\n"; ba += "\r\n"; @@ -236,14 +237,14 @@ void QHttpNetworkRequest::setPriority(Priority priority) d->priority = priority; } -QIODevice *QHttpNetworkRequest::data() const +void QHttpNetworkRequest::setUploadByteDevice(QNonContiguousByteDevice *bd) { - return d->data; + d->uploadByteDevice = bd; } -void QHttpNetworkRequest::setData(QIODevice *data) +QNonContiguousByteDevice* QHttpNetworkRequest::uploadByteDevice() const { - d->data = data; + return d->uploadByteDevice; } int QHttpNetworkRequest::majorVersion() const diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h index d18e116..ed4325a 100644 --- a/src/network/access/qhttpnetworkrequest_p.h +++ b/src/network/access/qhttpnetworkrequest_p.h @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE +class QNonContiguousByteDevice; + class QHttpNetworkRequestPrivate; class Q_AUTOTEST_EXPORT QHttpNetworkRequest: public QHttpNetworkHeader { @@ -104,8 +106,8 @@ public: Priority priority() const; void setPriority(Priority priority); - QIODevice *data() const; - void setData(QIODevice *data); + void setUploadByteDevice(QNonContiguousByteDevice *bd); + QNonContiguousByteDevice* uploadByteDevice() const; private: QSharedDataPointer<QHttpNetworkRequestPrivate> d; @@ -113,7 +115,6 @@ private: friend class QHttpNetworkConnectionPrivate; }; - class QHttpNetworkRequestPrivate : public QHttpNetworkHeaderPrivate { public: @@ -129,7 +130,7 @@ public: QHttpNetworkRequest::Operation operation; QHttpNetworkRequest::Priority priority; - mutable QIODevice *data; + mutable QNonContiguousByteDevice* uploadByteDevice; bool autoDecompress; }; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index df468b8..b9d1b85 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -50,6 +50,8 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" +#include "private/qnoncontiguousbytedevice_p.h" + QT_BEGIN_NAMESPACE static bool factoryDataShutdown = false; @@ -109,17 +111,43 @@ QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessM return 0; } -QNetworkAccessBackend::QNetworkAccessBackend() + +QNonContiguousByteDevice* QNetworkAccessBackend::createUploadByteDevice() { + QNonContiguousByteDevice* device = 0; + + if (reply->outgoingDataBuffer) + device = QNonContiguousByteDeviceFactory::create(reply->outgoingDataBuffer); + else + device = QNonContiguousByteDeviceFactory::create(reply->outgoingData); + + bool bufferDisallowed = + reply->request.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, + QVariant(false)) == QVariant(true); + if (bufferDisallowed) + device->disableReset(); + + // make sure we delete this later + device->setParent(this); + + connect(device, SIGNAL(readProgress(qint64,qint64)), this, SLOT(emitReplyUploadProgress(qint64,qint64))); + + return device; } -QNetworkAccessBackend::~QNetworkAccessBackend() +// need to have this function since the reply is a private member variable +// and the special backends need to access this. +void QNetworkAccessBackend::emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal) { + reply->emitUploadProgress(bytesSent, bytesTotal); } -void QNetworkAccessBackend::upstreamReadyRead() +QNetworkAccessBackend::QNetworkAccessBackend() +{ +} + +QNetworkAccessBackend::~QNetworkAccessBackend() { - // do nothing } void QNetworkAccessBackend::downstreamReadyWrite() @@ -184,23 +212,6 @@ bool QNetworkAccessBackend::isCachingEnabled() const return reply->isCachingEnabled(); } -qint64 QNetworkAccessBackend::upstreamBytesAvailable() const -{ - return reply->writeBuffer.size(); -} - -void QNetworkAccessBackend::upstreamBytesConsumed(qint64 count) -{ - // remove count bytes from the write buffer - reply->consume(count); -} - -QByteArray QNetworkAccessBackend::readUpstream() -{ - // ### this is expensive. Consider making QRingBuffer::peekAll keep the buffer it returns - return reply->writeBuffer.peek(upstreamBytesAvailable()); -} - qint64 QNetworkAccessBackend::nextDownstreamBlockSize() const { return reply->nextDownstreamBlockSize(); @@ -213,12 +224,12 @@ qint64 QNetworkAccessBackend::downstreamBytesToConsume() const void QNetworkAccessBackend::writeDownstreamData(const QByteArray &data) { - reply->feed(data); + reply->appendDownstreamData(data); } void QNetworkAccessBackend::writeDownstreamData(QIODevice *data) { - reply->feed(data); + reply->appendDownstreamData(data); } QVariant QNetworkAccessBackend::header(QNetworkRequest::KnownHeaders header) const diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 9012396..6035f3a 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -70,6 +70,8 @@ class QNetworkAccessManagerPrivate; class QNetworkReplyImplPrivate; class QAbstractNetworkCache; class QNetworkCacheMetaData; +class QNetworkAccessBackendUploadIODevice; +class QNonContiguousByteDevice; // Should support direct file upload from disk or download to disk. // @@ -86,14 +88,13 @@ public: // have different names. The Connection has two streams: // // - Upstream: - // Upstream is data that is being written into this connection, - // from the user. Upstream operates in a "pull" mechanism: the - // connection will be notified that there is more data available - // by a call to "upstreamReadyRead". The number of bytes - // available is given by upstreamBytesAvailable(). A call to - // readUpstream() always yields the entire upstream buffer. When - // the connection has processed a certain amount of bytes from - // that buffer, it should call upstreamBytesConsumed(). + // The upstream uses a QNonContiguousByteDevice provided + // by the backend. This device emits the usual readyRead() + // signal when the backend has data available for the connection + // to write. The different backends can listen on this signal + // and then pull upload data from the QNonContiguousByteDevice and + // deal with it. + // // // - Downstream: // Downstream is the data that is being read from this @@ -111,12 +112,9 @@ public: virtual void open() = 0; virtual void closeDownstreamChannel() = 0; - virtual void closeUpstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; - virtual bool waitForUpstreamBytesWritten(int msecs) = 0; // slot-like: - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); virtual void copyFinished(QIODevice *); virtual void ignoreSslErrors(); @@ -155,18 +153,24 @@ public: QVariant attribute(QNetworkRequest::Attribute code) const; void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); + // return true if the QNonContiguousByteDevice of the upload + // data needs to support reset(). Currently needed for HTTP. + // This will possibly enable buffering of the upload data. + virtual bool needsResetableUploadData() {return false;}; + protected: - // these functions control the upstream mechanism - // that is, data coming into the backend and out via the connection - qint64 upstreamBytesAvailable() const; - void upstreamBytesConsumed(qint64 count); - QByteArray readUpstream(); + // Create the device used for reading the upload data + QNonContiguousByteDevice* createUploadByteDevice(); + // these functions control the downstream mechanism // that is, data that has come via the connection and is going out the backend qint64 nextDownstreamBlockSize() const; qint64 downstreamBytesToConsume() const; void writeDownstreamData(const QByteArray &data); + +public slots: + // for task 251801, needs to be a slot to be called asynchronously void writeDownstreamData(QIODevice *data); protected slots: @@ -179,10 +183,12 @@ protected slots: void metaDataChanged(); void redirectionRequested(const QUrl &destination); void sslErrors(const QList<QSslError> &errors); + void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; + friend class QNetworkAccessBackendUploadIODevice; QNetworkAccessManagerPrivate *manager; QNetworkReplyImplPrivate *reply; }; diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 2e5f1b1..d4bda9a 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -41,6 +41,8 @@ #include "qnetworkaccessdebugpipebackend_p.h" #include "QtCore/qdatastream.h" +#include <QCoreApplication> +#include "private/qnoncontiguousbytedevice_p.h" QT_BEGIN_NAMESPACE @@ -51,12 +53,6 @@ enum { WriteBufferSize = ReadBufferSize }; -struct QNetworkAccessDebugPipeBackend::DataPacket -{ - QList<QPair<QByteArray, QByteArray> > headers; - QByteArray data; -}; - QNetworkAccessBackend * QNetworkAccessDebugPipeBackendFactory::create(QNetworkAccessManager::Operation op, const QNetworkRequest &request) const @@ -79,12 +75,14 @@ QNetworkAccessDebugPipeBackendFactory::create(QNetworkAccessManager::Operation o } QNetworkAccessDebugPipeBackend::QNetworkAccessDebugPipeBackend() - : incomingPacketSize(0), bareProtocol(false) + : bareProtocol(false), hasUploadFinished(false), hasDownloadFinished(false), + hasEverythingFinished(false), bytesDownloaded(0), bytesUploaded(0) { } QNetworkAccessDebugPipeBackend::~QNetworkAccessDebugPipeBackend() { + // this is signals disconnect, not network! socket.disconnect(this); // we're not interested in the signals at this point } @@ -92,160 +90,150 @@ void QNetworkAccessDebugPipeBackend::open() { socket.connectToHost(url().host(), url().port(12345)); socket.setReadBufferSize(ReadBufferSize); + + // socket ready read -> we can push from socket to downstream connect(&socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); - connect(&socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64))); connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError())); connect(&socket, SIGNAL(disconnected()), SLOT(socketDisconnected())); + connect(&socket, SIGNAL(connected()), SLOT(socketConnected())); + // socket bytes written -> we can push more from upstream to socket + connect(&socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64))); bareProtocol = url().queryItemValue(QLatin1String("bare")) == QLatin1String("1"); - if (!bareProtocol) { - // "Handshake": - // send outgoing metadata and the URL being requested - DataPacket packet; - //packet.metaData = request().metaData(); - packet.data = url().toEncoded(); - send(packet); + if (operation() == QNetworkAccessManager::PutOperation) { + uploadByteDevice = createUploadByteDevice(); + QObject::connect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(uploadReadyReadSlot())); + QMetaObject::invokeMethod(this, "uploadReadyReadSlot", Qt::QueuedConnection); } } -void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() +void QNetworkAccessDebugPipeBackend::socketReadyRead() { - if (operation() == QNetworkAccessManager::GetOperation) - socket.disconnectFromHost(); + pushFromSocketToDownstream(); } -void QNetworkAccessDebugPipeBackend::closeUpstreamChannel() +void QNetworkAccessDebugPipeBackend::downstreamReadyWrite() { - if (operation() == QNetworkAccessManager::PutOperation) - socket.disconnectFromHost(); - else if (operation() == QNetworkAccessManager::PostOperation) { - send(DataPacket()); - } + pushFromSocketToDownstream(); } -bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) +void QNetworkAccessDebugPipeBackend::socketBytesWritten(qint64) { - readyReadEmitted = false; - if (socket.bytesAvailable()) { - socketReadyRead(); - if (readyReadEmitted) - return true; - } - socket.waitForReadyRead(ms); - return readyReadEmitted; + pushFromUpstreamToSocket(); } -bool QNetworkAccessDebugPipeBackend::waitForUpstreamBytesWritten(int ms) +void QNetworkAccessDebugPipeBackend::uploadReadyReadSlot() { - bytesWrittenEmitted = false; - upstreamReadyRead(); - if (bytesWrittenEmitted) - return true; - - socket.waitForBytesWritten(ms); - return bytesWrittenEmitted; + pushFromUpstreamToSocket(); } -void QNetworkAccessDebugPipeBackend::upstreamReadyRead() +void QNetworkAccessDebugPipeBackend::pushFromSocketToDownstream() { - int maxWrite = WriteBufferSize - socket.bytesToWrite(); - if (maxWrite <= 0) - return; // can't write yet, wait for the socket to write - - if (bareProtocol) { - QByteArray data = readUpstream(); - if (data.isEmpty()) - return; + QByteArray buffer; - socket.write(data); - upstreamBytesConsumed(data.size()); - bytesWrittenEmitted = true; + if (socket.state() == QAbstractSocket::ConnectingState) { return; } - DataPacket packet; - packet.data = readUpstream(); - if (packet.data.isEmpty()) - return; // we'll be called again when there's data - if (packet.data.size() > maxWrite) - packet.data.truncate(maxWrite); - - if (!send(packet)) { - QString msg = QObject::tr("Write error writing to %1: %2") - .arg(url().toString(), socket.errorString()); - error(QNetworkReply::ProtocolFailure, msg); + forever { + if (hasDownloadFinished) + return; - finished(); - return; + buffer.resize(ReadBufferSize); + qint64 haveRead = socket.read(buffer.data(), ReadBufferSize); + + if (haveRead == -1) { + hasDownloadFinished = true; + // this ensures a good last downloadProgress is emitted + setHeader(QNetworkRequest::ContentLengthHeader, QVariant()); + possiblyFinish(); + break; + } else if (haveRead == 0) { + break; + } else { + // have read something + buffer.resize(haveRead); + bytesDownloaded += haveRead; + writeDownstreamData(buffer); + } } - upstreamBytesConsumed(packet.data.size()); - bytesWrittenEmitted = true; } -void QNetworkAccessDebugPipeBackend::downstreamReadyWrite() +void QNetworkAccessDebugPipeBackend::pushFromUpstreamToSocket() { - socketReadyRead(); -} + // FIXME + if (operation() == QNetworkAccessManager::PutOperation) { + if (hasUploadFinished) + return; -void QNetworkAccessDebugPipeBackend::socketReadyRead() -{ - if (bareProtocol) { - qint64 bytesToRead = socket.bytesAvailable(); - if (bytesToRead) { - QByteArray buffer; - buffer.resize(bytesToRead); - qint64 bytesRead = socket.read(buffer.data(), bytesToRead); - if (bytesRead < bytesToRead) - buffer.truncate(bytesRead); - writeDownstreamData(buffer); - readyReadEmitted = true; + forever { + if (socket.bytesToWrite() >= WriteBufferSize) + return; + + qint64 haveRead; + const char *readPointer = uploadByteDevice->readPointer(WriteBufferSize, haveRead); + if (haveRead == -1) { + // EOF + hasUploadFinished = true; + emitReplyUploadProgress(bytesUploaded, bytesUploaded); + possiblyFinish(); + break; + } else if (haveRead == 0 || readPointer == 0) { + // nothing to read right now, we will be called again later + break; + } else { + qint64 haveWritten; + haveWritten = socket.write(readPointer, haveRead); + + if (haveWritten < 0) { + // write error! + QString msg = QCoreApplication::translate("QNetworkAccessDebugPipeBackend", "Write error writing to %1: %2") + .arg(url().toString(), socket.errorString()); + error(QNetworkReply::ProtocolFailure, msg); + finished(); + return; + } else { + uploadByteDevice->advanceReadPointer(haveWritten); + bytesUploaded += haveWritten; + emitReplyUploadProgress(bytesUploaded, -1); + } + + //QCoreApplication::processEvents(); + + } } - return; } +} - while (canReceive() && - (socket.state() == QAbstractSocket::UnconnectedState || nextDownstreamBlockSize())) { - DataPacket packet; - if (receive(packet)) { - if (!packet.headers.isEmpty()) { - QList<QPair<QByteArray, QByteArray> >::ConstIterator - it = packet.headers.constBegin(), - end = packet.headers.constEnd(); - for ( ; it != end; ++it) - setRawHeader(it->first, it->second); - metaDataChanged(); - } +void QNetworkAccessDebugPipeBackend::possiblyFinish() +{ + if (hasEverythingFinished) + return; + hasEverythingFinished = true; - if (!packet.data.isEmpty()) { - writeDownstreamData(packet.data); - readyReadEmitted = true; - } + if ((operation() == QNetworkAccessManager::GetOperation) && hasDownloadFinished) { + socket.close(); + finished(); + } else if ((operation() == QNetworkAccessManager::PutOperation) && hasUploadFinished) { + socket.close(); + finished(); + } - if (packet.headers.isEmpty() && packet.data.isEmpty()) { - // it's an eof - socket.close(); - readyReadEmitted = true; - } - } else { - // got an error - QString msg = QObject::tr("Read error reading from %1: %2") - .arg(url().toString(), socket.errorString()); - error(QNetworkReply::ProtocolFailure, msg); - finished(); - return; - } - } } -void QNetworkAccessDebugPipeBackend::socketBytesWritten(qint64) +void QNetworkAccessDebugPipeBackend::closeDownstreamChannel() { - upstreamReadyRead(); + qWarning() << "QNetworkAccessDebugPipeBackend::closeDownstreamChannel()" << operation(); + //if (operation() == QNetworkAccessManager::GetOperation) + // socket.disconnectFromHost(); } + void QNetworkAccessDebugPipeBackend::socketError() { + qWarning() << "QNetworkAccessDebugPipeBackend::socketError()" << socket.error(); QNetworkReply::NetworkError code; switch (socket.error()) { case QAbstractSocket::RemoteHostClosedError: @@ -269,76 +257,27 @@ void QNetworkAccessDebugPipeBackend::socketError() void QNetworkAccessDebugPipeBackend::socketDisconnected() { - socketReadyRead(); - if (incomingPacketSize == 0 && socket.bytesToWrite() == 0) { + pushFromSocketToDownstream(); + + if (socket.bytesToWrite() == 0) { // normal close - finished(); } else { // abnormal close QString msg = QObject::tr("Remote host closed the connection prematurely on %1") .arg(url().toString()); error(QNetworkReply::RemoteHostClosedError, msg); - finished(); } } -bool QNetworkAccessDebugPipeBackend::send(const DataPacket &packet) -{ - QByteArray ba; - { - QDataStream stream(&ba, QIODevice::WriteOnly); - stream.setVersion(QDataStream::Qt_4_4); - - stream << packet.headers << packet.data; - } - - qint32 outgoingPacketSize = ba.size(); - qint64 written = socket.write((const char*)&outgoingPacketSize, sizeof outgoingPacketSize); - written += socket.write(ba); - return quint64(written) == (outgoingPacketSize + sizeof outgoingPacketSize); -} - -bool QNetworkAccessDebugPipeBackend::receive(DataPacket &packet) +void QNetworkAccessDebugPipeBackend::socketConnected() { - if (!canReceive()) - return false; - - // canReceive() does the setting up for us - Q_ASSERT(socket.bytesAvailable() >= incomingPacketSize); - QByteArray incomingPacket = socket.read(incomingPacketSize); - QDataStream stream(&incomingPacket, QIODevice::ReadOnly); - stream.setVersion(QDataStream::Qt_4_4); - stream >> packet.headers >> packet.data; - - // reset for next packet: - incomingPacketSize = 0; - socket.setReadBufferSize(ReadBufferSize); - return true; } -bool QNetworkAccessDebugPipeBackend::canReceive() +bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) { - if (incomingPacketSize == 0) { - // read the packet size - if (quint64(socket.bytesAvailable()) >= sizeof incomingPacketSize) - socket.read((char*)&incomingPacketSize, sizeof incomingPacketSize); - else - return false; - } - - if (incomingPacketSize == 0) { - QString msg = QObject::tr("Protocol error: packet of size 0 received"); - error(QNetworkReply::ProtocolFailure, msg); - finished(); - - socket.blockSignals(true); - socket.abort(); - socket.blockSignals(false); - return false; - } - - return socket.bytesAvailable() >= incomingPacketSize; + qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()"); + return false; } #endif diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h index 73a35cf..a13edc4 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend_p.h +++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h @@ -66,35 +66,38 @@ class QNetworkAccessDebugPipeBackend: public QNetworkAccessBackend { Q_OBJECT public: - struct DataPacket; QNetworkAccessDebugPipeBackend(); virtual ~QNetworkAccessDebugPipeBackend(); virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); +protected: + void pushFromSocketToDownstream(); + void pushFromUpstreamToSocket(); + void possiblyFinish(); + QNonContiguousByteDevice *uploadByteDevice; + private slots: + void uploadReadyReadSlot(); void socketReadyRead(); void socketBytesWritten(qint64 bytes); void socketError(); void socketDisconnected(); + void socketConnected(); private: QTcpSocket socket; - qint32 incomingPacketSize; - bool readyReadEmitted; - bool bytesWrittenEmitted; bool bareProtocol; + bool hasUploadFinished; + bool hasDownloadFinished; + bool hasEverythingFinished; - bool send(const DataPacket &packet); - bool canReceive(); - bool receive(DataPacket &packet); + qint64 bytesDownloaded; + qint64 bytesUploaded; }; class QNetworkAccessDebugPipeBackendFactory: public QNetworkAccessBackendFactory diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 8a5a665..6374fde 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -43,6 +43,7 @@ #include "qfileinfo.h" #include "qurlinfo.h" #include "qdir.h" +#include "private/qnoncontiguousbytedevice_p.h" #include <QtCore/QCoreApplication> @@ -77,7 +78,7 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op, } QNetworkAccessFileBackend::QNetworkAccessFileBackend() - : totalBytes(0) + : uploadByteDevice(0), totalBytes(0), hasUploadFinished(false) { } @@ -126,6 +127,9 @@ void QNetworkAccessFileBackend::open() break; case QNetworkAccessManager::PutOperation: mode = QIODevice::WriteOnly | QIODevice::Truncate; + uploadByteDevice = createUploadByteDevice(); + QObject::connect(uploadByteDevice, SIGNAL(readyRead()), this, SLOT(uploadReadyReadSlot())); + QMetaObject::invokeMethod(this, "uploadReadyReadSlot", Qt::QueuedConnection); break; default: Q_ASSERT_X(false, "QNetworkAccessFileBackend::open", @@ -152,19 +156,50 @@ void QNetworkAccessFileBackend::open() } } -void QNetworkAccessFileBackend::closeDownstreamChannel() +void QNetworkAccessFileBackend::uploadReadyReadSlot() { - if (operation() == QNetworkAccessManager::GetOperation) { - file.close(); - //downstreamChannelClosed(); + if (hasUploadFinished) + return; + + forever { + qint64 haveRead; + const char *readPointer = uploadByteDevice->readPointer(-1, haveRead); + if (haveRead == -1) { + // EOF + hasUploadFinished = true; + file.flush(); + file.close(); + finished(); + break; + } else if (haveRead == 0 || readPointer == 0) { + // nothing to read right now, we will be called again later + break; + } else { + qint64 haveWritten; + haveWritten = file.write(readPointer, haveRead); + + if (haveWritten < 0) { + // write error! + QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Write error writing to %1: %2") + .arg(url().toString(), file.errorString()); + error(QNetworkReply::ProtocolFailure, msg); + + finished(); + return; + } else { + uploadByteDevice->advanceReadPointer(haveWritten); + } + + + file.flush(); + } } } -void QNetworkAccessFileBackend::closeUpstreamChannel() +void QNetworkAccessFileBackend::closeDownstreamChannel() { - if (operation() == QNetworkAccessManager::PutOperation) { + if (operation() == QNetworkAccessManager::GetOperation) { file.close(); - finished(); } } @@ -174,40 +209,6 @@ bool QNetworkAccessFileBackend::waitForDownstreamReadyRead(int) return readMoreFromFile(); } -bool QNetworkAccessFileBackend::waitForUpstreamBytesWritten(int) -{ - Q_ASSERT_X(false, "QNetworkAccessFileBackend::waitForUpstreamBytesWritten", - "This function should never have been called, since there is never anything " - "left to be written!"); - return false; -} - -void QNetworkAccessFileBackend::upstreamReadyRead() -{ - Q_ASSERT_X(operation() == QNetworkAccessManager::PutOperation, "QNetworkAccessFileBackend", - "We're being told to upload data but operation isn't PUT!"); - - // there's more data to be written to the file - while (upstreamBytesAvailable()) { - // write everything and let QFile handle it - int written = file.write(readUpstream()); - - if (written < 0) { - // write error! - QString msg = QCoreApplication::translate("QNetworkAccessFileBackend", "Write error writing to %1: %2") - .arg(url().toString(), file.errorString()); - error(QNetworkReply::ProtocolFailure, msg); - - finished(); - return; - } - - // successful write - file.flush(); - upstreamBytesConsumed(written); - } -} - void QNetworkAccessFileBackend::downstreamReadyWrite() { Q_ASSERT_X(operation() == QNetworkAccessManager::GetOperation, "QNetworkAccessFileBackend", diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h index ce7d351..4615c5f 100644 --- a/src/network/access/qnetworkaccessfilebackend_p.h +++ b/src/network/access/qnetworkaccessfilebackend_p.h @@ -62,22 +62,25 @@ QT_BEGIN_NAMESPACE class QNetworkAccessFileBackend: public QNetworkAccessBackend { + Q_OBJECT public: QNetworkAccessFileBackend(); virtual ~QNetworkAccessFileBackend(); virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); +public slots: + void uploadReadyReadSlot(); +protected: + QNonContiguousByteDevice *uploadByteDevice; private: QFile file; qint64 totalBytes; + bool hasUploadFinished; bool loadFileInfo(); bool readMoreFromFile(); diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index ea39dec..ad55b85 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -42,6 +42,7 @@ #include "qnetworkaccessftpbackend_p.h" #include "qnetworkaccessmanager_p.h" #include "QtNetwork/qauthenticator.h" +#include "private/qnoncontiguousbytedevice_p.h" #ifndef QT_NO_FTP @@ -81,41 +82,6 @@ QNetworkAccessFtpBackendFactory::create(QNetworkAccessManager::Operation op, return 0; } -class QNetworkAccessFtpIODevice: public QIODevice -{ - //Q_OBJECT -public: - QNetworkAccessFtpBackend *backend; - bool eof; - - inline QNetworkAccessFtpIODevice(QNetworkAccessFtpBackend *parent) - : QIODevice(parent), backend(parent), eof(false) - { open(ReadOnly); } - - bool isSequential() const { return true; } - bool atEnd() const { return backend->upstreamBytesAvailable() == 0; } - - qint64 bytesAvailable() const { return backend->upstreamBytesAvailable(); } - qint64 bytesToWrite() const { return backend->downstreamBytesToConsume(); } -protected: - qint64 readData(char *data, qint64 maxlen) - { - const QByteArray toSend = backend->readUpstream(); - maxlen = qMin<qint64>(maxlen, toSend.size()); - if (!maxlen) - return eof ? -1 : 0; - - backend->upstreamBytesConsumed(maxlen); - memcpy(data, toSend.constData(), maxlen); - return maxlen; - } - - qint64 writeData(const char *, qint64) - { return -1; } - - friend class QNetworkAccessFtpBackend; -}; - class QNetworkAccessFtpFtp: public QFtp, public QNetworkAccessCache::CacheableObject { // Q_OBJECT @@ -198,7 +164,11 @@ void QNetworkAccessFtpBackend::open() ftpConnectionReady(ftp); } - uploadDevice = new QNetworkAccessFtpIODevice(this); + // Put operation + if (operation() == QNetworkAccessManager::PutOperation) { + uploadDevice = QNonContiguousByteDeviceFactory::wrap(createUploadByteDevice()); + uploadDevice->setParent(this); + } } void QNetworkAccessFtpBackend::closeDownstreamChannel() @@ -212,16 +182,6 @@ void QNetworkAccessFtpBackend::closeDownstreamChannel() #endif } -void QNetworkAccessFtpBackend::closeUpstreamChannel() -{ - if (operation() == QNetworkAccessManager::PutOperation) { - Q_ASSERT(uploadDevice); - uploadDevice->eof = true; - if (!upstreamBytesAvailable()) - emit uploadDevice->readyRead(); - } -} - bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) { if (!ftp) @@ -239,18 +199,6 @@ bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) return false; } -bool QNetworkAccessFtpBackend::waitForUpstreamBytesWritten(int ms) -{ - Q_UNUSED(ms); - qCritical("QNetworkAccess: FTP backend does not support waitForBytesWritten()"); - return false; -} - -void QNetworkAccessFtpBackend::upstreamReadyRead() -{ - // uh... how does QFtp operate? -} - void QNetworkAccessFtpBackend::downstreamReadyWrite() { if (state == Transferring && ftp && ftp->bytesAvailable()) diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index 9ec2dd8..1bb7ff2 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -87,11 +87,8 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); void disconnectFromFtp(); @@ -105,7 +102,7 @@ public slots: private: friend class QNetworkAccessFtpIODevice; QPointer<QNetworkAccessFtpFtp> ftp; - QNetworkAccessFtpIODevice *uploadDevice; + QIODevice *uploadDevice; qint64 totalBytes; int helpId, sizeId, mdtmId; bool supportsSize, supportsMdtm; diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index a52b5a0..7d0438e 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -286,37 +286,6 @@ public: } }; -class QNetworkAccessHttpBackendIODevice: public QIODevice -{ - // Q_OBJECT -public: - bool eof; - QNetworkAccessHttpBackendIODevice(QNetworkAccessHttpBackend *parent) - : QIODevice(parent), eof(false) - { - setOpenMode(ReadOnly); - } - bool isSequential() const { return true; } - qint64 bytesAvailable() const - { return static_cast<QNetworkAccessHttpBackend *>(parent())->upstreamBytesAvailable(); } - -protected: - virtual qint64 readData(char *buffer, qint64 maxlen) - { - qint64 ret = static_cast<QNetworkAccessHttpBackend *>(parent())->deviceReadData(buffer, maxlen); - if (!ret && eof) - return -1; - return ret; - } - - virtual qint64 writeData(const char *, qint64) - { - return -1; // cannot write - } - - friend class QNetworkAccessHttpBackend; -}; - QNetworkAccessHttpBackend::QNetworkAccessHttpBackend() : QNetworkAccessBackend(), httpReply(0), http(0), uploadDevice(0) #ifndef QT_NO_OPENSSL @@ -507,20 +476,19 @@ void QNetworkAccessHttpBackend::postRequest() case QNetworkAccessManager::PostOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Post); - uploadDevice = new QNetworkAccessHttpBackendIODevice(this); + httpRequest.setUploadByteDevice(createUploadByteDevice()); break; case QNetworkAccessManager::PutOperation: invalidateCache(); httpRequest.setOperation(QHttpNetworkRequest::Put); - uploadDevice = new QNetworkAccessHttpBackendIODevice(this); + httpRequest.setUploadByteDevice(createUploadByteDevice()); break; default: break; // can't happen } - httpRequest.setData(uploadDevice); httpRequest.setUrl(url()); QList<QByteArray> headers = request().rawHeaderList(); @@ -528,7 +496,9 @@ void QNetworkAccessHttpBackend::postRequest() httpRequest.setHeaderField(header, request().rawHeader(header)); if (loadedFromCache) { - QNetworkAccessBackend::finished(); + // commented this out since it will be called later anyway + // by copyFinished() + //QNetworkAccessBackend::finished(); return; // no need to send the request! :) } @@ -624,14 +594,6 @@ void QNetworkAccessHttpBackend::closeDownstreamChannel() // this indicates that the user closed the stream while the reply isn't finished yet } -void QNetworkAccessHttpBackend::closeUpstreamChannel() -{ - // this indicates that the user finished uploading the data for POST - Q_ASSERT(uploadDevice); - uploadDevice->eof = true; - emit uploadDevice->readChannelFinished(); -} - bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) { Q_ASSERT(http); @@ -651,38 +613,6 @@ bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) return false; } -bool QNetworkAccessHttpBackend::waitForUpstreamBytesWritten(int msecs) -{ - - // ### FIXME: not implemented in QHttpNetworkAccess - Q_UNUSED(msecs); - qCritical("QNetworkAccess: HTTP backend does not support waitForBytesWritten()"); - return false; -} - -void QNetworkAccessHttpBackend::upstreamReadyRead() -{ - // There is more data available from the user to be uploaded - // QHttpNetworkAccess implements the upload rate control: - // we simply tell QHttpNetworkAccess that there is more data available - // it'll pull from us when it can (through uploadDevice) - - Q_ASSERT(uploadDevice); - emit uploadDevice->readyRead(); -} - -qint64 QNetworkAccessHttpBackend::deviceReadData(char *buffer, qint64 maxlen) -{ - QByteArray toBeUploaded = readUpstream(); - if (toBeUploaded.isEmpty()) - return 0; // nothing to be uploaded - - maxlen = qMin<qint64>(maxlen, toBeUploaded.length()); - - memcpy(buffer, toBeUploaded.constData(), maxlen); - upstreamBytesConsumed(maxlen); - return maxlen; -} void QNetworkAccessHttpBackend::downstreamReadyWrite() { @@ -904,7 +834,14 @@ bool QNetworkAccessHttpBackend::sendCacheContents(const QNetworkCacheMetaData &m checkForRedirect(status); - writeDownstreamData(contents); + emit metaDataChanged(); + + // invoke this asynchronously, else Arora/QtDemoBrowser don't like cached downloads + // see task 250221 / 251801 + qRegisterMetaType<QIODevice*>("QIODevice*"); + QMetaObject::invokeMethod(this, "writeDownstreamData", Qt::QueuedConnection, Q_ARG(QIODevice*, contents)); + + #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) qDebug() << "Successfully sent cache:" << url() << contents->size() << "bytes"; #endif diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index 02915e7..225f944 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -79,11 +79,8 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual void closeUpstreamChannel(); virtual bool waitForDownstreamReadyRead(int msecs); - virtual bool waitForUpstreamBytesWritten(int msecs); - virtual void upstreamReadyRead(); virtual void downstreamReadyWrite(); virtual void copyFinished(QIODevice *); #ifndef QT_NO_OPENSSL @@ -96,6 +93,9 @@ public: qint64 deviceReadData(char *buffer, qint64 maxlen); + // we return true since HTTP needs to send PUT/POST data again after having authenticated + bool needsResetableUploadData() {return true;}; + private slots: void replyReadyRead(); void replyFinished(); @@ -108,7 +108,8 @@ private: QHttpNetworkReply *httpReply; QPointer<QNetworkAccessHttpBackendCache> http; QByteArray cacheKey; - QNetworkAccessHttpBackendIODevice *uploadDevice; + QNetworkAccessBackendUploadIODevice *uploadDevice; + #ifndef QT_NO_OPENSSL QSslConfiguration *pendingSslConfiguration; bool pendingIgnoreSslErrors; @@ -122,8 +123,6 @@ private: void postRequest(); void readFromHttp(); void checkForRedirect(const int statusCode); - - friend class QNetworkAccessHttpBackendIODevice; }; class QNetworkAccessHttpBackendFactory : public QNetworkAccessBackendFactory diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index bcbeef1..bf06ede 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -686,7 +686,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera priv->urlForLastAuthentication = url; } - // third step: setup the reply + // third step: find a backend + priv->backend = d->findBackend(op, request); + + // fourth step: setup the reply priv->setup(op, request, outgoingData); if (request.attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt() != QNetworkRequest::AlwaysNetwork) @@ -695,9 +698,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera QList<QNetworkProxy> proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); priv->proxyList = proxyList; #endif - - // fourth step: find a backend - priv->backend = d->findBackend(op, request); if (priv->backend) { priv->backend->setParent(reply); priv->backend->reply = priv; diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 01a743b..67df526 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -913,6 +913,17 @@ static QDateTime parseDateString(const QByteArray &dateString) */ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieString) { + // cookieString can be a number of set-cookie header strings joined together + // by \n, parse each line separately. + QList<QNetworkCookie> cookies; + QList<QByteArray> list = cookieString.split('\n'); + for (int a = 0; a < list.size(); a++) + cookies += QNetworkCookiePrivate::parseSetCookieHeaderLine(list.at(a)); + return cookies; +} + +QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByteArray &cookieString) +{ // According to http://wp.netscape.com/newsref/std/cookie_spec.html,< // the Set-Cookie response header is of the format: // @@ -930,12 +941,6 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin while (position < length) { QNetworkCookie cookie; - // When there are multiple SetCookie headers they are join with a new line - // \n will always be the start of a new cookie - int endOfSetCookie = cookieString.indexOf('\n', position); - if (endOfSetCookie == -1) - endOfSetCookie = length; - // The first part is always the "NAME=VALUE" part QPair<QByteArray,QByteArray> field = nextField(cookieString, position); if (field.first.isEmpty() || field.second.isNull()) @@ -946,7 +951,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin position = nextNonWhitespace(cookieString, position); bool endOfCookie = false; - while (!endOfCookie && position < endOfSetCookie) + while (!endOfCookie && position < length) { switch (cookieString.at(position++)) { case ',': // end of the cookie @@ -969,27 +974,24 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin position = end; QDateTime dt = parseDateString(dateString.toLower()); if (!dt.isValid()) { - cookie = QNetworkCookie(); - endOfCookie = true; - continue; + return result; } cookie.setExpirationDate(dt); } else if (field.first == "domain") { QByteArray rawDomain = field.second; - QString maybeLeadingDot; if (rawDomain.startsWith('.')) { - maybeLeadingDot = QLatin1Char('.'); rawDomain = rawDomain.mid(1); } - QString normalizedDomain = QUrl::fromAce(QUrl::toAce(QString::fromUtf8(rawDomain))); - cookie.setDomain(maybeLeadingDot + normalizedDomain); + // always add the dot, there are some servers that forget the + // leading dot. This is actually forbidden according to RFC 2109, + // but all browsers accept it anyway so we do that as well + cookie.setDomain(QLatin1Char('.') + normalizedDomain); } else if (field.first == "max-age") { bool ok = false; int secs = field.second.toInt(&ok); if (!ok) - // invalid cookie string - return QList<QNetworkCookie>(); + return result; cookie.setExpirationDate(now.addSecs(secs)); } else if (field.first == "path") { QString path = QUrl::fromPercentEncoding(field.second); @@ -1003,9 +1005,7 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin } else if (field.first == "version") { if (field.second != "1") { // oops, we don't know how to handle this cookie - cookie = QNetworkCookie(); - endOfCookie = true; - continue; + return result; } } else { // got an unknown field in the cookie @@ -1013,9 +1013,8 @@ QList<QNetworkCookie> QNetworkCookie::parseCookies(const QByteArray &cookieStrin } position = nextNonWhitespace(cookieString, position); - if (position > endOfSetCookie) - endOfCookie = true; } + } if (!cookie.name().isEmpty()) result += cookie; @@ -1184,7 +1183,6 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis cookie.expirationDate() < now; // validate the cookie & set the defaults if unset - // (RFC 2965: "The request-URI MUST path-match the Path attribute of the cookie.") if (cookie.path().isEmpty()) cookie.setPath(defaultPath); else if (!isParentPath(pathAndFileName, cookie.path())) @@ -1198,6 +1196,13 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis || isParentDomain(defaultDomain, domain))) { continue; // not accepted } + + // reject if domain is like ".com" + // (i.e., reject if domain does not contain embedded dots, see RFC 2109 section 4.3.2) + // this is just a rudimentary check and does not cover all cases + if (domain.lastIndexOf(QLatin1Char('.')) == 0) + continue; // not accepted + } QList<QNetworkCookie>::Iterator it = d->allCookies.begin(), diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h index 83ef14a..0c41322 100644 --- a/src/network/access/qnetworkcookie_p.h +++ b/src/network/access/qnetworkcookie_p.h @@ -61,6 +61,7 @@ class QNetworkCookiePrivate: public QSharedData { public: inline QNetworkCookiePrivate() : secure(false), httpOnly(false) { } + static QList<QNetworkCookie> parseSetCookieHeaderLine(const QByteArray &cookieString); QDateTime expirationDate; QString domain; diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 14a04f1..d42370d 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -193,7 +193,11 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData) } else { QString templateName = d->tmpCacheFileName(); cacheItem->file = new QTemporaryFile(templateName, &cacheItem->data); - cacheItem->file->open(); + if (!cacheItem->file->open()) { + qWarning() << "QNetworkDiskCache::prepare() unable to open temporary file"; + delete cacheItem; + return 0; + } cacheItem->writeHeader(cacheItem->file); device = cacheItem->file; } @@ -231,7 +235,7 @@ void QNetworkDiskCachePrivate::storeItem(QCacheItem *cacheItem) if (QFile::exists(fileName)) { if (!QFile::remove(fileName)) { - qWarning() << "QNetworkDiskCache: could't remove the cache file " << fileName; + qWarning() << "QNetworkDiskCache: couldn't remove the cache file " << fileName; return; } } diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index f4dad3c..0990b17 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -151,6 +151,10 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() authentication to serve the content but the credentials provided were not accepted (if any) + \value ContentReSendError the request needed to be sent + again, but this failed for example because the upload data + could not be read a second time. + \value ProtocolUnknownError the Network Access API cannot honor the request because the protocol is not known diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 6f763b3..2f864fe 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -92,6 +92,7 @@ public: ContentOperationNotPermittedError, ContentNotFoundError, AuthenticationRequiredError, + ContentReSendError, UnknownContentError = 299, // protocol errors diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 79c3d1a..749a462 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -46,13 +46,15 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qdatetime.h" #include "QtNetwork/qsslconfiguration.h" +#include "qnetworkaccesshttpbackend_p.h" #include <QtCore/QCoreApplication> QT_BEGIN_NAMESPACE inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() - : copyDevice(0), networkCache(0), + : backend(0), outgoingData(0), outgoingDataBuffer(0), + copyDevice(0), networkCache(0), cacheEnabled(false), cacheSaveDevice(0), bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), state(Idle) @@ -61,8 +63,13 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() void QNetworkReplyImplPrivate::_q_startOperation() { - // This function is called exactly once + // ensure this function is only being called once + if (state == Working) { + qDebug("QNetworkReplyImpl::_q_startOperation was called more than once"); + return; + } state = Working; + if (!backend) { error(QNetworkReplyImpl::ProtocolUnknownError, QCoreApplication::translate("QNetworkReply", "Protocol \"%1\" is unknown").arg(url.scheme())); // not really true!; @@ -74,57 +81,11 @@ void QNetworkReplyImplPrivate::_q_startOperation() if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) pendingNotifications.append(NotifyDownstreamReadyWrite); - if (outgoingData) { - _q_sourceReadyRead(); -#if 0 // ### FIXME - if (outgoingData->atEndOfStream() && writeBuffer.isEmpty()) - // empty upload - emit q->uploadProgress(0, 0); -#endif - } handleNotifications(); } } -void QNetworkReplyImplPrivate::_q_sourceReadyRead() -{ - // read data from the outgoingData QIODevice into our internal buffer - enum { DesiredBufferSize = 32 * 1024 }; - - if (writeBuffer.size() >= DesiredBufferSize) - return; // don't grow the buffer too much - - // read as many bytes are available or up until we fill up the buffer - // but always read at least one byte - qint64 bytesToRead = qBound<qint64>(1, outgoingData->bytesAvailable(), - DesiredBufferSize - writeBuffer.size()); - char *ptr = writeBuffer.reserve(bytesToRead); - qint64 bytesActuallyRead = outgoingData->read(ptr, bytesToRead); - if (bytesActuallyRead == -1) { - // EOF - writeBuffer.chop(bytesToRead); - backendNotify(NotifyCloseUpstreamChannel); - return; - } - - if (bytesActuallyRead < bytesToRead) - writeBuffer.chop(bytesToRead - bytesActuallyRead); - - // if we did read anything, let the backend know and handle it - if (bytesActuallyRead) - backendNotify(NotifyUpstreamReadyRead); - - // check for EOF again - if (!outgoingData->isSequential() && outgoingData->atEnd()) - backendNotify(NotifyCloseUpstreamChannel); -} - -void QNetworkReplyImplPrivate::_q_sourceReadChannelFinished() -{ - _q_sourceReadyRead(); -} - void QNetworkReplyImplPrivate::_q_copyReadyRead() { Q_Q(QNetworkReplyImpl); @@ -143,7 +104,7 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() if (bytesActuallyRead == -1) { readBuffer.chop(bytesToRead); backendNotify(NotifyCopyFinished); - return; + break; } if (bytesActuallyRead != bytesToRead) @@ -151,6 +112,7 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() if (!copyDevice->isSequential() && copyDevice->atEnd()) { backendNotify(NotifyCopyFinished); + bytesDownloaded += bytesActuallyRead; break; } @@ -174,6 +136,67 @@ void QNetworkReplyImplPrivate::_q_copyReadChannelFinished() _q_copyReadyRead(); } +void QNetworkReplyImplPrivate::_q_bufferOutgoingDataFinished() +{ + Q_Q(QNetworkReplyImpl); + + // make sure this is only called once, ever. + //_q_bufferOutgoingData may call it or the readChannelFinished emission + if (state != Buffering) + return; + + // disconnect signals + QObject::disconnect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); + QObject::disconnect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); + + // finally, start the request + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); +} + +void QNetworkReplyImplPrivate::_q_bufferOutgoingData() +{ + Q_Q(QNetworkReplyImpl); + + if (!outgoingDataBuffer) { + // first call, create our buffer + outgoingDataBuffer = new QRingBuffer(); + + QObject::connect(outgoingData, SIGNAL(readyRead()), q, SLOT(_q_bufferOutgoingData())); + QObject::connect(outgoingData, SIGNAL(readChannelFinished()), q, SLOT(_q_bufferOutgoingDataFinished())); + } + + qint64 bytesBuffered = 0; + qint64 bytesToBuffer = 0; + + // read data into our buffer + forever { + bytesToBuffer = outgoingData->bytesAvailable(); + // unknown? just try 2 kB, this also ensures we always try to read the EOF + if (bytesToBuffer <= 0) + bytesToBuffer = 2*1024; + + char *dst = outgoingDataBuffer->reserve(bytesToBuffer); + bytesBuffered = outgoingData->read(dst, bytesToBuffer); + + if (bytesBuffered == -1) { + // EOF has been reached. + outgoingDataBuffer->chop(bytesToBuffer); + + _q_bufferOutgoingDataFinished(); + break; + } else if (bytesBuffered == 0) { + // nothing read right now, just wait until we get called again + outgoingDataBuffer->chop(bytesToBuffer); + + break; + } else { + // don't break, try to read() again + outgoingDataBuffer->chop(bytesToBuffer - bytesBuffered); + } + } +} + + void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *data) { @@ -184,13 +207,42 @@ void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const url = request.url(); operation = op; - if (outgoingData) { - q->connect(outgoingData, SIGNAL(readyRead()), SLOT(_q_sourceReadyRead())); - q->connect(outgoingData, SIGNAL(readChannelFinished()), SLOT(_q_sourceReadChannelFinished())); + if (outgoingData && backend) { + // there is data to be uploaded, e.g. HTTP POST. + + if (!backend->needsResetableUploadData() || !outgoingData->isSequential()) { + // backend does not need upload buffering or + // fixed size non-sequential + // just start the operation + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + } else { + bool bufferingDisallowed = + req.attribute(QNetworkRequest::DoNotBufferUploadDataAttribute, + false).toBool(); + + if (bufferingDisallowed) { + // if a valid content-length header for the request was supplied, we can disable buffering + // if not, we will buffer anyway + if (req.header(QNetworkRequest::ContentLengthHeader).isValid()) { + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + } else { + state = Buffering; + QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection); + } + } else { + // _q_startOperation will be called when the buffering has finished. + state = Buffering; + QMetaObject::invokeMethod(q, "_q_bufferOutgoingData", Qt::QueuedConnection); + } + } + } else { + // No outgoing data (e.g. HTTP GET request) + // or no backend + // if no backend, _q_startOperation will handle the error of this + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } q->QIODevice::open(QIODevice::ReadOnly); - QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } void QNetworkReplyImplPrivate::setNetworkCache(QAbstractNetworkCache *nc) @@ -226,18 +278,10 @@ void QNetworkReplyImplPrivate::handleNotifications() backend->downstreamReadyWrite(); break; - case NotifyUpstreamReadyRead: - backend->upstreamReadyRead(); - break; - case NotifyCloseDownstreamChannel: backend->closeDownstreamChannel(); break; - case NotifyCloseUpstreamChannel: - backend->closeUpstreamChannel(); - break; - case NotifyCopyFinished: { QIODevice *dev = copyDevice; copyDevice = 0; @@ -299,29 +343,14 @@ void QNetworkReplyImplPrivate::completeCacheSave() cacheEnabled = false; } -void QNetworkReplyImplPrivate::consume(qint64 count) +void QNetworkReplyImplPrivate::emitUploadProgress(qint64 bytesSent, qint64 bytesTotal) { Q_Q(QNetworkReplyImpl); - if (count <= 0) { - qWarning("QNetworkConnection: backend signalled that it consumed %ld bytes", long(count)); - return; - } - - if (outgoingData) - // schedule another read from the source - QMetaObject::invokeMethod(q_func(), "_q_sourceReadyRead", Qt::QueuedConnection); - - writeBuffer.skip(count); - if (bytesUploaded == -1) - bytesUploaded = count; - else - bytesUploaded += count; - - QVariant totalSize = request.header(QNetworkRequest::ContentLengthHeader); - emit q->uploadProgress(bytesUploaded, - totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); + bytesUploaded = bytesSent; + emit q->uploadProgress(bytesSent, bytesTotal); } + qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const { enum { DesiredBufferSize = 32 * 1024 }; @@ -331,7 +360,9 @@ qint64 QNetworkReplyImplPrivate::nextDownstreamBlockSize() const return qMax<qint64>(0, readBufferMaxSize - readBuffer.size()); } -void QNetworkReplyImplPrivate::feed(const QByteArray &data) +// we received downstream data and send this to the cache +// and to our readBuffer (which in turn gets read by the user of QNetworkReply) +void QNetworkReplyImplPrivate::appendDownstreamData(const QByteArray &data) { Q_Q(QNetworkReplyImpl); if (!q->isOpen()) @@ -379,7 +410,8 @@ void QNetworkReplyImplPrivate::feed(const QByteArray &data) } } -void QNetworkReplyImplPrivate::feed(QIODevice *data) +// this is used when it was fetched from the cache, right? +void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) { Q_Q(QNetworkReplyImpl); Q_ASSERT(q->isOpen()); @@ -409,9 +441,11 @@ void QNetworkReplyImplPrivate::finished() pendingNotifications.clear(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (bytesDownloaded != lastBytesDownloaded || totalSize.isNull()) + if (totalSize.isNull() || totalSize == -1) { emit q->downloadProgress(bytesDownloaded, bytesDownloaded); - if (bytesUploaded == -1 && outgoingData) + } + + if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) emit q->uploadProgress(0, 0); completeCacheSave(); diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index ad06f78..8d3c90e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -59,6 +59,7 @@ #include "qnetworkproxy.h" #include "QtCore/qmap.h" #include "QtCore/qqueue.h" +#include "QtCore/qbuffer.h" #include "private/qringbuffer_p.h" QT_BEGIN_NAMESPACE @@ -91,10 +92,10 @@ public: Q_DECLARE_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) - Q_PRIVATE_SLOT(d_func(), void _q_sourceReadyRead()) - Q_PRIVATE_SLOT(d_func(), void _q_sourceReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) + Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -102,15 +103,13 @@ class QNetworkReplyImplPrivate: public QNetworkReplyPrivate public: enum InternalNotifications { NotifyDownstreamReadyWrite, - NotifyUpstreamReadyRead, NotifyCloseDownstreamChannel, - NotifyCloseUpstreamChannel, NotifyCopyFinished }; enum State { Idle, - Opening, + Buffering, Working, Finished, Aborted @@ -125,6 +124,8 @@ public: void _q_sourceReadChannelFinished(); void _q_copyReadyRead(); void _q_copyReadChannelFinished(); + void _q_bufferOutgoingData(); + void _q_bufferOutgoingDataFinished(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); @@ -138,9 +139,10 @@ public: void setCachingEnabled(bool enable); bool isCachingEnabled() const; void consume(qint64 count); + void emitUploadProgress(qint64 bytesSent, qint64 bytesTotal); qint64 nextDownstreamBlockSize() const; - void feed(const QByteArray &data); - void feed(QIODevice *data); + void appendDownstreamData(const QByteArray &data); + void appendDownstreamData(QIODevice *data); void finished(); void error(QNetworkReply::NetworkError code, const QString &errorString); void metaDataChanged(); @@ -149,6 +151,7 @@ public: QNetworkAccessBackend *backend; QIODevice *outgoingData; + QRingBuffer *outgoingDataBuffer; QIODevice *copyDevice; QAbstractNetworkCache *networkCache; diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 56b793d..8b1afba 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -162,6 +162,13 @@ QT_BEGIN_NAMESPACE Indicates whether the data was obtained from cache or not. + \value DoNotBufferUploadDataAttribute + Requests only, type: QVariant::Bool (default: false) + Indicates whether the QNetworkAccessManager code is + allowed to buffer the upload data, e.g. when doing a HTTP POST. + When using this flag with sequential upload data, the ContentLengthHeader + header must be set. + \value User Special type. Additional information can be passed in QVariants with types ranging from User to UserMax. The default diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index 6f34bce..5dea1df 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -75,6 +75,7 @@ public: CacheLoadControlAttribute, CacheSaveControlAttribute, SourceIsFromCacheAttribute, + DoNotBufferUploadDataAttribute, User = 1000, UserMax = 32767 diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index c9161f8..33795aa 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -73,6 +73,15 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas authentication information to the socket when accessing services that require authentication. + QAuthenticator supports the following authentication methods: + \list + \o Basic + \o NTLM version 1 + \o Digest-MD5 + \endlist + + Note that, in particular, NTLM version 2 is not supported. + \sa QSslSocket */ diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index f4ece97..62bdfc7 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -86,10 +86,11 @@ The SOCKS5 support in Qt 4 is based on \l{RFC 1928} and \l{RFC 1929}. The supported authentication methods are no authentication and username/password authentication. Both IPv4 and IPv6 are - supported, but domain name resolution via the SOCKS server is not - supported; i.e. all domain names are resolved locally. There are - several things to remember when using SOCKS5 with QUdpSocket and - QTcpServer: + supported. Domain names are resolved through the SOCKS5 server if + the QNetworkProxy::HostNameLookupCapability is enabled, otherwise + they are resolved locally and the IP address is sent to the + server. There are several things to remember when using SOCKS5 + with QUdpSocket and QTcpServer: With QUdpSocket, a call to \l {QUdpSocket::bind()}{bind()} may fail with a timeout error. If a port number other than 0 is passed to @@ -365,7 +366,8 @@ static QNetworkProxy::Capabilities defaultCapabilitiesForType(QNetworkProxy::Pro int(QNetworkProxy::HostNameLookupCapability)), }; - Q_ASSERT(int(type) >= 0 && int(type) <= int(QNetworkProxy::FtpCachingProxy)); + if (int(type) < 0 && int(type) > int(QNetworkProxy::FtpCachingProxy)) + type = QNetworkProxy::DefaultProxy; return QNetworkProxy::Capabilities(defaults[int(type)]); } @@ -378,6 +380,7 @@ public: QNetworkProxy::Capabilities capabilities; quint16 port; QNetworkProxy::ProxyType type; + bool capabilitiesSet; inline QNetworkProxyPrivate(QNetworkProxy::ProxyType t = QNetworkProxy::DefaultProxy, const QString &h = QString(), quint16 p = 0, @@ -387,7 +390,8 @@ public: password(pw), capabilities(defaultCapabilitiesForType(t)), port(p), - type(t) + type(t), + capabilitiesSet(false) { } inline bool operator==(const QNetworkProxyPrivate &other) const @@ -490,13 +494,16 @@ QNetworkProxy &QNetworkProxy::operator=(const QNetworkProxy &other) Sets the proxy type for this instance to be \a type. Note that changing the type of a proxy does not change - the set of capabilities this QNetworkProxy object holds. + the set of capabilities this QNetworkProxy object holds if any + capabilities have been set with setCapabilities(). \sa type(), setCapabilities() */ void QNetworkProxy::setType(QNetworkProxy::ProxyType type) { d->type = type; + if (!d->capabilitiesSet) + d->capabilities = defaultCapabilitiesForType(type); } /*! @@ -519,6 +526,7 @@ QNetworkProxy::ProxyType QNetworkProxy::type() const void QNetworkProxy::setCapabilities(Capabilities capabilities) { d->capabilities = capabilities; + d->capabilitiesSet = true; } /*! diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index d6b1507..77a999b 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -276,9 +276,13 @@ QLocalSocket *QLocalServer::nextPendingConnection() if (d->pendingConnections.isEmpty()) return 0; QLocalSocket *nextSocket = d->pendingConnections.dequeue(); +#ifndef QT_LOCALSOCKET_TCP + if (d->pendingConnections.size() <= d->maxPendingConnections) #ifndef Q_OS_WIN - d->socketNotifier->setEnabled(d->pendingConnections.size() - <= d->maxPendingConnections); + d->socketNotifier->setEnabled(true); +#else + d->connectionEventNotifier->setEnabled(true); +#endif #endif return nextSocket; } diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h index 8e8babd..1488a75 100644 --- a/src/network/socket/qlocalserver.h +++ b/src/network/socket/qlocalserver.h @@ -86,15 +86,7 @@ protected: private: Q_DISABLE_COPY(QLocalServer) -#if defined(QT_LOCALSOCKET_TCP) Q_PRIVATE_SLOT(d_func(), void _q_onNewConnection()) -#elif defined(Q_OS_WIN) - Q_PRIVATE_SLOT(d_func(), void _q_openSocket(HANDLE handle)) - Q_PRIVATE_SLOT(d_func(), void _q_stoppedListening()) - Q_PRIVATE_SLOT(d_func(), void _q_setError(QAbstractSocket::SocketError error, const QString &errorString)) -#else - Q_PRIVATE_SLOT(d_func(), void _q_socketActivated()) -#endif }; #endif // QT_NO_LOCALSERVER diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h index 8e96401..7b31082 100644 --- a/src/network/socket/qlocalserver_p.h +++ b/src/network/socket/qlocalserver_p.h @@ -63,7 +63,7 @@ # include <qtcpserver.h> #elif defined(Q_OS_WIN) # include <qt_windows.h> -# include <qthread.h> +# include <private/qwineventnotifier_p.h> #else # include <private/qnativesocketengine_p.h> # include <qsocketnotifier.h> @@ -71,52 +71,13 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP) - -/*! - \internal - QLocalServerThread exists because Windows does not have a - way to provide notifications when there is a new connections to - the server. - */ -class QLocalServerThread : public QThread -{ - Q_OBJECT - -Q_SIGNALS: - void connected(HANDLE newSocket); - void error(QAbstractSocket::SocketError error, const QString &errorString); - -public: - QLocalServerThread(QObject *parent = 0); - ~QLocalServerThread(); - void closeServer(); - -public: - QString setName(const QString &name); - void run(); - void stop(); - bool makeHandle(); - - HANDLE gotConnectionEvent; - QQueue<HANDLE> pendingHandles; - int maxPendingConnections; -private: - HANDLE stopEvent; - QString fullServerName; -}; - -#endif - class QLocalServerPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QLocalServer) public: QLocalServerPrivate() : -#if defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP) - inWaitingFunction(false), -#elif !defined(QT_LOCALSOCKET_TCP) +#if !defined(QT_LOCALSOCKET_TCP) && !defined(Q_OS_WIN) listenSocket(-1), socketNotifier(0), #endif maxPendingConnections(30), error(QAbstractSocket::UnknownSocketError) @@ -128,22 +89,26 @@ public: static bool removeServer(const QString &name); void closeServer(); void waitForNewConnection(int msec, bool *timedOut); + void _q_onNewConnection(); #if defined(QT_LOCALSOCKET_TCP) - void _q_onNewConnection(); QTcpServer tcpServer; QMap<quintptr, QTcpSocket*> socketMap; #elif defined(Q_OS_WIN) - void _q_openSocket(HANDLE socket); - void _q_stoppedListening(); - void _q_setError(QAbstractSocket::SocketError error, const QString &errorString); + struct Listener { + HANDLE handle; + OVERLAPPED overlapped; + }; + + void setError(const QString &function); + bool addListener(); - QLocalServerThread waitForConnection; - bool inWaitingFunction; + QList<Listener> listeners; + HANDLE eventHandle; + QWinEventNotifier *connectionEventNotifier; #else void setError(const QString &function); - void _q_socketActivated(); int listenSocket; QSocketNotifier *socketNotifier; diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index e7d2252..53ee6b6 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -132,7 +132,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) socketNotifier = new QSocketNotifier(listenSocket, QSocketNotifier::Read, q); q->connect(socketNotifier, SIGNAL(activated(int)), - q, SLOT(_q_socketActivated())); + q, SLOT(_q_onNewConnection())); socketNotifier->setEnabled(maxPendingConnections > 0); return true; } @@ -164,7 +164,7 @@ void QLocalServerPrivate::closeServer() We have received a notification that we can read on the listen socket. Accept the new socket. */ -void QLocalServerPrivate::_q_socketActivated() +void QLocalServerPrivate::_q_onNewConnection() { Q_Q(QLocalServer); if (-1 == listenSocket) @@ -209,7 +209,7 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut) break; } if (result > 0) - _q_socketActivated(); + _q_onNewConnection(); } if (timedOut) *timedOut = (result == 0); diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp index 880cd7e..b14bbf7 100644 --- a/src/network/socket/qlocalserver_win.cpp +++ b/src/network/socket/qlocalserver_win.cpp @@ -44,68 +44,26 @@ #include "qlocalsocket.h" #include <qdebug.h> -#include <qdatetime.h> -#include <qcoreapplication.h> -#include <QMetaType> // The buffer size need to be 0 otherwise data could be // lost if the socket that has written data closes the connection // before it is read. Pipewriter is used for write buffering. #define BUFSIZE 0 -QT_BEGIN_NAMESPACE - -QLocalServerThread::QLocalServerThread(QObject *parent) : QThread(parent), - maxPendingConnections(1) -{ - stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - gotConnectionEvent = CreateEvent(NULL, TRUE, FALSE, NULL); -} +// ###: This should be a property. Should replace the insane 50 on unix as well. +#define SYSTEM_MAX_PENDING_SOCKETS 8 -QLocalServerThread::~QLocalServerThread() -{ - stop(); - closeServer(); - CloseHandle(stopEvent); - CloseHandle(gotConnectionEvent); -} - -void QLocalServerThread::stop() -{ - if (isRunning()) { - SetEvent(stopEvent); - wait(); - ResetEvent(stopEvent); - } -} - -void QLocalServerThread::closeServer() -{ - while (!pendingHandles.isEmpty()) - CloseHandle(pendingHandles.dequeue()); -} - -QString QLocalServerThread::setName(const QString &name) -{ - QString pipePath = QLatin1String("\\\\.\\pipe\\"); - if (name.startsWith(pipePath)) - fullServerName = name; - else - fullServerName = pipePath + name; - for (int i = pendingHandles.count(); i < maxPendingConnections; ++i) - if (!makeHandle()) - break; - return fullServerName; -} +QT_BEGIN_NAMESPACE -bool QLocalServerThread::makeHandle() +bool QLocalServerPrivate::addListener() { - if (pendingHandles.count() >= maxPendingConnections) - return false; + // The object must not change its address once the + // contained OVERLAPPED struct is passed to Windows. + listeners << Listener(); + Listener &listener = listeners.last(); - HANDLE handle = INVALID_HANDLE_VALUE; QT_WA({ - handle = CreateNamedPipeW( + listener.handle = CreateNamedPipeW( (TCHAR*)fullServerName.utf16(), // pipe name PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access PIPE_TYPE_MESSAGE | // message type pipe @@ -117,7 +75,7 @@ bool QLocalServerThread::makeHandle() 3000, // client time-out NULL); }, { - handle = CreateNamedPipeA( + listener.handle = CreateNamedPipeA( fullServerName.toLocal8Bit().constData(), // pipe name PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access PIPE_TYPE_MESSAGE | // message type pipe @@ -129,68 +87,43 @@ bool QLocalServerThread::makeHandle() 3000, // client time-out NULL); }); - - if (INVALID_HANDLE_VALUE == handle) { + if (listener.handle == INVALID_HANDLE_VALUE) { + setError(QLatin1String("QLocalServerPrivate::addListener")); + listeners.removeLast(); return false; } - pendingHandles.enqueue(handle); + + memset(&listener.overlapped, 0, sizeof(listener.overlapped)); + listener.overlapped.hEvent = eventHandle; + if (!ConnectNamedPipe(listener.handle, &listener.overlapped)) { + switch (GetLastError()) { + case ERROR_IO_PENDING: + break; + case ERROR_PIPE_CONNECTED: + SetEvent(eventHandle); + break; + default: + CloseHandle(listener.handle); + setError(QLatin1String("QLocalServerPrivate::addListener")); + listeners.removeLast(); + return false; + } + } else { + Q_ASSERT_X(false, "QLocalServerPrivate::addListener", "The impossible happened"); + SetEvent(eventHandle); + } return true; } -void QLocalServerThread::run() +void QLocalServerPrivate::setError(const QString &function) { - OVERLAPPED op; - HANDLE handleArray[2]; - memset(&op, 0, sizeof(op)); - handleArray[0] = op.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - handleArray[1] = stopEvent; - HANDLE handle = INVALID_HANDLE_VALUE; - - forever { - if (INVALID_HANDLE_VALUE == handle) { - makeHandle(); - if (!pendingHandles.isEmpty()) - handle = pendingHandles.dequeue(); - } - if (INVALID_HANDLE_VALUE == handle) { - int windowsError = GetLastError(); - QString function = QLatin1String("QLocalServer::run"); - QString errorString = QLocalServer::tr("%1: Unknown error %2").arg(function).arg(windowsError); - emit error(QAbstractSocket::UnknownSocketError, errorString); - CloseHandle(handleArray[0]); - SetEvent(gotConnectionEvent); - return; - } - - BOOL isConnected = ConnectNamedPipe(handle, &op) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); - if (!isConnected) { - switch (WaitForMultipleObjects(2, handleArray, FALSE, INFINITE)) - { - case WAIT_OBJECT_0 + 1: - CloseHandle(handle); - CloseHandle(handleArray[0]); - return; - } - } - emit connected(handle); - handle = INVALID_HANDLE_VALUE; - ResetEvent(handleArray[0]); - SetEvent(gotConnectionEvent); - } + int windowsError = GetLastError(); + errorString = QString::fromLatin1("%1: %2").arg(function).arg(qt_error_string(windowsError)); + error = QAbstractSocket::UnknownSocketError; } void QLocalServerPrivate::init() { - Q_Q(QLocalServer); - qRegisterMetaType<HANDLE>("HANDLE"); - q->connect(&waitForConnection, SIGNAL(connected(HANDLE)), - q, SLOT(_q_openSocket(HANDLE)), Qt::QueuedConnection); - q->connect(&waitForConnection, SIGNAL(finished()), - q, SLOT(_q_stoppedListening()), Qt::QueuedConnection); - q->connect(&waitForConnection, SIGNAL(terminated()), - q, SLOT(_q_stoppedListening()), Qt::QueuedConnection); - q->connect(&waitForConnection, SIGNAL(error(QAbstractSocket::SocketError, const QString &)), - q, SLOT(_q_setError(QAbstractSocket::SocketError, const QString &))); } bool QLocalServerPrivate::removeServer(const QString &name) @@ -201,35 +134,71 @@ bool QLocalServerPrivate::removeServer(const QString &name) bool QLocalServerPrivate::listen(const QString &name) { - fullServerName = waitForConnection.setName(name); - serverName = name; - waitForConnection.start(); - return true; -} + Q_Q(QLocalServer); -void QLocalServerPrivate::_q_setError(QAbstractSocket::SocketError e, const QString &eString) -{ - error = e; - errorString = eString; -} + QString pipePath = QLatin1String("\\\\.\\pipe\\"); + if (name.startsWith(pipePath)) + fullServerName = name; + else + fullServerName = pipePath + name; -void QLocalServerPrivate::_q_stoppedListening() -{ - Q_Q(QLocalServer); - if (!inWaitingFunction) - q->close(); + // Use only one event for all listeners of one socket. + // The idea is that listener events are rare, so polling all listeners once in a while is + // cheap compared to waiting for N additional events in each iteration of the main loop. + eventHandle = CreateEvent(NULL, TRUE, FALSE, NULL); + connectionEventNotifier = new QWinEventNotifier(eventHandle , q); + q->connect(connectionEventNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_onNewConnection())); + + for (int i = 0; i < SYSTEM_MAX_PENDING_SOCKETS; ++i) + if (!addListener()) + return false; + return true; } -void QLocalServerPrivate::_q_openSocket(HANDLE handle) +void QLocalServerPrivate::_q_onNewConnection() { Q_Q(QLocalServer); - q->incomingConnection((int)handle); + DWORD dummy; + + // Reset first, otherwise we could reset an event which was asserted + // immediately after we checked the conn status. + ResetEvent(eventHandle); + + // Testing shows that there is indeed absolutely no guarantee which listener gets + // a client connection first, so there is no way around polling all of them. + for (int i = 0; i < listeners.size(); ) { + HANDLE handle = listeners[i].handle; + if (GetOverlappedResult(handle, &listeners[i].overlapped, &dummy, FALSE)) { + listeners.removeAt(i); + + addListener(); + + if (pendingConnections.size() > maxPendingConnections) + connectionEventNotifier->setEnabled(false); + + // Make this the last thing so connected slots can wreak the least havoc + q->incomingConnection((quintptr)handle); + } else { + if (GetLastError() != ERROR_IO_INCOMPLETE) { + setError(QLatin1String("QLocalServerPrivate::_q_onNewConnection")); + closeServer(); + return; + } + + ++i; + } + } } void QLocalServerPrivate::closeServer() { - waitForConnection.stop(); - waitForConnection.closeServer(); + connectionEventNotifier->setEnabled(false); // Otherwise, closed handle is checked before deleter runs + connectionEventNotifier->deleteLater(); + connectionEventNotifier = 0; + CloseHandle(eventHandle); + for (int i = 0; i < listeners.size(); ++i) + CloseHandle(listeners[i].handle); + listeners.clear(); } void QLocalServerPrivate::waitForNewConnection(int msecs, bool *timedOut) @@ -238,14 +207,12 @@ void QLocalServerPrivate::waitForNewConnection(int msecs, bool *timedOut) if (!pendingConnections.isEmpty() || !q->isListening()) return; - DWORD result = WaitForSingleObject(waitForConnection.gotConnectionEvent, - (msecs == -1) ? INFINITE : msecs); + DWORD result = WaitForSingleObject(eventHandle, (msecs == -1) ? INFINITE : msecs); if (result == WAIT_TIMEOUT) { if (timedOut) *timedOut = true; } else { - ResetEvent(waitForConnection.gotConnectionEvent); - QCoreApplication::instance()->processEvents(); + _q_onNewConnection(); } } diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp index 505c662..7fec2df 100644 --- a/src/network/ssl/qsslcipher.cpp +++ b/src/network/ssl/qsslcipher.cpp @@ -64,9 +64,9 @@ #ifndef QT_NO_DEBUG_STREAM #include <QtCore/qdebug.h> +#endif QT_BEGIN_NAMESPACE -#endif /*! Constructs an empty QSslCipher object. diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 39ac5da..92054a4 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -113,8 +113,8 @@ readLine(), or getChar() to read decrypted data from QSslSocket's internal buffer, and you can call write() or putChar() to write data back to the peer. QSslSocket will automatically encrypt the - written data for you, and emit bytesWritten() once the data has - been written to the peer. + written data for you, and emit encryptedBytesWritten() once + the data has been written to the peer. As a convenience, QSslSocket supports QTcpSocket's blocking functions waitForConnected(), waitForReadyRead(), diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 827f461..49798e0 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -523,7 +523,7 @@ void QSslSocketBackendPrivate::startClientEncryption() // Start connecting. This will place outgoing data in the BIO, so we // follow up with calling transmit(). - testConnection(); + startHandshake(); transmit(); } @@ -536,7 +536,7 @@ void QSslSocketBackendPrivate::startServerEncryption() // Start connecting. This will place outgoing data in the BIO, so we // follow up with calling transmit(). - testConnection(); + startHandshake(); transmit(); } @@ -624,7 +624,7 @@ void QSslSocketBackendPrivate::transmit() #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocketBackendPrivate::transmit: testing encryption"; #endif - if (testConnection()) { + if (startHandshake()) { #ifdef QSSLSOCKET_DEBUG qDebug() << "QSslSocketBackendPrivate::transmit: encryption established"; #endif @@ -643,7 +643,7 @@ void QSslSocketBackendPrivate::transmit() } // If the request is small and the remote host closes the transmission - // after sending, there's a chance that testConnection() will already + // after sending, there's a chance that startHandshake() will already // have triggered a shutdown. if (!ssl) continue; @@ -743,7 +743,7 @@ static QSslError _q_OpenSSL_to_QSslError(int errorCode, const QSslCertificate &c return error; } -bool QSslSocketBackendPrivate::testConnection() +bool QSslSocketBackendPrivate::startHandshake() { Q_Q(QSslSocket); @@ -784,7 +784,7 @@ bool QSslSocketBackendPrivate::testConnection() q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(SSL_ERRORSTR())); q->setSocketError(QAbstractSocket::SslHandshakeFailedError); #ifdef QSSLSOCKET_DEBUG - qDebug() << "QSslSocketBackendPrivate::testConnection: error!" << q->errorString(); + qDebug() << "QSslSocketBackendPrivate::startHandshake: error!" << q->errorString(); #endif emit q->error(QAbstractSocket::SslHandshakeFailedError); q->abort(); diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index b3be42a..f53d4e8 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -102,7 +102,7 @@ public: void startClientEncryption(); void startServerEncryption(); void transmit(); - bool testConnection(); + bool startHandshake(); void disconnectFromHost(); void disconnected(); QSslCipher sessionCipher() const; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index e09e764..42c09f5 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -364,11 +364,14 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() // DT_RPATH tags on our library header as well as other system-specific search // paths. See the man page for dlopen(3) on your system for more information. +#ifdef Q_OS_OPENBSD + libcrypto->setLoadHints(QLibrary::ExportExternalSymbolsHint); +#endif #ifdef SHLIB_VERSION_NUMBER // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER> libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER)); libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER)); - if (libssl->load() && libcrypto->load()) { + if (libcrypto->load() && libssl->load()) { // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found return pair; } else { @@ -380,7 +383,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() // second attempt: find the development files libssl.so and libcrypto.so libssl->setFileNameAndVersion(QLatin1String("ssl"), -1); libcrypto->setFileNameAndVersion(QLatin1String("crypto"), -1); - if (libssl->load() && libcrypto->load()) { + if (libcrypto->load() && libssl->load()) { // libssl.so.0 and libcrypto.so.0 found return pair; } else { @@ -395,7 +398,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() crypto.replace(QLatin1String("ssl"), QLatin1String("crypto")); libssl->setFileNameAndVersion(ssl, -1); libcrypto->setFileNameAndVersion(crypto, -1); - if (libssl->load() && libcrypto->load()) { + if (libcrypto->load() && libssl->load()) { // libssl.so.0 and libcrypto.so.0 found return pair; } else { diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm index 9a679b1..e95e36b 100644 --- a/src/opengl/qglpixelbuffer_mac.mm +++ b/src/opengl/qglpixelbuffer_mac.mm @@ -299,9 +299,8 @@ void QGLPixelBuffer::releaseFromDynamicTexture() GLuint QGLPixelBuffer::generateDynamicTexture() const { - Q_D(const QGLPixelBuffer); - #ifdef QT_MAC_USE_COCOA + Q_D(const QGLPixelBuffer); NSOpenGLContext *oldContext = [NSOpenGLContext currentContext]; if (d->share_ctx != oldContext) [static_cast<NSOpenGLContext *>(d->share_ctx) makeCurrentContext]; diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 9197ebc..0f447d3 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4865,9 +4865,8 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte // fall back to drawing a polygon if the scale factor is large, or // we use a gradient pen - if (ti.fontEngine->fontDef.pixelSize >= 64 - || (d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern - && d->pen_brush_style <= Qt::ConicalGradientPattern)) { + if ((d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern + && d->pen_brush_style <= Qt::ConicalGradientPattern)) { QPaintEngine::drawTextItem(p, textItem); return; } diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h index d4552e3..d1fd0da 100644 --- a/src/plugins/accessible/widgets/simplewidgets.h +++ b/src/plugins/accessible/widgets/simplewidgets.h @@ -115,6 +115,7 @@ public: class QAccessibleLineEdit : public QAccessibleWidgetEx, public QAccessibleTextInterface, public QAccessibleSimpleEditableTextInterface { + Q_ACCESSIBLE_OBJECT public: explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString()); diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 67f5d61..5c60b2f 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -6,6 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers # These defines might be necessary if your DirectFB driver doesn't # support all of the DirectFB API. # +#DEFINES += QT_DIRECTFB_IMAGECACHE #DEFINES += QT_NO_DIRECTFB_WM #DEFINES += QT_NO_DIRECTFB_LAYER #DEFINES += QT_NO_DIRECTFB_PALETTE @@ -22,7 +23,7 @@ target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers INSTALLS += target HEADERS = qdirectfbscreen.h \ - qdirectfbsurface.h \ + qdirectfbwindowsurface.h \ qdirectfbpaintengine.h \ qdirectfbpaintdevice.h \ qdirectfbpixmap.h \ @@ -31,7 +32,7 @@ HEADERS = qdirectfbscreen.h \ SOURCES = qdirectfbscreen.cpp \ qdirectfbscreenplugin.cpp \ - qdirectfbsurface.cpp \ + qdirectfbwindowsurface.cpp \ qdirectfbpaintengine.cpp \ qdirectfbpaintdevice.cpp \ qdirectfbpixmap.cpp \ @@ -40,4 +41,4 @@ SOURCES = qdirectfbscreen.cpp \ QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB LIBS += $$QT_LIBS_DIRECTFB - +DEFINES += $$QT_DEFINES_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 924090c..72e0ce5 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -56,15 +56,20 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const } -void QDirectFBPaintDevice::lockDirectFB() +void QDirectFBPaintDevice::lockDirectFB(uint flags) { - if (lockedImage) - return; // Already locked - - if (uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl)) { - const QSize s = size(); - lockedImage = new QImage(mem, s.width(), s.height(), bpl, - QDirectFBScreen::getImageFormat(dfbSurface)); + if (!(lock & flags)) { + if (lock) + unlockDirectFB(); + if ((mem = QDirectFBScreen::lockSurface(dfbSurface, flags, &bpl))) { + const QSize s = size(); + lockedImage = new QImage(mem, s.width(), s.height(), bpl, + QDirectFBScreen::getImageFormat(dfbSurface)); + lock = flags; + Q_ASSERT(mem); + } else { + lock = 0; + } } } @@ -77,15 +82,19 @@ void QDirectFBPaintDevice::unlockDirectFB() dfbSurface->Unlock(dfbSurface); delete lockedImage; lockedImage = 0; + mem = 0; + lock = 0; } -void* QDirectFBPaintDevice::memory() const +void *QDirectFBPaintDevice::memory() const { - QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this); - that->lockDirectFB(); - Q_ASSERT(that->lockedImage); - return that->lockedImage->bits(); + if (lock != (DSLF_READ|DSLF_WRITE)) { + QDirectFBPaintDevice *that = const_cast<QDirectFBPaintDevice*>(this); + that->lockDirectFB(DSLF_READ|DSLF_WRITE); + Q_ASSERT(that->lockedImage); + } + return mem; } @@ -101,7 +110,7 @@ int QDirectFBPaintDevice::bytesPerLine() const // Can only get the stride when we lock the surface Q_ASSERT(!lockedImage); QDirectFBPaintDevice* that = const_cast<QDirectFBPaintDevice*>(this); - that->lockDirectFB(); + that->lockDirectFB(DSLF_READ); Q_ASSERT(bpl != -1); } return bpl; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index a11064b..13f0a8f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -58,7 +58,7 @@ public: IDirectFBSurface *directFBSurface() const; - void lockDirectFB(); + void lockDirectFB(uint flags); void unlockDirectFB(); inline bool forceRasterPrimitives() const { return forceRaster; } @@ -69,6 +69,7 @@ public: int bytesPerLine() const; QSize size() const; int metric(QPaintDevice::PaintDeviceMetric metric) const; + uint lockFlags() const { return lock; } protected: // Shouldn't create QDirectFBPaintDevice by itself but only sub-class it: QDirectFBPaintDevice(QDirectFBScreen *scr = QDirectFBScreen::instance()) @@ -76,7 +77,10 @@ protected: dfbSurface(0), lockedImage(0), screen(scr), - forceRaster(false) {} + forceRaster(false), + lock(0), + mem(0) + {} inline int dotsPerMeterX() const { @@ -92,6 +96,8 @@ protected: QDirectFBScreen *screen; int bpl; bool forceRaster; + uint lock; + uchar *mem; private: Q_DISABLE_COPY(QDirectFBPaintDevice) }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 9e6f821..989a37a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -43,7 +43,7 @@ #ifndef QT_NO_DIRECTFB -#include "qdirectfbsurface.h" +#include "qdirectfbwindowsurface.h" #include "qdirectfbscreen.h" #include "qdirectfbpixmap.h" #include <directfb.h> @@ -80,7 +80,7 @@ template <typename T> inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr<bool>(const bool &) { return 0; } template <typename device, typename T1, typename T2, typename T3> static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - bool matrixScale, bool matrixRotShear, bool simplePen, + int scale, bool matrixRotShear, bool simplePen, bool dfbHandledClip, bool forceRasterPrimitives, const char *nameOne, const T1 &one, const char *nameTwo, const T2 &two, @@ -95,7 +95,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << dev << "of type" << dev->devType(); } - dbg << "matrixScale" << matrixScale + dbg << "scale" << scale << "matrixRotShear" << matrixRotShear << "simplePen" << simplePen << "dfbHandledClip" << dfbHandledClip @@ -123,7 +123,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \ rasterFallbackWarn("Disabled raster engine operation", \ __FUNCTION__, state()->painter->device(), \ - d_func()->matrixScale, d_func()->matrixRotShear, \ + d_func()->scale, d_func()->matrixRotShear, \ d_func()->simplePen, d_func()->dfbCanHandleClip(), \ d_func()->forceRasterPrimitives, \ #one, one, #two, two, #three, three); \ @@ -138,7 +138,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \ rasterFallbackWarn("Falling back to raster engine for", \ __FUNCTION__, state()->painter->device(), \ - d_func()->matrixScale, d_func()->matrixRotShear, \ + d_func()->scale, d_func()->matrixRotShear, \ d_func()->simplePen, d_func()->dfbCanHandleClip(), \ d_func()->forceRasterPrimitives, \ #one, one, #two, two, #three, three); @@ -156,132 +156,66 @@ static inline uint ALPHA_MUL(uint x, uint a) class SurfaceCache { public: - SurfaceCache(); - ~SurfaceCache(); + SurfaceCache() : surface(0), buffer(0), bufsize(0) {} + ~SurfaceCache() { clear(); } - inline IDirectFBSurface *getSurface(const uint *buffer, int size); - inline void clear(); -private: - IDirectFBSurface *surface; - uint *buffer; - int bufsize; -}; - -SurfaceCache::SurfaceCache() - : surface(0), buffer(0), bufsize(0) -{ -} + IDirectFBSurface *getSurface(const uint *buf, int size) + { + if (buffer == buf && bufsize == size) + return surface; -class CachedImage -{ -public: - CachedImage(const QImage &image); - ~CachedImage(); + clear(); - IDirectFBSurface *surface() { return s; } + const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size); + surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface); + if (!surface) + qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface"); -private: - IDirectFBSurface *s; -}; - -CachedImage::CachedImage(const QImage &image) - : s(0) -{ - IDirectFBSurface *tmpSurface = 0; - DFBSurfaceDescription description; - description = QDirectFBScreen::getSurfaceDescription(image); - QDirectFBScreen* screen = QDirectFBScreen::instance(); + buffer = const_cast<uint*>(buf); + bufsize = size; - tmpSurface = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface); - if (!tmpSurface) { - qWarning("CachedImage CreateSurface failed!"); - return; + return surface; } -#ifndef QT_NO_DIRECTFB_PALETTE - QDirectFBScreen::setSurfaceColorTable(tmpSurface, image); -#endif - - description.flags = DFBSurfaceDescriptionFlags(description.flags & ~DSDESC_PREALLOCATED); - - s = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface); - if (!s) - qWarning("QDirectFBPaintEngine failed caching image"); - -#ifndef QT_NO_DIRECTFB_PALETTE - QDirectFBScreen::setSurfaceColorTable(s, image); -#endif - - if (s) { - s->SetBlittingFlags(s, DSBLIT_NOFX); - s->Blit(s, tmpSurface, 0, 0, 0); - s->ReleaseSource(s); + void clear() + { + if (surface && QDirectFBScreen::instance()) + QDirectFBScreen::instance()->releaseDFBSurface(surface); + surface = 0; + buffer = 0; + bufsize = 0; } - if (tmpSurface) - screen->releaseDFBSurface(tmpSurface); -} - -CachedImage::~CachedImage() -{ - if (s && QDirectFBScreen::instance()) - QDirectFBScreen::instance()->releaseDFBSurface(s); -} - -static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB - -IDirectFBSurface* SurfaceCache::getSurface(const uint *buf, int size) -{ - if (buffer == buf && bufsize == size) - return surface; - - clear(); - - DFBSurfaceDescription description; - description = QDirectFBScreen::getSurfaceDescription(buf, size); - - surface = QDirectFBScreen::instance()->createDFBSurface(&description, QDirectFBScreen::TrackSurface); - if (!surface) - qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface"); - - buffer = const_cast<uint*>(buf); - bufsize = size; - - return surface; -} +private: + IDirectFBSurface *surface; + uint *buffer; + int bufsize; +}; -void SurfaceCache::clear() -{ - if (surface) - QDirectFBScreen::instance()->releaseDFBSurface(surface); - surface = 0; - buffer = 0; - bufsize = 0; -} -SurfaceCache::~SurfaceCache() +#ifdef QT_DIRECTFB_IMAGECACHE +#include <private/qimage_p.h> +struct CachedImage { - clear(); -} + IDirectFBSurface *surface; + ~CachedImage() + { + if (surface && QDirectFBScreen::instance()) { + QDirectFBScreen::instance()->releaseDFBSurface(surface); + } + } +}; +static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB +#endif class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { public: + enum Scale { NoScale, Scaled, NegativeScale }; + QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p); ~QDirectFBPaintEnginePrivate(); - IDirectFBSurface *surface; - - QPen pen; - - bool antialiased; - bool forceRasterPrimitives; - - bool simplePen; - - bool matrixRotShear; - bool matrixScale; - void setTransform(const QTransform &m); void setPen(const QPen &pen); void setCompositionMode(QPainter::CompositionMode mode); @@ -307,26 +241,40 @@ public: void fillRects(const QRectF *rects, int count); void drawRects(const QRectF *rects, int count); - - void drawPixmap(const QRectF &dest, - const QPixmap &pixmap, const QRectF &src); void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap); - void drawImage(const QRectF &dest, const QImage &image, const QRectF &src); + void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); inline void updateClip(); - inline void setClipDirty(); void systemStateChanged(); void begin(QPaintDevice *device); void end(); + static IDirectFBSurface *getSurface(const QImage &img, bool *release); + +#ifdef QT_DIRECTFB_IMAGECACHE + static inline int cacheCost(const QImage &img) { return img.width() * img.height() * img.depth() / 8; } +#endif + void prepareForBlit(bool alpha); +private: + IDirectFBSurface *surface; + + QPen pen; + + bool antialiased; + bool forceRasterPrimitives; + + bool simplePen; + + bool matrixRotShear; + Scale scale; + SurfaceCache *surfaceCache; QTransform transform; int lastLockedHeight; -private: + IDirectFB *fb; - DFBSurfaceDescription fbDescription; int fbWidth; int fbHeight; @@ -339,471 +287,12 @@ private: bool dfbHandledClip; bool ignoreSystemClip; QDirectFBPaintDevice *dfbDevice; + void *lockedMemory; QDirectFBPaintEngine *q; + friend class QDirectFBPaintEngine; }; -QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) - : surface(0), antialiased(false), forceRasterPrimitives(false), simplePen(false), - matrixRotShear(false), matrixScale(false), lastLockedHeight(-1), - fbWidth(-1), fbHeight(-1), opacity(255), drawFlagsFromCompositionMode(0), - blitFlagsFromCompositionMode(0), porterDuffRule(DSPD_SRC_OVER), dirtyClip(true), - dfbHandledClip(false), dfbDevice(0), q(p) -{ - fb = QDirectFBScreen::instance()->dfb(); - ignoreSystemClip = QDirectFBScreen::instance()->directFBFlags() & QDirectFBScreen::IgnoreSystemClip; - surfaceCache = new SurfaceCache; - static int cacheLimit = qgetenv("QT_DIRECTFB_IMAGECACHE").toInt(); - if (cacheLimit > 0) - imageCache.setMaxCost(cacheLimit * 1024); -} - -QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate() -{ - delete surfaceCache; -} - -bool QDirectFBPaintEnginePrivate::dfbCanHandleClip(const QRect &rect) const -{ - // TODO: Check to see if DirectFB can handle the clip for the given rect - return dfbHandledClip; -} - -bool QDirectFBPaintEnginePrivate::dfbCanHandleClip(const QRectF &rect) const -{ - // TODO: Check to see if DirectFB can handle the clip for the given rect - return dfbHandledClip; -} - -bool QDirectFBPaintEnginePrivate::dfbCanHandleClip() const -{ - return dfbHandledClip; -} - -bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const -{ - return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); -} - -void QDirectFBPaintEnginePrivate::setClipDirty() -{ - dirtyClip = true; -} - -void QDirectFBPaintEnginePrivate::lock() -{ - // We will potentially get a new pointer to the buffer after a - // lock so we need to call the base implementation of prepare so - // it updates its rasterBuffer to point to the new buffer address. - lastLockedHeight = dfbDevice->height(); - - Q_ASSERT(dfbDevice); - prepare(dfbDevice); -} - -void QDirectFBPaintEnginePrivate::unlock() -{ - Q_ASSERT(dfbDevice); - dfbDevice->unlockDirectFB(); -} - -void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m) -{ - transform = m; - matrixRotShear = (transform.m12() != 0 || transform.m21() != 0); - matrixScale = (transform.m11() != 1 || transform.m22() != 1); -} - -void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) -{ - lastLockedHeight = -1; - if (device->devType() == QInternal::CustomRaster) - dfbDevice = static_cast<QDirectFBPaintDevice*>(device); - else if (device->devType() == QInternal::Pixmap) { - QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); - dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); - } - - if (dfbDevice) - surface = dfbDevice->directFBSurface(); - - if (!surface) { - qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", - device->devType()); - } - forceRasterPrimitives = dfbDevice->forceRasterPrimitives(); - - surface->GetSize(surface, &fbWidth, &fbHeight); - - setTransform(QTransform()); - antialiased = false; - opacity = 255; - setCompositionMode(q->state()->compositionMode()); - dirtyClip = true; - setPen(q->state()->pen); - setDFBColor(pen.color()); -} - -void QDirectFBPaintEnginePrivate::end() -{ - dfbDevice = 0; - surface->ReleaseSource(surface); - surface->SetClip(surface, NULL); - surface = 0; -} - -void QDirectFBPaintEnginePrivate::setPen(const QPen &p) -{ - pen = p; - simplePen = (pen.style() == Qt::NoPen) || - (pen.style() == Qt::SolidLine - && !antialiased - && (pen.brush().style() == Qt::SolidPattern) - && (pen.widthF() <= 1 && !matrixScale)); -} - -void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) -{ - blitFlagsFromCompositionMode = DSBLIT_NOFX; - drawFlagsFromCompositionMode = DSDRAW_NOFX; - - bool blend = true; - switch (mode) { - case QPainter::CompositionMode_SourceOver: - porterDuffRule = DSPD_SRC_OVER; - break; - case QPainter::CompositionMode_DestinationOver: - porterDuffRule = DSPD_DST_OVER; - break; - case QPainter::CompositionMode_Clear: - porterDuffRule = DSPD_CLEAR; - blend = false; - break; - case QPainter::CompositionMode_Source: - porterDuffRule = DSPD_SRC; - blend = false; - break; - case QPainter::CompositionMode_Destination: - porterDuffRule = DSPD_NONE; // ### need to double check this - blend = false; - return; - case QPainter::CompositionMode_SourceIn: - porterDuffRule = DSPD_SRC_IN; - break; - case QPainter::CompositionMode_DestinationIn: - porterDuffRule = DSPD_DST_IN; - break; - case QPainter::CompositionMode_SourceOut: - porterDuffRule = DSPD_SRC_OUT; - break; - case QPainter::CompositionMode_DestinationOut: - porterDuffRule = DSPD_DST_OUT; - break; - case QPainter::CompositionMode_Xor: - porterDuffRule = DSPD_XOR; - blitFlagsFromCompositionMode |= DSBLIT_XOR; - drawFlagsFromCompositionMode |= DSDRAW_XOR; - break; -// case QPainter::CompositionMode_Plus: // ??? -// porterDuffRule = DSPD_ADD; -// break; - default: - qWarning("QDirectFBPaintEnginePrivate::setCompositionMode(): " - "mode %d not implemented", mode); - return; - } - // intentially not comparing with current porterDuffRule. surface might have changed. - if (blend) { - blitFlagsFromCompositionMode |= DSBLIT_BLEND_ALPHACHANNEL; - drawFlagsFromCompositionMode |= DSDRAW_BLEND; - } - if (opacity != 255) { - setOpacity(opacity); - } -} - -void QDirectFBPaintEnginePrivate::setOpacity(quint8 op) -{ - opacity = op; - if (opacity == 255) { - blitFlagsFromCompositionMode &= ~DSBLIT_BLEND_COLORALPHA; - } else { - blitFlagsFromCompositionMode |= DSBLIT_BLEND_COLORALPHA; - } -} - -void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) -{ - const bool old = antialiased; - antialiased = bool(hints & QPainter::Antialiasing); - if (old != antialiased) { - setPen(q->state()->pen); - } -} - -void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) -{ - quint32 blittingFlags = blitFlagsFromCompositionMode; - if (alpha) { - surface->SetPorterDuff(surface, - (blittingFlags & DSBLIT_BLEND_COLORALPHA) - ? DSPD_NONE - : porterDuffRule); - } else { - blittingFlags &= ~DSBLIT_BLEND_ALPHACHANNEL; - surface->SetPorterDuff(surface, DSPD_NONE); - } - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); - surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); -} - -void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) -{ - Q_ASSERT(surface); - const quint8 alpha = (opacity == 255 ? - color.alpha() : ALPHA_MUL(color.alpha(), opacity)); - surface->SetColor(surface, - color.red(), color.green(), color.blue(), alpha); - quint32 drawingFlags = drawFlagsFromCompositionMode; - if (alpha == 255) { - drawingFlags &= ~DSDRAW_BLEND; - } - surface->SetPorterDuff(surface, DSPD_NONE); - // PorterDuff messes up alpha values for primitives - surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawingFlags)); -} - -void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) -{ - for (int i = 0; i < n; ++i) { - const QLine l = transform.map(lines[i]); - surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); - } -} - -void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) -{ - for (int i = 0; i < n; ++i) { - const QLine l = transform.map(lines[i]).toLine(); - surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); - } -} - -void QDirectFBPaintEnginePrivate::fillRegion(const QRegion ®ion) -{ - Q_ASSERT(isSimpleBrush(q->state()->brush)); - setDFBColor(q->state()->brush.color()); - const QVector<QRect> rects = region.rects(); - const int n = rects.size(); - fillRects(rects.constData(), n); -} - -void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) -{ - for (int i = 0; i < n; ++i) { - const QRect r = transform.mapRect(rects[i]); - surface->FillRectangle(surface, r.x(), r.y(), - r.width(), r.height()); - } -} - -void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) -{ - for (int i = 0; i < n; ++i) { - const QRect r = transform.mapRect(rects[i]).toRect(); - surface->FillRectangle(surface, r.x(), r.y(), - r.width(), r.height()); - } -} - -void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) -{ - for (int i = 0; i < n; ++i) { - const QRect r = transform.mapRect(rects[i]); - surface->DrawRectangle(surface, r.x(), r.y(), - r.width() + 1, r.height() + 1); - } -} - -void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) -{ - for (int i = 0; i < n; ++i) { - const QRect r = transform.mapRect(rects[i]).toRect(); - surface->DrawRectangle(surface, r.x(), r.y(), - r.width() + 1, r.height() + 1); - } -} - -void QDirectFBPaintEnginePrivate::drawPixmap(const QRectF &dest, - const QPixmap &pixmap, - const QRectF &src) -{ - prepareForBlit(pixmap.hasAlphaChannel()); - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - IDirectFBSurface *s = dfbData->directFBSurface(); - const QRect sr = src.toRect(); - const QRect dr = transform.mapRect(dest).toRect(); - const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; - DFBResult result; - - if (dr.size() == sr.size()) { - result = surface->Blit(surface, s, &sRect, dr.x(), dr.y()); - } else { - const DFBRectangle dRect = { dr.x(), dr.y(), dr.width(), dr.height() }; - result = surface->StretchBlit(surface, s, &sRect, &dRect); - } - if (result != DFB_OK) - DirectFBError("QDirectFBPaintEngine::drawPixmap()", result); -} - -void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, - const QPixmap &pixmap) -{ - prepareForBlit(pixmap.hasAlphaChannel()); - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); - IDirectFBSurface *s = dfbData->directFBSurface(); - const QRect dr = transform.mapRect(dest).toRect(); - DFBResult result = DFB_OK; - - if (!matrixScale && dr == QRect(0, 0, fbWidth, fbHeight)) { - result = surface->TileBlit(surface, s, 0, 0, 0); - } else if (!matrixScale) { - const int dx = pixmap.width(); - const int dy = pixmap.height(); - const DFBRectangle rect = { 0, 0, dx, dy }; - QVarLengthArray<DFBRectangle> rects; - QVarLengthArray<DFBPoint> points; - - for (int y = dr.y(); y <= dr.bottom(); y += dy) { - for (int x = dr.x(); x <= dr.right(); x += dx) { - rects.append(rect); - const DFBPoint point = { x, y }; - points.append(point); - } - } - result = surface->BatchBlit(surface, s, rects.constData(), - points.constData(), points.size()); - } else { - const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height())); - const int dx = sr.width(); - const int dy = sr.height(); - const DFBRectangle sRect = { 0, 0, dx, dy }; - - for (int y = dr.y(); y <= dr.bottom(); y += dy) { - for (int x = dr.x(); x <= dr.right(); x += dx) { - const DFBRectangle dRect = { x, y, dx, dy }; - result = surface->StretchBlit(surface, s, &sRect, &dRect); - if (result != DFB_OK) { - y = dr.bottom() + 1; - break; - } - } - } - } - - if (result != DFB_OK) - DirectFBError("QDirectFBPaintEngine::drawTiledPixmap()", result); -} - -void QDirectFBPaintEnginePrivate::drawImage(const QRectF &dest, - const QImage &image, - const QRectF &src) -{ - Q_ASSERT(QDirectFBScreen::getSurfacePixelFormat(image.format()) != DSPF_UNKNOWN); - CachedImage *img = imageCache[image.cacheKey()]; - IDirectFBSurface *imgSurface = 0; - bool doRelease = false; - - if (img) { - imgSurface = img->surface(); - } else { - const int cost = image.width() * image.height() * image.depth() / 8; - if (cost <= imageCache.maxCost()) { - img = new CachedImage(image); - imgSurface = img->surface(); - if (imgSurface) { - imageCache.insert(image.cacheKey(), img, cost); - } else { - delete img; - img = 0; - } - } - - if (!imgSurface) { - DFBSurfaceDescription description; - - description = QDirectFBScreen::getSurfaceDescription(image); - imgSurface = QDirectFBScreen::instance()->createDFBSurface(&description, - QDirectFBScreen::DontTrackSurface); - if (!imgSurface) { - qWarning("QDirectFBPaintEnginePrivate::drawImage"); - return; - } - -#ifndef QT_NO_DIRECTFB_PALETTE - QDirectFBScreen::setSurfaceColorTable(surface, image); -#endif - doRelease = (imgSurface != 0); - } - } - - const QRect sr = src.toRect(); - const QRect dr = transform.mapRect(dest).toRect(); - const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; - - prepareForBlit(image.hasAlphaChannel()); - if (dr.size() == sr.size()) { - surface->Blit(surface, imgSurface, &sRect, dr.x(), dr.y()); - } else { - const DFBRectangle dRect = { dr.x(), dr.y(), - dr.width(), dr.height() }; - surface->StretchBlit(surface, imgSurface, &sRect, &dRect); - } - if (doRelease) { - surface->ReleaseSource(surface); - imgSurface->Release(imgSurface); - } -} - -void QDirectFBPaintEnginePrivate::updateClip() -{ - if (!dirtyClip) - return; - - const QClipData *clipData = clip(); - if (!clipData || !clipData->enabled) { - surface->SetClip(surface, NULL); - dfbHandledClip = true; - } else if (clipData->hasRectClip) { - const DFBRegion r = { - clipData->clipRect.x(), - clipData->clipRect.y(), - clipData->clipRect.x() + clipData->clipRect.width(), - clipData->clipRect.y() + clipData->clipRect.height() - }; - surface->SetClip(surface, &r); - dfbHandledClip = true; - } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) { - dfbHandledClip = true; - } else { - dfbHandledClip = false; - } - - dirtyClip = false; -} - -void QDirectFBPaintEnginePrivate::systemStateChanged() -{ - setClipDirty(); - QRasterPaintEnginePrivate::systemStateChanged(); -} - QDirectFBPaintEngine::QDirectFBPaintEngine(QPaintDevice *device) : QRasterPaintEngine(*(new QDirectFBPaintEnginePrivate(this)), device) { @@ -832,12 +321,10 @@ bool QDirectFBPaintEngine::end() return QRasterPaintEngine::end(); } - - void QDirectFBPaintEngine::clipEnabledChanged() { Q_D(QDirectFBPaintEngine); - d->setClipDirty(); + d->dirtyClip = true; QRasterPaintEngine::clipEnabledChanged(); } @@ -873,9 +360,9 @@ void QDirectFBPaintEngine::renderHintsChanged() void QDirectFBPaintEngine::transformChanged() { Q_D(QDirectFBPaintEngine); - const bool old = d->matrixScale; + const QDirectFBPaintEnginePrivate::Scale old = d->scale; d->setTransform(state()->transform()); - if (d->matrixScale != old) { + if (d->scale != old) { d->setPen(state()->pen); } QRasterPaintEngine::transformChanged(); @@ -885,7 +372,7 @@ void QDirectFBPaintEngine::setState(QPainterState *s) { Q_D(QDirectFBPaintEngine); QRasterPaintEngine::setState(s); - d->setClipDirty(); + d->dirtyClip = true; d->setPen(state()->pen); d->setOpacity(quint8(state()->opacity * 255)); d->setCompositionMode(state()->compositionMode()); @@ -895,7 +382,7 @@ void QDirectFBPaintEngine::setState(QPainterState *s) void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); - d->setClipDirty(); + d->dirtyClip = true; const QPoint bottom = d->transform.map(QPoint(0, path.controlPointRect().y2)); if (bottom.y() >= d->lastLockedHeight) d->lock(); @@ -905,8 +392,8 @@ void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) { Q_D(QDirectFBPaintEngine); - d->setClipDirty(); - if (!d->clip()->hasRectClip && d->clip()->enabled) { + d->dirtyClip = true; + if (d->clip() && !d->clip()->hasRectClip && d->clip()->enabled) { const QPoint bottom = d->transform.map(QPoint(0, rect.bottom())); if (bottom.y() >= d->lastLockedHeight) d->lock(); @@ -1008,12 +495,36 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, Qt::ImageConversionFlags flags) { Q_D(QDirectFBPaintEngine); - Q_UNUSED(flags); // XXX + Q_UNUSED(flags); + + /* This is hard to read. The way it works is like this: + + - If you do not have support for preallocated surfaces and do not use an + image cache we always fall back to raster engine. + + - If it's rotated/sheared/mirrored (negative scale) or we can't + clip it we fall back to raster engine. + + - If we don't cache the image, but we do have support for + preallocated surfaces we fall back to the raster engine if the + image is in a format DirectFB can't handle. + + - If we do cache the image but don't have support for preallocated + images and the cost of caching the image (bytes used) is higher + than the max image cache size we fall back to raster engine. + */ -#ifndef QT_NO_DIRECTFB_PREALLOCATED d->updateClip(); - if (!d->dfbCanHandleClip(r) || d->matrixRotShear - || QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN) +#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE + if (d->matrixRotShear + || d->scale == QDirectFBPaintEnginePrivate::NegativeScale + || !d->dfbCanHandleClip(r) +#ifndef QT_DIRECTFB_IMAGECACHE + || QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN +#elif defined QT_NO_DIRECTFB_PREALLOCATED + || QDirectFBPaintEnginePrivate::cacheCost(image) > imageCache.maxCost() +#endif + ) #endif { RASTERFALLBACK(DRAW_IMAGE, r, image.size(), sr); @@ -1021,10 +532,16 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, QRasterPaintEngine::drawImage(r, image, sr, flags); return; } - -#ifndef QT_NO_DIRECTFB_PREALLOCATED +#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE d->unlock(); - d->drawImage(r, image, sr); + bool release; + IDirectFBSurface *imgSurface = d->getSurface(image, &release); + d->prepareForBlit(QDirectFBScreen::hasAlpha(imgSurface)); + d->blit(r, imgSurface, sr); + if (release) { + imgSurface->ReleaseSource(imgSurface); + imgSurface->Release(imgSurface); + } #endif } @@ -1043,14 +560,20 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); d->lock(); QRasterPaintEngine::drawPixmap(r, pixmap, sr); - } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear) { + } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear + || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); - const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); + const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ); d->lock(); QRasterPaintEngine::drawImage(r, *img, sr); } else { d->unlock(); - d->drawPixmap(r, pixmap, sr); + d->prepareForBlit(pixmap.hasAlphaChannel()); + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); + IDirectFBSurface *s = dfbData->directFBSurface(); + d->blit(r, s, sr); } } @@ -1069,9 +592,10 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp); - } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()) { + } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull() + || d->scale == QDirectFBPaintEnginePrivate::NegativeScale) { RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); - const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); + const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ); d->lock(); QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->fromImage(*img, Qt::AutoColor); @@ -1259,4 +783,457 @@ void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, d->surface->Blit(d->surface, src, &rect, x, y); } +#ifdef QT_DIRECTFB_IMAGECACHE +static void cachedImageCleanupHook(qint64 key) +{ + delete imageCache.take(key); +} +void QDirectFBPaintEngine::initImageCache(int size) +{ + Q_ASSERT(size >= 0); + imageCache.setMaxCost(size); + typedef void (*_qt_image_cleanup_hook_64)(qint64); + extern Q_GUI_EXPORT _qt_image_cleanup_hook_64 qt_image_cleanup_hook_64; + qt_image_cleanup_hook_64 = ::cachedImageCleanupHook; +} + +#endif // QT_DIRECTFB_IMAGECACHE + +// ---- QDirectFBPaintEnginePrivate ---- + + +QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) + : surface(0), antialiased(false), forceRasterPrimitives(false), simplePen(false), + matrixRotShear(false), scale(NoScale), lastLockedHeight(-1), + fbWidth(-1), fbHeight(-1), opacity(255), drawFlagsFromCompositionMode(0), + blitFlagsFromCompositionMode(0), porterDuffRule(DSPD_SRC_OVER), dirtyClip(true), + dfbHandledClip(false), dfbDevice(0), lockedMemory(0), q(p) +{ + fb = QDirectFBScreen::instance()->dfb(); + ignoreSystemClip = QDirectFBScreen::instance()->directFBFlags() & QDirectFBScreen::IgnoreSystemClip; + surfaceCache = new SurfaceCache; +} + +QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate() +{ + delete surfaceCache; +} + +bool QDirectFBPaintEnginePrivate::dfbCanHandleClip(const QRect &rect) const +{ + // TODO: Check to see if DirectFB can handle the clip for the given rect + return dfbHandledClip; +} + +bool QDirectFBPaintEnginePrivate::dfbCanHandleClip(const QRectF &rect) const +{ + // TODO: Check to see if DirectFB can handle the clip for the given rect + return dfbHandledClip; +} + +bool QDirectFBPaintEnginePrivate::dfbCanHandleClip() const +{ + return dfbHandledClip; +} + +bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const +{ + return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); +} + +void QDirectFBPaintEnginePrivate::lock() +{ + // We will potentially get a new pointer to the buffer after a + // lock so we need to call the base implementation of prepare so + // it updates its rasterBuffer to point to the new buffer address. + Q_ASSERT(dfbDevice); + if (dfbDevice->lockFlags() != (DSLF_WRITE|DSLF_READ) + || dfbDevice->height() != lastLockedHeight + || dfbDevice->memory() != lockedMemory) { + prepare(dfbDevice); + lastLockedHeight = dfbDevice->height(); + lockedMemory = dfbDevice->memory(); + } +} + +void QDirectFBPaintEnginePrivate::unlock() +{ + Q_ASSERT(dfbDevice); + dfbDevice->unlockDirectFB(); + lockedMemory = 0; +} + +void QDirectFBPaintEnginePrivate::setTransform(const QTransform &m) +{ + transform = m; + matrixRotShear = (transform.m12() != 0 || transform.m21() != 0); + if (qMin(transform.m11(), transform.m22()) < 0) { + scale = NegativeScale; + } else if (transform.m11() != 1 || transform.m22() != 1) { + scale = Scaled; + } else { + scale = NoScale; + } +} + +void QDirectFBPaintEnginePrivate::begin(QPaintDevice *device) +{ + lastLockedHeight = -1; + if (device->devType() == QInternal::CustomRaster) + dfbDevice = static_cast<QDirectFBPaintDevice*>(device); + else if (device->devType() == QInternal::Pixmap) { + QPixmapData *data = static_cast<QPixmap*>(device)->pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData* dfbPixmapData = static_cast<QDirectFBPixmapData*>(data); + dfbDevice = static_cast<QDirectFBPaintDevice*>(dfbPixmapData); + } + + if (dfbDevice) + surface = dfbDevice->directFBSurface(); + + if (!surface) { + qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", + device->devType()); + } + lockedMemory = 0; + forceRasterPrimitives = dfbDevice->forceRasterPrimitives(); + + surface->GetSize(surface, &fbWidth, &fbHeight); + + setTransform(QTransform()); + antialiased = false; + opacity = 255; + setCompositionMode(q->state()->compositionMode()); + dirtyClip = true; + setPen(q->state()->pen); + setDFBColor(pen.color()); +} + +void QDirectFBPaintEnginePrivate::end() +{ + lockedMemory = 0; + dfbDevice = 0; + surface->ReleaseSource(surface); + surface->SetClip(surface, NULL); + surface = 0; +} + +void QDirectFBPaintEnginePrivate::setPen(const QPen &p) +{ + pen = p; + simplePen = (pen.style() == Qt::NoPen) || + (pen.style() == Qt::SolidLine + && !antialiased + && (pen.brush().style() == Qt::SolidPattern) + && (pen.widthF() <= 1 && scale != NoScale)); +} + +void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) +{ + blitFlagsFromCompositionMode = DSBLIT_NOFX; + drawFlagsFromCompositionMode = DSDRAW_NOFX; + + bool blend = true; + switch (mode) { + case QPainter::CompositionMode_SourceOver: + porterDuffRule = DSPD_SRC_OVER; + break; + case QPainter::CompositionMode_DestinationOver: + porterDuffRule = DSPD_DST_OVER; + break; + case QPainter::CompositionMode_Clear: + porterDuffRule = DSPD_CLEAR; + blend = false; + break; + case QPainter::CompositionMode_Source: + porterDuffRule = DSPD_SRC; + blend = false; + break; + case QPainter::CompositionMode_Destination: + porterDuffRule = DSPD_NONE; // ### need to double check this + blend = false; + return; + case QPainter::CompositionMode_SourceIn: + porterDuffRule = DSPD_SRC_IN; + break; + case QPainter::CompositionMode_DestinationIn: + porterDuffRule = DSPD_DST_IN; + break; + case QPainter::CompositionMode_SourceOut: + porterDuffRule = DSPD_SRC_OUT; + break; + case QPainter::CompositionMode_DestinationOut: + porterDuffRule = DSPD_DST_OUT; + break; + case QPainter::CompositionMode_Xor: + porterDuffRule = DSPD_XOR; + blitFlagsFromCompositionMode |= DSBLIT_XOR; + drawFlagsFromCompositionMode |= DSDRAW_XOR; + break; +// case QPainter::CompositionMode_Plus: // ??? +// porterDuffRule = DSPD_ADD; +// break; + default: + qWarning("QDirectFBPaintEnginePrivate::setCompositionMode(): " + "mode %d not implemented", mode); + return; + } + // intentially not comparing with current porterDuffRule. surface might have changed. + if (blend) { + blitFlagsFromCompositionMode |= DSBLIT_BLEND_ALPHACHANNEL; + drawFlagsFromCompositionMode |= DSDRAW_BLEND; + } + if (opacity != 255) { + setOpacity(opacity); + } +} + +void QDirectFBPaintEnginePrivate::setOpacity(quint8 op) +{ + opacity = op; + if (opacity == 255) { + blitFlagsFromCompositionMode &= ~DSBLIT_BLEND_COLORALPHA; + } else { + blitFlagsFromCompositionMode |= DSBLIT_BLEND_COLORALPHA; + } +} + +void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) +{ + const bool old = antialiased; + antialiased = bool(hints & QPainter::Antialiasing); + if (old != antialiased) { + setPen(q->state()->pen); + } +} + +void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) +{ + quint32 blittingFlags = blitFlagsFromCompositionMode; + if (alpha) { + surface->SetPorterDuff(surface, + (blittingFlags & DSBLIT_BLEND_COLORALPHA) + ? DSPD_NONE + : porterDuffRule); + } else { + blittingFlags &= ~DSBLIT_BLEND_ALPHACHANNEL; + surface->SetPorterDuff(surface, DSPD_NONE); + } + surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); + surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); +} + +void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) +{ + Q_ASSERT(surface); + const quint8 alpha = (opacity == 255 ? + color.alpha() : ALPHA_MUL(color.alpha(), opacity)); + surface->SetColor(surface, + color.red(), color.green(), color.blue(), alpha); + quint32 drawingFlags = drawFlagsFromCompositionMode; + if (alpha == 255) { + drawingFlags &= ~DSDRAW_BLEND; + } + surface->SetPorterDuff(surface, DSPD_NONE); + // PorterDuff messes up alpha values for primitives + surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawingFlags)); +} + +void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) +{ + for (int i = 0; i < n; ++i) { + const QLine l = transform.map(lines[i]); + surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); + } +} + +void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) +{ + for (int i = 0; i < n; ++i) { + const QLine l = transform.map(lines[i]).toLine(); + surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); + } +} + +void QDirectFBPaintEnginePrivate::fillRegion(const QRegion ®ion) +{ + Q_ASSERT(isSimpleBrush(q->state()->brush)); + setDFBColor(q->state()->brush.color()); + const QVector<QRect> rects = region.rects(); + const int n = rects.size(); + fillRects(rects.constData(), n); +} + +void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) +{ + for (int i = 0; i < n; ++i) { + const QRect r = transform.mapRect(rects[i]); + surface->FillRectangle(surface, r.x(), r.y(), + r.width(), r.height()); + } +} + +void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) +{ + for (int i = 0; i < n; ++i) { + const QRect r = transform.mapRect(rects[i]).toRect(); + surface->FillRectangle(surface, r.x(), r.y(), + r.width(), r.height()); + } +} + +void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) +{ + for (int i = 0; i < n; ++i) { + const QRect r = transform.mapRect(rects[i]); + surface->DrawRectangle(surface, r.x(), r.y(), + r.width() + 1, r.height() + 1); + } +} + +void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) +{ + for (int i = 0; i < n; ++i) { + const QRect r = transform.mapRect(rects[i]).toRect(); + surface->DrawRectangle(surface, r.x(), r.y(), + r.width() + 1, r.height() + 1); + } +} + +IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) +{ +#ifndef QT_DIRECTFB_IMAGECACHE + *release = true; + return QDirectFBScreen::instance()->createDFBSurface(img, QDirectFBScreen::DontTrackSurface); +#else + const qint64 key = img.cacheKey(); + *release = false; + if (imageCache.contains(key)) { + return imageCache[key]->surface; + } + + const int cost = cacheCost(img); + const bool cache = cost <= imageCache.maxCost(); + QDirectFBScreen *screen = QDirectFBScreen::instance(); + const QImage::Format format = (img.format() == screen->alphaPixmapFormat() || QDirectFBPixmapData::hasAlphaChannel(img) + ? screen->alphaPixmapFormat() : screen->pixelFormat()); + + IDirectFBSurface *surface = screen->copyToDFBSurface(img, format, + cache + ? QDirectFBScreen::TrackSurface + : QDirectFBScreen::DontTrackSurface); + if (cache) { + CachedImage *cachedImage = new CachedImage; + const_cast<QImage&>(img).data_ptr()->is_cached = true; + cachedImage->surface = surface; + imageCache.insert(key, cachedImage, cost); + } else { + *release = true; + } + return surface; +#endif +} + + +void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src) +{ + const QRect sr = src.toRect(); + const QRect dr = transform.mapRect(dest).toRect(); + const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; + DFBResult result; + + if (dr.size() == sr.size()) { + result = surface->Blit(surface, s, &sRect, dr.x(), dr.y()); + } else { + const DFBRectangle dRect = { dr.x(), dr.y(), dr.width(), dr.height() }; + result = surface->StretchBlit(surface, s, &sRect, &dRect); + } + if (result != DFB_OK) + DirectFBError("QDirectFBPaintEngine::drawPixmap()", result); +} + +void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, + const QPixmap &pixmap) +{ + prepareForBlit(pixmap.hasAlphaChannel()); + QPixmapData *data = pixmap.pixmapData(); + Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); + QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); + IDirectFBSurface *s = dfbData->directFBSurface(); + const QRect dr = transform.mapRect(dest).toRect(); + DFBResult result = DFB_OK; + + if (scale == NoScale && dr == QRect(0, 0, fbWidth, fbHeight)) { + result = surface->TileBlit(surface, s, 0, 0, 0); + } else if (scale == NoScale) { + const int dx = pixmap.width(); + const int dy = pixmap.height(); + const DFBRectangle rect = { 0, 0, dx, dy }; + QVarLengthArray<DFBRectangle> rects; + QVarLengthArray<DFBPoint> points; + + for (int y = dr.y(); y <= dr.bottom(); y += dy) { + for (int x = dr.x(); x <= dr.right(); x += dx) { + rects.append(rect); + const DFBPoint point = { x, y }; + points.append(point); + } + } + result = surface->BatchBlit(surface, s, rects.constData(), + points.constData(), points.size()); + } else { + const QRect sr = transform.mapRect(QRect(0, 0, pixmap.width(), pixmap.height())); + const int dx = sr.width(); + const int dy = sr.height(); + const DFBRectangle sRect = { 0, 0, dx, dy }; + + for (int y = dr.y(); y <= dr.bottom(); y += dy) { + for (int x = dr.x(); x <= dr.right(); x += dx) { + const DFBRectangle dRect = { x, y, dx, dy }; + result = surface->StretchBlit(surface, s, &sRect, &dRect); + if (result != DFB_OK) { + y = dr.bottom() + 1; + break; + } + } + } + } + + if (result != DFB_OK) + DirectFBError("QDirectFBPaintEngine::drawTiledPixmap()", result); +} + +void QDirectFBPaintEnginePrivate::updateClip() +{ + if (!dirtyClip) + return; + + const QClipData *clipData = clip(); + if (!clipData || !clipData->enabled) { + surface->SetClip(surface, NULL); + dfbHandledClip = true; + } else if (clipData->hasRectClip) { + const DFBRegion r = { + clipData->clipRect.x(), + clipData->clipRect.y(), + clipData->clipRect.x() + clipData->clipRect.width(), + clipData->clipRect.y() + clipData->clipRect.height() + }; + surface->SetClip(surface, &r); + dfbHandledClip = true; + } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) { + dfbHandledClip = true; + } else { + dfbHandledClip = false; + } + + dirtyClip = false; +} + +void QDirectFBPaintEnginePrivate::systemStateChanged() +{ + dirtyClip = true; + QRasterPaintEnginePrivate::systemStateChanged(); +} + #endif // QT_NO_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index e79ec61..d33255b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -106,6 +106,7 @@ public: virtual void clip(const QVectorPath &path, Qt::ClipOperation op); virtual void clip(const QRect &rect, Qt::ClipOperation op); + static void initImageCache(int size); }; QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index ea9bb3a..c9b676a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -157,6 +157,16 @@ static bool checkForAlphaPixels(const QImage &img) return false; } +bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) +{ +#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION + return ::checkForAlphaPixels(img); +#else + return img.hasAlphaChannel(); +#endif +} + + void QDirectFBPixmapData::fromImage(const QImage &i, Qt::ImageConversionFlags flags) { @@ -166,7 +176,7 @@ void QDirectFBPixmapData::fromImage(const QImage &i, const QImage img = (i.depth() == 1 ? i.convertToFormat(screen->alphaPixmapFormat()) : i); if (img.hasAlphaChannel() #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - && (flags & Qt::NoOpaqueDetection || ::checkForAlphaPixels(img)) + && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) #endif ) { alpha = true; @@ -261,7 +271,7 @@ void QDirectFBPixmapData::fill(const QColor &color) forceRaster = false; setSerialNumber(++global_ser_no); if (!dfbSurface) { - qWarning("QDirecttFBPixmapData::fill()"); + qWarning("QDirectFBPixmapData::fill()"); invalidate(); return; } @@ -357,7 +367,7 @@ QImage QDirectFBPixmapData::toImage() const return img->copy(); } -QPaintEngine* QDirectFBPixmapData::paintEngine() const +QPaintEngine *QDirectFBPixmapData::paintEngine() const { if (!engine) { // QDirectFBPixmapData is also a QCustomRasterPaintDevice, so pass @@ -368,10 +378,15 @@ QPaintEngine* QDirectFBPixmapData::paintEngine() const return engine; } +QImage *QDirectFBPixmapData::buffer() +{ + lockDirectFB(DSLF_READ|DSLF_WRITE); + return lockedImage; +} -QImage* QDirectFBPixmapData::buffer() +QImage * QDirectFBPixmapData::buffer(uint lockFlags) { - lockDirectFB(); + lockDirectFB(lockFlags); return lockedImage; } @@ -381,3 +396,4 @@ void QDirectFBPixmapData::invalidate() alpha = false; format = QImage::Format_Invalid; } + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 6cfafcd..7cd60d6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -69,11 +69,13 @@ public: Qt::TransformationMode mode) const; QImage toImage() const; QPaintEngine* paintEngine() const; - QImage *buffer(); + virtual QImage *buffer(); + QImage *buffer(uint lockFlags); // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice int metric(QPaintDevice::PaintDeviceMetric m) const {return QDirectFBPaintDevice::metric(m);} inline QImage::Format pixelFormat() const { return format; } + static bool hasAlphaChannel(const QImage &img); private: void invalidate(); QDirectFBPaintEngine *engine; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index a53b1c0..98e32ed 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qdirectfbscreen.h" -#include "qdirectfbsurface.h" +#include "qdirectfbwindowsurface.h" #include "qdirectfbpixmap.h" #include "qdirectfbmouse.h" #include "qdirectfbkeyboard.h" @@ -84,7 +84,7 @@ public: QImage::Format alphaPixmapFormat; }; -QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen* screen) +QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *screen) : QWSGraphicsSystem(screen), dfb(0), dfbSurface(0), flipFlags(DSFLIP_NONE) #ifndef QT_NO_DIRECTFB_LAYER , dfbLayer(0) @@ -113,9 +113,9 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() delete keyboard; #endif - foreach (IDirectFBSurface* surf, allocatedSurfaces) - surf->Release(surf); - allocatedSurfaces.clear(); + for (QSet<IDirectFBSurface*>::const_iterator it = allocatedSurfaces.begin(); it != allocatedSurfaces.end(); ++it) { + (*it)->Release(*it); + } if (dfbSurface) dfbSurface->Release(dfbSurface); @@ -137,7 +137,7 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate() // creates a preallocated surface with the same format as the image if // possible. -IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCreationOptions options) +IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCreationOptions options) { if (img.isNull()) // assert? return 0; @@ -155,8 +155,7 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCr return surface; } - DFBSurfaceDescription desc = QDirectFBScreen::getSurfaceDescription(img); - IDirectFBSurface *surface = createDFBSurface(&desc, options); + IDirectFBSurface *surface = createDFBSurface(QDirectFBScreen::getSurfaceDescription(img), options); #ifdef QT_NO_DIRECTFB_PREALLOCATED if (surface) { int bpl; @@ -206,58 +205,61 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, SurfaceCreationOptions options) { DFBSurfaceDescription desc; + memset(&desc, 0, sizeof(DFBSurfaceDescription)); desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH|DSDESC_HEIGHT); if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format)) return 0; desc.width = size.width(); desc.height = size.height(); - return createDFBSurface(&desc, options); + return createDFBSurface(desc, options); } - -IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription *desc, SurfaceCreationOptions options) +IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options) { - DFBResult result; - IDirectFBSurface* newSurface = 0; + DFBResult result = DFB_OK; + IDirectFBSurface *newSurface = 0; if (!d_ptr->dfb) { qWarning("QDirectFBScreen::createDFBSurface() - not connected"); return 0; } - if (d_ptr->directFBFlags & VideoOnly && !(desc->flags & DSDESC_PREALLOCATED)) { + if (d_ptr->directFBFlags & VideoOnly && !(desc.flags & DSDESC_PREALLOCATED)) { // Add the video only capability. This means the surface will be created in video ram - DFBSurfaceDescription voDesc = *desc; - if (!(voDesc.flags & DSDESC_CAPS)) { - voDesc.caps = DSCAPS_VIDEOONLY; - voDesc.flags = DFBSurfaceDescriptionFlags(voDesc.flags | DSDESC_CAPS); + if (!(desc.flags & DSDESC_CAPS)) { + desc.caps = DSCAPS_VIDEOONLY; + desc.flags = DFBSurfaceDescriptionFlags(desc.flags | DSDESC_CAPS); } else { - voDesc.caps = DFBSurfaceCapabilities(voDesc.caps | DSCAPS_VIDEOONLY); + desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_VIDEOONLY); } - result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &voDesc, &newSurface); + result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface); if (result != DFB_OK #ifdef QT_NO_DEBUG - && (desc->flags & DSDESC_CAPS) && (desc->caps & DSCAPS_PRIMARY) + && (desc.flags & DSDESC_CAPS) && (desc.caps & DSCAPS_PRIMARY) #endif ) { qWarning("QDirectFBScreen::createDFBSurface() Failed to create surface in video memory!\n" " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s", - desc->flags, desc->caps, desc->width, desc->height, - desc->pixelformat, DFB_PIXELFORMAT_INDEX(desc->pixelformat), - desc->preallocated[0].data, desc->preallocated[0].pitch, + desc.flags, desc.caps, desc.width, desc.height, + desc.pixelformat, DFB_PIXELFORMAT_INDEX(desc.pixelformat), + desc.preallocated[0].data, desc.preallocated[0].pitch, DirectFBErrorString(result)); } + desc.caps = DFBSurfaceCapabilities(desc.caps & ~DSCAPS_VIDEOONLY); } + if (d_ptr->directFBFlags & SystemOnly) + desc.caps = DFBSurfaceCapabilities(desc.caps | DSCAPS_SYSTEMONLY); + if (!newSurface) - result = d_ptr->dfb->CreateSurface(d_ptr->dfb, desc, &newSurface); + result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface); if (result != DFB_OK) { qWarning("QDirectFBScreen::createDFBSurface() Failed!\n" " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s", - desc->flags, desc->caps, desc->width, desc->height, - desc->pixelformat, DFB_PIXELFORMAT_INDEX(desc->pixelformat), - desc->preallocated[0].data, desc->preallocated[0].pitch, + desc.flags, desc.caps, desc.width, desc.height, + desc.pixelformat, DFB_PIXELFORMAT_INDEX(desc.pixelformat), + desc.preallocated[0].data, desc.preallocated[0].pitch, DirectFBErrorString(result)); return 0; } @@ -292,14 +294,14 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options); if (!dfbSurface) { - qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface"); + qWarning("QDirectFBScreen::copyToDFBSurface() Couldn't create surface"); return 0; } #ifndef QT_NO_DIRECTFB_PREALLOCATED IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface); if (!imgSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); + qWarning("QDirectFBScreen::copyToDFBSurface()"); QDirectFBScreen::releaseDFBSurface(dfbSurface); return 0; } @@ -314,7 +316,7 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, dfbSurface->SetBlittingFlags(dfbSurface, flags); DFBResult result = dfbSurface->Blit(dfbSurface, imgSurface, 0, 0, 0); if (result != DFB_OK) - DirectFBError("QDirectFBPixmapData::fromImage()", result); + DirectFBError("QDirectFBScreen::copyToDFBSurface()", result); dfbSurface->ReleaseSource(dfbSurface); imgSurface->Release(imgSurface); #else // QT_NO_DIRECTFB_PREALLOCATED @@ -349,18 +351,19 @@ QDirectFBScreen::DirectFBFlags QDirectFBScreen::directFBFlags() const { return d_ptr->directFBFlags; } -IDirectFB* QDirectFBScreen::dfb() + +IDirectFB *QDirectFBScreen::dfb() { return d_ptr->dfb; } -IDirectFBSurface* QDirectFBScreen::dfbSurface() +IDirectFBSurface *QDirectFBScreen::dfbSurface() { return d_ptr->dfbSurface; } #ifndef QT_NO_DIRECTFB_LAYER -IDirectFBDisplayLayer* QDirectFBScreen::dfbDisplayLayer() +IDirectFBDisplayLayer *QDirectFBScreen::dfbDisplayLayer() { return d_ptr->dfbLayer; } @@ -443,6 +446,7 @@ QImage::Format QDirectFBScreen::getImageFormat(IDirectFBSurface *surface) DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const QImage &image) { DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); const DFBSurfacePixelFormat format = getSurfacePixelFormat(image.format()); @@ -477,6 +481,7 @@ DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer, int length) { DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS | DSDESC_WIDTH @@ -730,7 +735,7 @@ void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) } } -QPixmapData* QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType type) const { if (type == QPixmapData::BitmapType) return QWSGraphicsSystem::createPixmapData(type); @@ -738,7 +743,85 @@ QPixmapData* QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType typ return new QDirectFBPixmapData(type); } -static void printDirectFBInfo(IDirectFB *fb) +#ifdef QT_NO_DEBUG +struct FlagDescription; +static const FlagDescription *accelerationDescriptions = 0; +static const FlagDescription *blitDescriptions = 0; +static const FlagDescription *drawDescriptions = 0; +#else +struct FlagDescription { + const char *name; + uint flag; +}; + +static const FlagDescription accelerationDescriptions[] = { + { " DFXL_NONE ", DFXL_NONE }, + { " DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE }, + { " DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE }, + { " DFXL_DRAWLINE", DFXL_DRAWLINE }, + { " DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE }, + { " DFXL_BLIT", DFXL_BLIT }, + { " DFXL_STRETCHBLIT", DFXL_STRETCHBLIT }, + { " DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES }, + { " DFXL_DRAWSTRING", DFXL_DRAWSTRING }, + { 0, 0 } +}; + +static const FlagDescription blitDescriptions[] = { + { " DSBLIT_NOFX", DSBLIT_NOFX }, + { " DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL }, + { " DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA }, + { " DSBLIT_COLORIZE", DSBLIT_COLORIZE }, + { " DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY }, + { " DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY }, + { " DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY }, + { " DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY }, + { " DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY }, + { " DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE }, + { " DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR }, + { " DSBLIT_XOR", DSBLIT_XOR }, + { " DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION }, + { 0, 0 } +}; + +static const FlagDescription drawDescriptions[] = { + { " DSDRAW_NOFX", DSDRAW_NOFX }, + { " DSDRAW_BLEND", DSDRAW_BLEND }, + { " DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY }, + { " DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY }, + { " DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY }, + { " DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY }, + { " DSDRAW_XOR", DSDRAW_XOR }, + { 0, 0 } +}; +#endif + + + +static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags) +{ +#ifdef QT_NO_DEBUG + Q_UNUSED(mask); + Q_UNUSED(flags); + return QByteArray(""); +#else + if (!mask) + return flags[0].name; + + QStringList list; + for (int i=1; flags[i].name; ++i) { + if (mask & flags[i].flag) { + list.append(QString::fromLatin1(flags[i].name)); + } + } + Q_ASSERT(!list.isEmpty()); + return (QLatin1Char(' ') + list.join(QLatin1String("|"))).toLatin1(); +#endif +} + + + +static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface) { DFBResult result; DFBGraphicsDeviceDescription dev; @@ -749,11 +832,18 @@ static void printDirectFBInfo(IDirectFB *fb) return; } - qDebug("Device: %s (%s), Driver: %s v%i.%i (%s)\n" - " acceleration: 0x%x, blit: 0x%x, draw: 0x%0x video: %i\n", + DFBSurfacePixelFormat pixelFormat; + primarySurface->GetPixelFormat(primarySurface, &pixelFormat); + + qDebug("Device: %s (%s), Driver: %s v%i.%i (%s) Pixelformat: %d (%d)\n" + "acceleration: 0x%x%s\nblit: 0x%x%s\ndraw: 0x%0x%s\nvideo: %iKB\n", dev.name, dev.vendor, dev.driver.name, dev.driver.major, - dev.driver.minor, dev.driver.vendor, dev.acceleration_mask, - dev.blitting_flags, dev.drawing_flags, dev.video_memory); + dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat), + QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask, + ::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(), + dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(), + dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(), + (dev.video_memory >> 10)); } static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value) @@ -800,12 +890,27 @@ bool QDirectFBScreen::connect(const QString &displaySpec) return false; } - if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) - printDirectFBInfo(d_ptr->dfb); - if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive)) d_ptr->directFBFlags |= VideoOnly; + if (displayArgs.contains(QLatin1String("systemonly"), Qt::CaseInsensitive)) { + if (d_ptr->directFBFlags & VideoOnly) { + qWarning("QDirectFBScreen: error. videoonly and systemonly are mutually exclusive"); + } else { + d_ptr->directFBFlags |= SystemOnly; + } + } + + if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) { + d_ptr->directFBFlags |= BoundingRectFlip; + } + +#ifdef QT_DIRECTFB_IMAGECACHE + int imageCacheSize = 4 * 1024 * 1024; // 4 MB + ::setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize); + QDirectFBPaintEngine::initImageCache(imageCacheSize); +#endif + if (displayArgs.contains(QLatin1String("ignoresystemclip"), Qt::CaseInsensitive)) d_ptr->directFBFlags |= IgnoreSystemClip; @@ -815,14 +920,30 @@ bool QDirectFBScreen::connect(const QString &displaySpec) d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN); DFBSurfaceDescription description; + memset(&description, 0, sizeof(DFBSurfaceDescription)); + description.flags = DFBSurfaceDescriptionFlags(DSDESC_CAPS); if (::setIntOption(displayArgs, QLatin1String("width"), &description.width)) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH); if (::setIntOption(displayArgs, QLatin1String("height"), &description.height)) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_HEIGHT); + uint caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE; - if (displayArgs.contains(QLatin1String("static_alloc"))) - caps |= DSCAPS_STATIC_ALLOC; + struct { + const char *name; + const DFBSurfaceCapabilities cap; + } const capabilities[] = { + { "static_alloc", DSCAPS_STATIC_ALLOC }, + { "triplebuffer", DSCAPS_TRIPLE }, + { "interlaced", DSCAPS_INTERLACED }, + { "separated", DSCAPS_SEPARATED }, +// { "depthbuffer", DSCAPS_DEPTH }, // only makes sense with TextureTriangles which are not supported + { 0, DSCAPS_NONE } + }; + for (int i=0; capabilities[i].name; ++i) { + if (displayArgs.contains(QString::fromLatin1(capabilities[i].name), Qt::CaseInsensitive)) + caps |= capabilities[i].cap; + } if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) { caps |= DSCAPS_PREMULTIPLIED; @@ -830,13 +951,16 @@ bool QDirectFBScreen::connect(const QString &displaySpec) description.caps = DFBSurfaceCapabilities(caps); // We don't track the primary surface as it's released in disconnect - d_ptr->dfbSurface = createDFBSurface(&description, DontTrackSurface); + d_ptr->dfbSurface = createDFBSurface(description, DontTrackSurface); if (!d_ptr->dfbSurface) { DirectFBError("QDirectFBScreen: error creating primary surface", result); return false; } + if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) + printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface); + // Work out what format we're going to use for surfaces with an alpha channel d_ptr->alphaPixmapFormat = QDirectFBScreen::getImageFormat(d_ptr->dfbSurface); setPixelFormat(d_ptr->alphaPixmapFormat); @@ -921,7 +1045,7 @@ void QDirectFBScreen::disconnect() d_ptr->dfbSurface->Release(d_ptr->dfbSurface); d_ptr->dfbSurface = 0; - foreach (IDirectFBSurface* surf, d_ptr->allocatedSurfaces) + foreach (IDirectFBSurface *surf, d_ptr->allocatedSurfaces) surf->Release(surf); d_ptr->allocatedSurfaces.clear(); @@ -990,23 +1114,23 @@ void QDirectFBScreen::blank(bool on) (on ? DSPM_ON : DSPM_SUSPEND)); } -QWSWindowSurface* QDirectFBScreen::createSurface(QWidget *widget) const +QWSWindowSurface *QDirectFBScreen::createSurface(QWidget *widget) const { #ifdef QT_NO_DIRECTFB_WM if (QApplication::type() == QApplication::GuiServer) { - return new QDirectFBSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget); + return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget); } else { return QScreen::createSurface(widget); } #else - return new QDirectFBSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget); + return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this), widget); #endif } -QWSWindowSurface* QDirectFBScreen::createSurface(const QString &key) const +QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const { if (key == QLatin1String("directfb")) { - return new QDirectFBSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this)); + return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast<QDirectFBScreen*>(this)); } return QScreen::createSurface(key); } @@ -1039,7 +1163,7 @@ void QDirectFBScreen::compose(const QRegion ®ion) const QPoint offset = win->requestedRegion().boundingRect().topLeft(); if (surface->key() == QLatin1String("directfb")) { - QDirectFBSurface *s = static_cast<QDirectFBSurface*>(surface); + QDirectFBWindowSurface *s = static_cast<QDirectFBWindowSurface*>(surface); blit(s->directFBSurface(), offset, r); } else { blit(surface->image(), offset, r); @@ -1088,7 +1212,7 @@ void QDirectFBScreen::compose(const QRegion ®ion) const QPoint offset = win->requestedRegion().boundingRect().topLeft(); if (surface->key() == QLatin1String("directfb")) { - QDirectFBSurface *s = static_cast<QDirectFBSurface*>(surface); + QDirectFBWindowSurface *s = static_cast<QDirectFBWindowSurface*>(surface); blit(s->directFBSurface(), offset, r); } else { blit(surface->image(), offset, r); @@ -1228,12 +1352,12 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d return true; } -uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) +uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, uint flags, int *bpl) { void *mem; - const DFBResult result = surface->Lock(surface, flags, static_cast<void**>(&mem), bpl); + const DFBResult result = surface->Lock(surface, static_cast<DFBSurfaceLockFlags>(flags), static_cast<void**>(&mem), bpl); if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::lockSurface()", result); + DirectFBError("QDirectFBScreen::lockSurface()", result); } return reinterpret_cast<uchar*>(mem); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 8e75277..84199a2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -62,7 +62,9 @@ public: enum DirectFBFlag { NoFlags = 0x00, VideoOnly = 0x01, - IgnoreSystemClip = 0x02 + SystemOnly = 0x02, + IgnoreSystemClip = 0x04, + BoundingRectFlip = 0x08 }; Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag); @@ -82,19 +84,19 @@ public: void setMode(int width, int height, int depth); void blank(bool on); - QWSWindowSurface* createSurface(QWidget *widget) const; - QWSWindowSurface* createSurface(const QString &key) const; + QWSWindowSurface *createSurface(QWidget *widget) const; + QWSWindowSurface *createSurface(const QString &key) const; - static inline QDirectFBScreen* instance() { + static inline QDirectFBScreen *instance() { QScreen *inst = QScreen::instance(); Q_ASSERT(!inst || inst->classId() == QScreen::DirectFBClass); return static_cast<QDirectFBScreen*>(inst); } - IDirectFB* dfb(); - IDirectFBSurface* dfbSurface(); + IDirectFB *dfb(); + IDirectFBSurface *dfbSurface(); #ifndef QT_NO_DIRECTFB_LAYER - IDirectFBDisplayLayer* dfbDisplayLayer(); + IDirectFBDisplayLayer *dfbDisplayLayer(); #endif // Track surface creation/release so we can release all on exit @@ -103,8 +105,6 @@ public: TrackSurface = 1 }; Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption); - IDirectFBSurface *createDFBSurface(const DFBSurfaceDescription *desc, - SurfaceCreationOptions options); IDirectFBSurface *createDFBSurface(const QImage &image, SurfaceCreationOptions options); IDirectFBSurface *createDFBSurface(const QSize &size, @@ -116,7 +116,7 @@ public: IDirectFBSurface *copyToDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options); - void releaseDFBSurface(IDirectFBSurface* surface); + void releaseDFBSurface(IDirectFBSurface *surface); static int depth(DFBSurfacePixelFormat format); @@ -128,6 +128,7 @@ public: static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format); static inline bool isPremultiplied(QImage::Format format); static inline bool hasAlpha(DFBSurfacePixelFormat format); + static inline bool hasAlpha(IDirectFBSurface *surface); QImage::Format alphaPixmapFormat() const; #ifndef QT_NO_DIRECTFB_PALETTE @@ -135,14 +136,17 @@ public: const QImage &image); #endif - static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0); + static uchar *lockSurface(IDirectFBSurface *surface, uint flags, int *bpl = 0); private: + IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, + SurfaceCreationOptions options); void compose(const QRegion &r); void blit(IDirectFBSurface *src, const QPoint &topLeft, const QRegion ®ion); QDirectFBScreenPrivate *d_ptr; + friend class SurfaceCache; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); @@ -184,6 +188,14 @@ inline bool QDirectFBScreen::hasAlpha(DFBSurfacePixelFormat format) } } +inline bool QDirectFBScreen::hasAlpha(IDirectFBSurface *surface) +{ + Q_ASSERT(surface); + DFBSurfacePixelFormat format; + surface->GetPixelFormat(surface, &format); + return QDirectFBScreen::hasAlpha(format); +} + QT_END_HEADER #endif // QDIRECTFBSCREEN_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 257efeb..cd8796b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qdirectfbsurface.h" +#include "qdirectfbwindowsurface.h" #include "qdirectfbscreen.h" #include "qdirectfbpaintengine.h" @@ -50,13 +50,14 @@ //#define QT_DIRECTFB_DEBUG_SURFACES 1 -QDirectFBSurface::QDirectFBSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen* scr) +QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) : QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) #endif , engine(0) , flipFlags(flip) + , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) { setSurfaceFlags(Opaque | Buffered); #ifdef QT_DIRECTFB_TIMING @@ -65,13 +66,14 @@ QDirectFBSurface::QDirectFBSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen* sc #endif } -QDirectFBSurface::QDirectFBSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget) +QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget) : QWSWindowSurface(widget), QDirectFBPaintDevice(scr) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) #endif , engine(0) , flipFlags(flip) + , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) { onscreen = widget->testAttribute(Qt::WA_PaintOnScreen); if (onscreen) @@ -84,17 +86,17 @@ QDirectFBSurface::QDirectFBSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *sc #endif } -QDirectFBSurface::~QDirectFBSurface() +QDirectFBWindowSurface::~QDirectFBWindowSurface() { } -bool QDirectFBSurface::isValid() const +bool QDirectFBWindowSurface::isValid() const { return true; } #ifndef QT_NO_DIRECTFB_WM -void QDirectFBSurface::createWindow() +void QDirectFBWindowSurface::createWindow() { #ifdef QT_NO_DIRECTFB_LAYER #warning QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM @@ -130,7 +132,7 @@ void QDirectFBSurface::createWindow() } #endif // QT_NO_DIRECTFB_WM -void QDirectFBSurface::setGeometry(const QRect &rect, const QRegion &mask) +void QDirectFBWindowSurface::setGeometry(const QRect &rect, const QRegion &mask) { if (rect.isNull()) { #ifndef QT_NO_DIRECTFB_WM @@ -176,15 +178,7 @@ void QDirectFBSurface::setGeometry(const QRect &rect, const QRegion &mask) "Unable to get DirectFB handle!"); } - DFBSurfaceDescription description; - description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | - DSDESC_HEIGHT | - DSDESC_PIXELFORMAT); - description.width = rect.width(); - description.height = rect.height(); - QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, - screen->pixelFormat()); - dfbSurface = screen->createDFBSurface(&description, false); + dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface); forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); } else { Q_ASSERT(dfbSurface); @@ -209,13 +203,13 @@ void QDirectFBSurface::setGeometry(const QRect &rect, const QRegion &mask) } if (result != DFB_OK) - DirectFBErrorFatal("QDirectFBSurface::setGeometry()", result); + DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); } QWSWindowSurface::setGeometry(rect, mask); } -QByteArray QDirectFBSurface::permanentState() const +QByteArray QDirectFBWindowSurface::permanentState() const { QByteArray array; #ifdef QT_NO_DIRECTFB_WM @@ -234,7 +228,7 @@ QByteArray QDirectFBSurface::permanentState() const return array; } -void QDirectFBSurface::setPermanentState(const QByteArray &state) +void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) { SurfaceFlags flags; const char *ptr = state.constData(); @@ -248,7 +242,7 @@ void QDirectFBSurface::setPermanentState(const QByteArray &state) #endif } -bool QDirectFBSurface::scroll(const QRegion ®ion, int dx, int dy) +bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) { if (!dfbSurface || !(flipFlags & DSFLIP_BLIT)) return false; @@ -276,7 +270,7 @@ bool QDirectFBSurface::scroll(const QRegion ®ion, int dx, int dy) return true; } -bool QDirectFBSurface::move(const QPoint &offset) +bool QDirectFBWindowSurface::move(const QPoint &offset) { QWSWindowSurface::move(offset); @@ -291,7 +285,7 @@ bool QDirectFBSurface::move(const QPoint &offset) #endif } -QRegion QDirectFBSurface::move(const QPoint &offset, const QRegion &newClip) +QRegion QDirectFBWindowSurface::move(const QPoint &offset, const QRegion &newClip) { #ifdef QT_NO_DIRECTFB_WM return QWSWindowSurface::move(offset, newClip); @@ -304,10 +298,10 @@ QRegion QDirectFBSurface::move(const QPoint &offset, const QRegion &newClip) #endif } -QPaintEngine* QDirectFBSurface::paintEngine() const +QPaintEngine* QDirectFBWindowSurface::paintEngine() const { if (!engine) { - QDirectFBSurface *that = const_cast<QDirectFBSurface*>(this); + QDirectFBWindowSurface *that = const_cast<QDirectFBWindowSurface*>(this); that->engine = new QDirectFBPaintEngine(that); return that->engine; } @@ -337,8 +331,8 @@ inline bool isWidgetOpaque(const QWidget *w) return false; } -void QDirectFBSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) +void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, + const QPoint &offset) { Q_UNUSED(widget); #ifdef QT_NO_DIRECTFB_WM @@ -369,20 +363,15 @@ void QDirectFBSurface::flush(QWidget *widget, const QRegion ®ion, if (!(flipFlags & DSFLIP_BLIT)) { dfbSurface->Flip(dfbSurface, 0, flipFlags); } else { - if (region.numRects() > 1) { + if (!boundingRectFlip && region.numRects() > 1) { const QVector<QRect> rects = region.rects(); - DFBSurfaceFlipFlags tmpFlags = flipFlags; - if (flipFlags & DSFLIP_WAIT) - tmpFlags = DFBSurfaceFlipFlags(flipFlags & ~DSFLIP_WAIT); + const DFBSurfaceFlipFlags nonWaitFlags = DFBSurfaceFlipFlags(flipFlags & ~DSFLIP_WAIT); for (int i=0; i<rects.size(); ++i) { const QRect &r = rects.at(i); const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(), r.x() + r.width() + offset.x(), r.y() + r.height() + offset.y() }; - dfbSurface->Flip(dfbSurface, &dfbReg, - i + 1 < rects.size() - ? tmpFlags - : flipFlags); + dfbSurface->Flip(dfbSurface, &dfbReg, i + 1 < rects.size() ? nonWaitFlags : flipFlags); } } else { const QRect r = region.boundingRect(); @@ -405,15 +394,15 @@ void QDirectFBSurface::flush(QWidget *widget, const QRegion ®ion, } -void QDirectFBSurface::beginPaint(const QRegion &) +void QDirectFBWindowSurface::beginPaint(const QRegion &) { } -void QDirectFBSurface::endPaint(const QRegion &) +void QDirectFBWindowSurface::endPaint(const QRegion &) { #ifdef QT_DIRECTFB_DEBUG_SURFACES if (bufferImages.count()) { - qDebug("QDirectFBSurface::endPaint() this=%p", this); + qDebug("QDirectFBWindowSurface::endPaint() this=%p", this); foreach(QImage* bufferImg, bufferImages) qDebug(" Deleting buffer image %p", bufferImg); @@ -426,7 +415,7 @@ void QDirectFBSurface::endPaint(const QRegion &) } -QImage* QDirectFBSurface::buffer(const QWidget *widget) +QImage *QDirectFBWindowSurface::buffer(const QWidget *widget) { if (!lockedImage) return 0; @@ -444,7 +433,7 @@ QImage* QDirectFBSurface::buffer(const QWidget *widget) bufferImages.append(img); #ifdef QT_DIRECTFB_DEBUG_SURFACES - qDebug("QDirectFBSurface::buffer() Created & returned %p", img); + qDebug("QDirectFBWindowSurface::buffer() Created & returned %p", img); #endif return img; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index ab4145d..75998c4 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -58,12 +58,12 @@ QT_BEGIN_HEADER QT_MODULE(Gui) -class QDirectFBSurface: public QWSWindowSurface, public QDirectFBPaintDevice +class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice { public: - QDirectFBSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr); - QDirectFBSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr, QWidget *widget); - ~QDirectFBSurface(); + QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr); + QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr, QWidget *widget); + ~QDirectFBWindowSurface(); bool isValid() const; @@ -79,15 +79,15 @@ public: QRegion move(const QPoint &offset, const QRegion &newClip); QImage image() const { return QImage(); } - QPaintDevice* paintDevice() { return this; } - QPaintEngine* paintEngine() const; + QPaintDevice *paintDevice() { return this; } + QPaintEngine *paintEngine() const; void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void beginPaint(const QRegion &); void endPaint(const QRegion &); - QImage* buffer(const QWidget *widget); + QImage *buffer(const QWidget *widget); private: #ifndef QT_NO_DIRECTFB_WM @@ -100,6 +100,7 @@ private: QList<QImage*> bufferImages; DFBSurfaceFlipFlags flipFlags; + bool boundingRectFlip; #ifdef QT_DIRECTFB_TIMING int frames; QTime timer; diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro b/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro index b62894d..9331d0a 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro @@ -22,3 +22,5 @@ LIBS += -lpvr2d DESTDIR = $$QMAKE_LIBDIR_QT target.path = $$[QT_INSTALL_LIBS] INSTALLS += target + +include(../powervr.pri)
\ No newline at end of file diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index ec02efb..4dce87f 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -29,12 +29,13 @@ strictly Unix-style markers. *************************************************************************** * IMPORTANT: To build the QScreen plugin and the WSEGL library it depends * -* on, the pvr2d.h, wsegl.h headers for your platform are required. These * -* can be obtained either through your platform provider or directly from * -* Imagination Technologies. * +* on, the pvr2d.h, wsegl.h headers for your platform are required. You * +* can find a copy of these headers in src/3rdparty/powervr for SGX based * +* platforms like the TI OMAP3xxx. They may also work on MBX platforms too * +* depending on how old your libEGL is. You can tell Qt where to find * +* these headers by setting QMAKE_INCDIR_POWERVR in the mkspec. * *************************************************************************** - When you start a Qt/Embedded application, you should modify the QWS_DISPLAY environment variable to use the "powervr" driver instead of "LinuxFb". For example, if your original QWS_DISPLAY variable was: diff --git a/src/plugins/gfxdrivers/powervr/powervr.pri b/src/plugins/gfxdrivers/powervr/powervr.pri new file mode 100644 index 0000000..9df8c0e --- /dev/null +++ b/src/plugins/gfxdrivers/powervr/powervr.pri @@ -0,0 +1,2 @@ + +INCLUDEPATH += $$QMAKE_INCDIR_POWERVR diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro index 691cd2d..675be85 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro @@ -9,9 +9,10 @@ DEFINES += QT_QWS_CLIENTBLIT INCLUDEPATH += ../QWSWSEGL + HEADERS = \ - pvreglscreen.h \ - pvreglwindowsurface.h + pvreglscreen.h \ + pvreglwindowsurface.h SOURCES = \ pvreglscreenplugin.cpp \ @@ -22,3 +23,5 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers INSTALLS += target + +include(../powervr.pri)
\ No newline at end of file diff --git a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp index c7249d3..3273513 100644 --- a/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp +++ b/src/plugins/iconengines/svgiconengine/qsvgiconengine.cpp @@ -122,16 +122,10 @@ QSize QSvgIconEngine::actualSize(const QSize &size, QIcon::Mode mode, return size; } - QSvgRenderer renderer; - d->loadDataForModeAndState(&renderer, mode, state); - if (renderer.isValid()) { - QSize defaultSize = renderer.defaultSize(); - if (!defaultSize.isNull()) - defaultSize.scale(size, Qt::KeepAspectRatio); - return defaultSize; - } else { + QPixmap pm = pixmap(size, mode, state); + if (pm.isNull()) return QSize(); - } + return pm.size(); } void QSvgIconEnginePrivate::loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state) diff --git a/src/qbase.pri b/src/qbase.pri index 9ba8e70..0ab04e6 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -67,11 +67,6 @@ mac:!static:contains(QT_CONFIG, qt_framework) { mac { CONFIG += explicitlib - true { #we want to use O2 on Qt itself (Os was used to fix other failures in older GCC) - QMAKE_CFLAGS_RELEASE ~= s,-Os,-O2, - QMAKE_CXXFLAGS_RELEASE ~= s,-Os,-O2, - QMAKE_OBJECTIVE_CFLAGS_RELEASE ~= s,-Os,-O2, - } macx-g++ { QMAKE_CFLAGS += -fconstant-cfstrings QMAKE_CXXFLAGS += -fconstant-cfstrings diff --git a/src/script/qscriptvalueiterator.cpp b/src/script/qscriptvalueiterator.cpp index fe5ef9f..1a60632 100644 --- a/src/script/qscriptvalueiterator.cpp +++ b/src/script/qscriptvalueiterator.cpp @@ -106,6 +106,7 @@ QScriptValueIteratorPrivate::QScriptValueIteratorPrivate() */ QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate() { + delete it; } /*! @@ -130,7 +131,6 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object) QScriptValueIterator::~QScriptValueIterator() { if (d_ptr) { - delete d_ptr->it; delete d_ptr; d_ptr = 0; } @@ -312,7 +312,7 @@ void QScriptValueIterator::remove() QScriptValueIterator& QScriptValueIterator::operator=(QScriptValue &object) { if (d_ptr) { - delete d_ptr->it; + delete d_ptr; d_ptr = 0; } QScriptValueImpl val = QScriptValuePrivate::valueOf(object); diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 9eeb41d..6834d9a 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -871,7 +871,7 @@ QIBaseResult::~QIBaseResult() bool QIBaseResult::prepare(const QString& query) { - //qDebug("prepare: %s\n", qPrintable(query)); +// qDebug("prepare: %s", qPrintable(query)); if (!driver() || !driver()->isOpen() || driver()->isOpenError()) return false; d->cleanup(); @@ -1025,7 +1025,7 @@ bool QIBaseResult::exec() } if (ok) { - if (colCount()) { + if (colCount() && d->queryType != isc_info_sql_stmt_exec_procedure) { isc_dsql_free_statement(d->status, &d->stmt, DSQL_close); if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement"))) return false; @@ -1039,7 +1039,7 @@ bool QIBaseResult::exec() return false; // Not all stored procedures necessarily return values. - if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda->sqld == 0) + if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda && d->sqlda->sqld == 0) delDA(d->sqlda); if (d->sqlda) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index a84e840..fbefa0c 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -163,18 +163,21 @@ static inline QVariant qDateTimeFromString(QString &val) #endif } -class QMYSQLResultPrivate +class QMYSQLResultPrivate : public QObject { + Q_OBJECT public: - QMYSQLResultPrivate(QMYSQLDriverPrivate* dp) : d(dp), result(0), + QMYSQLResultPrivate(const QMYSQLDriver* dp) : driver(dp), result(0), rowsAffected(0), hasBlobs(false) #if MYSQL_VERSION_ID >= 40108 , stmt(0), meta(0), inBinds(0), outBinds(0) #endif , precisionPolicy(QSql::HighPrecision) - {} + { + connect(dp, SIGNAL(destroyed()), this, SLOT(driverDestroyed())); + } - QMYSQLDriverPrivate* d; + const QMYSQLDriver* driver; MYSQL_RES *result; MYSQL_ROW row; @@ -207,6 +210,8 @@ public: MYSQL_BIND *outBinds; #endif QSql::NumericalPrecisionPolicy precisionPolicy; +private Q_SLOTS: + void driverDestroyed() { driver = NULL; } }; #ifndef QT_NO_TEXTCODEC @@ -224,7 +229,7 @@ static QTextCodec* codec(MYSQL* mysql) static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, const QMYSQLDriverPrivate* p) { - const char *cerr = mysql_error(p->mysql); + const char *cerr = p->mysql ? mysql_error(p->mysql) : 0; return QSqlError(QLatin1String("QMYSQL: ") + err, p->tc ? toUnicode(p->tc, cerr) : QString::fromLatin1(cerr), type, mysql_errno(p->mysql)); @@ -379,7 +384,7 @@ bool QMYSQLResultPrivate::bindInValues() QMYSQLResult::QMYSQLResult(const QMYSQLDriver* db) : QSqlResult(db) { - d = new QMYSQLResultPrivate(db->d); + d = new QMYSQLResultPrivate(db); } QMYSQLResult::~QMYSQLResult() @@ -391,7 +396,7 @@ QMYSQLResult::~QMYSQLResult() QVariant QMYSQLResult::handle() const { #if MYSQL_VERSION_ID >= 40108 - if(d->d->preparedQuerys) + if(d->driver && d->driver->d->preparedQuerys) return d->meta ? qVariantFromValue(d->meta) : qVariantFromValue(d->stmt); else #endif @@ -406,8 +411,8 @@ void QMYSQLResult::cleanup() // must iterate trough leftover result sets from multi-selects or stored procedures // if this isn't done subsequent queries will fail with "Commands out of sync" #if MYSQL_VERSION_ID >= 40100 - while (d->d->mysql && mysql_next_result(d->d->mysql) == 0) { - MYSQL_RES *res = mysql_store_result(d->d->mysql); + while (d->driver && d->driver->d->mysql && mysql_next_result(d->driver->d->mysql) == 0) { + MYSQL_RES *res = mysql_store_result(d->driver->d->mysql); if (res) mysql_free_result(res); } @@ -447,11 +452,14 @@ void QMYSQLResult::cleanup() setAt(-1); setActive(false); - d->d->preparedQuerys = d->d->preparedQuerysEnabled; + if(d->driver) + d->driver->d->preparedQuerys = d->driver->d->preparedQuerysEnabled; } bool QMYSQLResult::fetch(int i) { + if(!d->driver) + return false; if (isForwardOnly()) { // fake a forward seek if (at() < i) { int x = i - at(); @@ -463,7 +471,7 @@ bool QMYSQLResult::fetch(int i) } if (at() == i) return true; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 mysql_stmt_data_seek(d->stmt, i); @@ -494,7 +502,9 @@ bool QMYSQLResult::fetch(int i) bool QMYSQLResult::fetchNext() { - if (d->d->preparedQuerys) { + if(!d->driver) + return false; + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 if (mysql_stmt_fetch(d->stmt)) return false; @@ -512,6 +522,8 @@ bool QMYSQLResult::fetchNext() bool QMYSQLResult::fetchLast() { + if(!d->driver) + return false; if (isForwardOnly()) { // fake this since MySQL can't seek on forward only queries bool success = fetchNext(); // did we move at all? while (fetchNext()) {}; @@ -519,7 +531,7 @@ bool QMYSQLResult::fetchLast() } my_ulonglong numRows; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 numRows = mysql_stmt_num_rows(d->stmt); #else @@ -553,15 +565,18 @@ QVariant QMYSQLResult::data(int field) return QVariant(); } + if (!d->driver) + return QVariant(); + int fieldLength = 0; const QMYSQLResultPrivate::QMyField &f = d->fields.at(field); QString val; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { if (f.nullIndicator) return QVariant(f.type); if (f.type != QVariant::ByteArray) - val = toUnicode(d->d->tc, f.outField, f.bufLength); + val = toUnicode(d->driver->d->tc, f.outField, f.bufLength); } else { if (d->row[field] == NULL) { // NULL value @@ -569,7 +584,7 @@ QVariant QMYSQLResult::data(int field) } fieldLength = mysql_fetch_lengths(d->result)[field]; if (f.type != QVariant::ByteArray) - val = toUnicode(d->d->tc, d->row[field], fieldLength); + val = toUnicode(d->driver->d->tc, d->row[field], fieldLength); } switch(f.type) { @@ -614,7 +629,7 @@ QVariant QMYSQLResult::data(int field) case QVariant::ByteArray: { QByteArray ba; - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { ba = QByteArray(f.outField, f.bufLength); } else { ba = QByteArray(d->row[field], fieldLength); @@ -631,7 +646,7 @@ QVariant QMYSQLResult::data(int field) bool QMYSQLResult::isNull(int field) { - if (d->d->preparedQuerys) + if (d->driver->d->preparedQuerys) return d->fields.at(field).nullIndicator; else return d->row[field] == NULL; @@ -639,31 +654,31 @@ bool QMYSQLResult::isNull(int field) bool QMYSQLResult::reset (const QString& query) { - if (!driver() || !driver()->isOpen() || driver()->isOpenError()) + if (!driver() || !driver()->isOpen() || driver()->isOpenError() || !d->driver) return false; - if(d->d->preparedQuerysEnabled && prepare(query)) { - d->d->preparedQuerys = true; + if(d->driver->d->preparedQuerysEnabled && prepare(query)) { + d->driver->d->preparedQuerys = true; return exec(); } - d->d->preparedQuerys = false; + d->driver->d->preparedQuerys = false; - const QByteArray encQuery(fromUnicode(d->d->tc, query)); - if (mysql_real_query(d->d->mysql, encQuery.data(), encQuery.length())) { + const QByteArray encQuery(fromUnicode(d->driver->d->tc, query)); + if (mysql_real_query(d->driver->d->mysql, encQuery.data(), encQuery.length())) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute query"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } - d->result = mysql_store_result(d->d->mysql); - if (!d->result && mysql_field_count(d->d->mysql) > 0) { + d->result = mysql_store_result(d->driver->d->mysql); + if (!d->result && mysql_field_count(d->driver->d->mysql) > 0) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store result"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } - int numFields = mysql_field_count(d->d->mysql); + int numFields = mysql_field_count(d->driver->d->mysql); setSelect(numFields != 0); d->fields.resize(numFields); - d->rowsAffected = mysql_affected_rows(d->d->mysql); + d->rowsAffected = mysql_affected_rows(d->driver->d->mysql); if (isSelect()) { for(int i = 0; i < numFields; i++) { MYSQL_FIELD* field = mysql_fetch_field_direct(d->result, i); @@ -677,8 +692,8 @@ bool QMYSQLResult::reset (const QString& query) int QMYSQLResult::size() { - if (isSelect()) - if (d->d->preparedQuerys) + if (d->driver && isSelect()) + if (d->driver->d->preparedQuerys) #if MYSQL_VERSION_ID >= 40108 return mysql_stmt_num_rows(d->stmt); #else @@ -697,17 +712,17 @@ int QMYSQLResult::numRowsAffected() QVariant QMYSQLResult::lastInsertId() const { - if (!isActive()) + if (!isActive() || !d->driver) return QVariant(); - if (d->d->preparedQuerys) { + if (d->driver->d->preparedQuerys) { #if MYSQL_VERSION_ID >= 40108 quint64 id = mysql_stmt_insert_id(d->stmt); if (id) return QVariant(id); #endif } else { - quint64 id = mysql_insert_id(d->d->mysql); + quint64 id = mysql_insert_id(d->driver->d->mysql); if (id) return QVariant(id); } @@ -718,20 +733,20 @@ QSqlRecord QMYSQLResult::record() const { QSqlRecord info; MYSQL_RES *res; - if (!isActive() || !isSelect()) + if (!isActive() || !isSelect() || !d->driver) return info; #if MYSQL_VERSION_ID >= 40108 - res = d->d->preparedQuerys ? d->meta : d->result; + res = d->driver->d->preparedQuerys ? d->meta : d->result; #else res = d->result; #endif - if (!mysql_errno(d->d->mysql)) { + if (!mysql_errno(d->driver->d->mysql)) { mysql_field_seek(res, 0); MYSQL_FIELD* field = mysql_fetch_field(res); while(field) { - info.append(qToField(field, d->d->tc)); + info.append(qToField(field, d->driver->d->tc)); field = mysql_fetch_field(res); } } @@ -741,6 +756,8 @@ QSqlRecord QMYSQLResult::record() const bool QMYSQLResult::nextResult() { + if(!d->driver) + return false; #if MYSQL_VERSION_ID >= 40100 setAt(-1); setActive(false); @@ -754,26 +771,26 @@ bool QMYSQLResult::nextResult() delete[] d->fields[i].outField; d->fields.clear(); - int status = mysql_next_result(d->d->mysql); + int status = mysql_next_result(d->driver->d->mysql); if (status > 0) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to execute next query"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } else if (status == -1) { return false; // No more result sets } - d->result = mysql_store_result(d->d->mysql); - int numFields = mysql_field_count(d->d->mysql); + d->result = mysql_store_result(d->driver->d->mysql); + int numFields = mysql_field_count(d->driver->d->mysql); if (!d->result && numFields > 0) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to store next result"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } setSelect(numFields > 0); d->fields.resize(numFields); - d->rowsAffected = mysql_affected_rows(d->d->mysql); + d->rowsAffected = mysql_affected_rows(d->driver->d->mysql); if (isSelect()) { for (int i = 0; i < numFields; i++) { @@ -833,9 +850,11 @@ static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type) bool QMYSQLResult::prepare(const QString& query) { + if(!d->driver) + return false; #if MYSQL_VERSION_ID >= 40108 cleanup(); - if (!d->d->preparedQuerys) + if (!d->driver->d->preparedQuerys) return QSqlResult::prepare(query); int r; @@ -844,14 +863,14 @@ bool QMYSQLResult::prepare(const QString& query) return false; if (!d->stmt) - d->stmt = mysql_stmt_init(d->d->mysql); + d->stmt = mysql_stmt_init(d->driver->d->mysql); if (!d->stmt) { setLastError(qMakeError(QCoreApplication::translate("QMYSQLResult", "Unable to prepare statement"), - QSqlError::StatementError, d->d)); + QSqlError::StatementError, d->driver->d)); return false; } - const QByteArray encQuery(fromUnicode(d->d->tc, query)); + const QByteArray encQuery(fromUnicode(d->driver->d->tc, query)); r = mysql_stmt_prepare(d->stmt, encQuery.constData(), encQuery.length()); if (r != 0) { setLastError(qMakeStmtError(QCoreApplication::translate("QMYSQLResult", @@ -873,7 +892,9 @@ bool QMYSQLResult::prepare(const QString& query) bool QMYSQLResult::exec() { - if (!d->d->preparedQuerys) + if (!d->driver) + return false; + if (!d->driver->d->preparedQuerys) return QSqlResult::exec(); if (!d->stmt) return false; @@ -963,7 +984,7 @@ bool QMYSQLResult::exec() break; case QVariant::String: default: { - QByteArray ba = fromUnicode(d->d->tc, val.toString()); + QByteArray ba = fromUnicode(d->driver->d->tc, val.toString()); stringVector.append(ba); currBind->buffer_type = MYSQL_TYPE_STRING; currBind->buffer = const_cast<char *>(ba.constData()); @@ -1459,3 +1480,5 @@ bool QMYSQLDriver::isIdentifierEscapedImplementation(const QString &identifier, } QT_END_NAMESPACE + +#include "qsql_mysql.moc"
\ No newline at end of file diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 4e90777..ee500a0 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -70,13 +70,12 @@ QT_BEGIN_NAMESPACE #endif // newer platform SDKs use SQLLEN instead of SQLINTEGER -//#if defined(SQLLEN) || defined(Q_OS_WIN64) -#if ODBCVER >= 0x0270 -# define QSQLLEN SQLLEN -# define QSQLULEN SQLULEN -#else +#if defined(WIN32) && (_MSC_VER < 1300) # define QSQLLEN SQLINTEGER # define QSQLULEN SQLUINTEGER +#else +# define QSQLLEN SQLLEN +# define QSQLULEN SQLULEN #endif @@ -564,7 +563,6 @@ QChar QODBCDriverPrivate::quoteChar() const static QChar quote = QChar::fromLatin1('"'); if (!isQuoteInitialized) { char driverResponse[4]; - SQLUSMALLINT casing; SQLSMALLINT length; int r = SQLGetInfo(hDbc, SQL_IDENTIFIER_QUOTE_CHAR, diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 6232452..a270c0e 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -378,7 +378,7 @@ void QSqlDatabasePrivate::disable() the connection name argument, if you don't pass the connection name argument, the default connection is assumed. The following snippet shows how to create and open a default connection to a - MySQL database: + PostgreSQL database: \snippet doc/src/snippets/sqldatabase/sqldatabase.cpp 0 diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index a550b3c..298fbad 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -1,4 +1,4 @@ - /**************************************************************************** +/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index 7687fec..894296d 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -1,4 +1,3 @@ - /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). diff --git a/src/testlib/qtestbasicstreamer.cpp b/src/testlib/qtestbasicstreamer.cpp index b133aae..f22b3d2 100644 --- a/src/testlib/qtestbasicstreamer.cpp +++ b/src/testlib/qtestbasicstreamer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestbasicstreamer.h" #include "qtestlogger_p.h" #include "qtestelement.h" @@ -55,7 +96,7 @@ void QTestBasicStreamer::formatAfterAttributes(const QTestElement *element, char QTest::qt_snprintf(formatted, 10, ""); } -void QTestBasicStreamer::formatAttributes(const QTestElementAttribute *attribute, char *formatted) const +void QTestBasicStreamer::formatAttributes(const QTestElement *, const QTestElementAttribute *attribute, char *formatted) const { if(!attribute || !formatted ) return; @@ -90,7 +131,7 @@ void QTestBasicStreamer::outputElements(QTestElement *element, bool) const formatBeforeAttributes(element, buf); outputString(buf); - outputElementAttributes(element->attributes()); + outputElementAttributes(element, element->attributes()); formatAfterAttributes(element, buf); outputString(buf); @@ -105,11 +146,11 @@ void QTestBasicStreamer::outputElements(QTestElement *element, bool) const } } -void QTestBasicStreamer::outputElementAttributes(QTestElementAttribute *attribute) const +void QTestBasicStreamer::outputElementAttributes(const QTestElement* element, QTestElementAttribute *attribute) const { char buf[1024]; while(attribute){ - formatAttributes(attribute, buf); + formatAttributes(element, attribute, buf); outputString(buf); attribute = attribute->nextElement(); } diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h index cfd6b94..527b1d4 100644 --- a/src/testlib/qtestbasicstreamer.h +++ b/src/testlib/qtestbasicstreamer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTBASICSTREAMER_H #define QTESTBASICSTREAMER_H @@ -30,9 +71,9 @@ class QTestBasicStreamer virtual void formatEnd(const QTestElement *element = 0, char *formatted = 0) const; virtual void formatBeforeAttributes(const QTestElement *element = 0, char *formatted = 0) const; virtual void formatAfterAttributes(const QTestElement *element = 0, char *formatted = 0) const; - virtual void formatAttributes(const QTestElementAttribute *attribute = 0, char *formatted = 0) const; + virtual void formatAttributes(const QTestElement *element = 0, const QTestElementAttribute *attribute = 0, char *formatted = 0) const; virtual void outputElements(QTestElement *element, bool isChildElement = false) const; - virtual void outputElementAttributes(QTestElementAttribute *attribute) const; + virtual void outputElementAttributes(const QTestElement *element, QTestElementAttribute *attribute) const; private: const QTestLogger *testLogger; diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 936b936..8c76c5d 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -54,6 +54,7 @@ #include <QtCore/qdir.h> #include <QtCore/qprocess.h> #include <QtCore/qdebug.h> +#include <QtCore/qlibraryinfo.h> #include "QtTest/private/qtestlog_p.h" #include "QtTest/private/qtesttable_p.h" @@ -846,9 +847,8 @@ static void qParseArgs(int argc, char *argv[]) " -iterations n : Sets the number of accumulation iterations.\n" " -median n : Sets the number of median iterations.\n" " -vb : Print out verbose benchmarking information.\n" -#ifndef QT_NO_PROCESS -// Will be enabled when tools are integrated. -// " -chart : Runs the chart generator after the test. No output is printed to the console\n" +#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS) + " -chart : Create chart based on the benchmark result.\n" #endif "\n" " -help : This help\n"; @@ -963,7 +963,7 @@ static void qParseArgs(int argc, char *argv[]) } else if (strcmp(argv[i], "-vb") == 0) { QBenchmarkGlobalData::current->verboseOutput = true; -#ifndef QT_NO_PROCESS +#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS) } else if (strcmp(argv[i], "-chart") == 0) { QBenchmarkGlobalData::current->createChart = true; QTestLog::setLogMode(QTestLog::XML); @@ -1463,26 +1463,17 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) #endif -#ifndef QT_NO_PROCESS +#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS) if (QBenchmarkGlobalData::current->createChart) { - -#define XSTR(s) STR(s) -#define STR(s) #s -#ifdef Q_OS_WIN - const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport.exe"; -#else - const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport"; -#endif -#undef XSTR -#undef STR - - if (QFile::exists(QLatin1String(path))) { + QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath) + + QLatin1String("/../tools/qtestlib/chart/chart"); + if (QFile::exists(chartLocation)) { QProcess p; p.setProcessChannelMode(QProcess::ForwardedChannels); - p.start(QLatin1String(path), QStringList() << QLatin1String("results.xml")); + p.start(chartLocation, QStringList() << QLatin1String("results.xml")); p.waitForFinished(-1); } else { - qWarning("Could not find %s, please make sure it is compiled.", path); + qDebug() << QLatin1String("Could not find the chart tool in ") + chartLocation + QLatin1String(", please make sure it is compiled."); } } #endif diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h index ea05c19..4cf8fcb 100644 --- a/src/testlib/qtestcoreelement.h +++ b/src/testlib/qtestcoreelement.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTCOREELEMENT_H #define QTESTCOREELEMENT_H @@ -90,7 +131,8 @@ const char *QTestCoreElement<ElementType>::elementName() const "error", "testcase", "testsuite", - "benchmark" + "benchmark", + "system-err" }; if(type != QTest::LET_Undefined) diff --git a/src/testlib/qtestcorelist.h b/src/testlib/qtestcorelist.h index 8e008a4..686e157 100644 --- a/src/testlib/qtestcorelist.h +++ b/src/testlib/qtestcorelist.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTCORELIST_H #define QTESTCORELIST_H diff --git a/src/testlib/qtestelement.cpp b/src/testlib/qtestelement.cpp index 55341d4..a417360 100644 --- a/src/testlib/qtestelement.cpp +++ b/src/testlib/qtestelement.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestelement.h" QT_BEGIN_NAMESPACE diff --git a/src/testlib/qtestelement.h b/src/testlib/qtestelement.h index f5d7466..c1932da 100644 --- a/src/testlib/qtestelement.h +++ b/src/testlib/qtestelement.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTELEMENT_H #define QTESTELEMENT_H diff --git a/src/testlib/qtestelementattribute.cpp b/src/testlib/qtestelementattribute.cpp index 64f9da5..540389b 100644 --- a/src/testlib/qtestelementattribute.cpp +++ b/src/testlib/qtestelementattribute.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestelementattribute.h" #include <QtCore/qbytearray.h> #include <string.h> diff --git a/src/testlib/qtestelementattribute.h b/src/testlib/qtestelementattribute.h index 2e23cd9..261f3f7 100644 --- a/src/testlib/qtestelementattribute.h +++ b/src/testlib/qtestelementattribute.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTELEMENTATTRIBUTE_H #define QTESTELEMENTATTRIBUTE_H @@ -37,7 +78,8 @@ namespace QTest { LET_Error = 3, LET_TestCase = 4, LET_TestSuite = 5, - LET_Benchmark = 6 + LET_Benchmark = 6, + LET_SystemError = 7 }; } diff --git a/src/testlib/qtestfilelogger.cpp b/src/testlib/qtestfilelogger.cpp index f753b83..50741de 100644 --- a/src/testlib/qtestfilelogger.cpp +++ b/src/testlib/qtestfilelogger.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestfilelogger.h" #include "qtestassert.h" #include "QtTest/private/qtestlog_p.h" diff --git a/src/testlib/qtestfilelogger.h b/src/testlib/qtestfilelogger.h index 4dca090..892657d 100644 --- a/src/testlib/qtestfilelogger.h +++ b/src/testlib/qtestfilelogger.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTFILELOGGER_H #define QTESTFILELOGGER_H diff --git a/src/testlib/qtestlightxmlstreamer.cpp b/src/testlib/qtestlightxmlstreamer.cpp index 73b33ef..75fec40 100644 --- a/src/testlib/qtestlightxmlstreamer.cpp +++ b/src/testlib/qtestlightxmlstreamer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestlightxmlstreamer.h" #include "qtestelement.h" #include "qtestelementattribute.h" diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h index 872eed2..382a14a 100644 --- a/src/testlib/qtestlightxmlstreamer.h +++ b/src/testlib/qtestlightxmlstreamer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTLIGHTXMLSTREAMER_H #define QTESTLIGHTXMLSTREAMER_H diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qtestlogger.cpp index c053c30..2249e8a 100644 --- a/src/testlib/qtestlogger.cpp +++ b/src/testlib/qtestlogger.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestlogger_p.h" #include "qtestelement.h" #include "qtestxunitstreamer.h" @@ -14,7 +55,7 @@ QT_BEGIN_NAMESPACE QTestLogger::QTestLogger(int fm) - :listOfTestcases(0), currentLogElement(0), + :listOfTestcases(0), currentLogElement(0), errorLogElement(0), logFormatter(0), format( (TestLoggerFormat)fm ), filelogger(new QTestFileLogger), testCounter(0), passCounter(0), failureCounter(0), errorCounter(0), @@ -49,6 +90,8 @@ void QTestLogger::startLogging() break; }case TLF_XunitXml:{ logFormatter = new QTestXunitStreamer; + delete errorLogElement; + errorLogElement = new QTestElement(QTest::LET_SystemError); filelogger->init(); break; } @@ -101,6 +144,8 @@ void QTestLogger::stopLogging() testcase = testcase->nextElement(); } + currentLogElement->addLogElement(errorLogElement); + QTestElement *it = currentLogElement; logFormatter->output(it); }else{ @@ -158,7 +203,10 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description, if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XFail) { QTestElement *failureElement = new QTestElement(QTest::LET_Failure); failureElement->addAttribute(QTest::AI_Result, typeBuf); - failureElement->addAttribute(QTest::AI_File, file); + if(file) + failureElement->addAttribute(QTest::AI_File, file); + else + failureElement->addAttribute(QTest::AI_File, ""); QTest::qt_snprintf(buf, sizeof(buf), "%i", line); failureElement->addAttribute(QTest::AI_Line, buf); failureElement->addAttribute(QTest::AI_Description, description); @@ -273,6 +321,13 @@ void QTestLogger::addMessage(MessageTypes type, const char *message, const char currentLogElement->addLogElement(errorElement); ++errorCounter; + + // Also add the message to the system error log (i.e. stderr), if one exists + if (errorLogElement) { + QTestElement *systemErrorElement = new QTestElement(QTest::LET_Error); + systemErrorElement->addAttribute(QTest::AI_Description, message); + errorLogElement->addLogElement(systemErrorElement); + } } void QTestLogger::setLogFormat(TestLoggerFormat fm) diff --git a/src/testlib/qtestlogger_p.h b/src/testlib/qtestlogger_p.h index 3badb1d..9807fd2 100644 --- a/src/testlib/qtestlogger_p.h +++ b/src/testlib/qtestlogger_p.h @@ -1,6 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTLOGGER_P_H #define QTESTLOGGER_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtTest/private/qabstracttestlogger_p.h> QT_BEGIN_NAMESPACE @@ -52,6 +104,7 @@ class QTestLogger : public QAbstractTestLogger private: QTestElement *listOfTestcases; QTestElement *currentLogElement; + QTestElement *errorLogElement; QTestBasicStreamer *logFormatter; TestLoggerFormat format; QTestFileLogger *filelogger; diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp index cf99b96..5d57bab 100644 --- a/src/testlib/qtestxmlstreamer.cpp +++ b/src/testlib/qtestxmlstreamer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestxmlstreamer.h" #include "qtestelement.h" #include "qtestelementattribute.h" @@ -54,7 +95,7 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char *formatted) QXmlTestLogger::xmlCdata(cdataTag, element->attributeValue(QTest::AI_Tag), sizeof(cdataTag)); QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s>\n" - " <DataTag><![CDATA[%s]]></Description>\n" + " <DataTag><![CDATA[%s]]></DataTag>\n" " <Description><![CDATA[%s]]></Description>\n" "</Incident>\n", element->attributeValue(QTest::AI_Result), location, cdataTag, cdataDesc); diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h index e6858c6..58544a4 100644 --- a/src/testlib/qtestxmlstreamer.h +++ b/src/testlib/qtestxmlstreamer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTXMLSTREAMER_H #define QTESXMLSTREAMER_H diff --git a/src/testlib/qtestxunitstreamer.cpp b/src/testlib/qtestxunitstreamer.cpp index 2d8b7c4..a34791c 100644 --- a/src/testlib/qtestxunitstreamer.cpp +++ b/src/testlib/qtestxunitstreamer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qtestxunitstreamer.h" #include "qtestelement.h" @@ -40,6 +81,17 @@ void QTestXunitStreamer::formatStart(const QTestElement *element, char *formatte char indent[20]; indentForElement(element, indent, sizeof(indent)); + // Errors are written as CDATA within system-err, comments elsewhere + if (element->elementType() == QTest::LET_Error) { + if (element->parentElement()->elementType() == QTest::LET_SystemError) { + QTest::qt_snprintf(formatted, 1024, "<![CDATA["); + } + else { + QTest::qt_snprintf(formatted, 1024, "%s<!--", indent); + } + return; + } + QTest::qt_snprintf(formatted, 1024, "%s<%s", indent, element->elementName()); } @@ -59,13 +111,23 @@ void QTestXunitStreamer::formatEnd(const QTestElement *element, char *formatted) QTest::qt_snprintf(formatted, 1024, "%s</%s>\n", indent, element->elementName()); } -void QTestXunitStreamer::formatAttributes(const QTestElementAttribute *attribute, char *formatted) const +void QTestXunitStreamer::formatAttributes(const QTestElement* element, const QTestElementAttribute *attribute, char *formatted) const { if(!attribute || !formatted ) return; QTest::AttributeIndex attrindex = attribute->index(); + // For errors within system-err, we only want to output `message' + if (element && element->elementType() == QTest::LET_Error + && element->parentElement()->elementType() == QTest::LET_SystemError) { + + if (attrindex != QTest::AI_Description) return; + + QXmlTestLogger::xmlCdata(formatted, attribute->value(), 1024); + return; + } + char const* key = 0; if (attrindex == QTest::AI_Description) key = "message"; @@ -87,10 +149,21 @@ void QTestXunitStreamer::formatAfterAttributes(const QTestElement *element, char if(!element || !formatted ) return; - if(!element->childElements()) - QTest::qt_snprintf(formatted, 10, "/>\n"); - else - QTest::qt_snprintf(formatted, 10, ">\n"); + // Errors are written as CDATA within system-err, comments elsewhere + if (element->elementType() == QTest::LET_Error) { + if (element->parentElement()->elementType() == QTest::LET_SystemError) { + QTest::qt_snprintf(formatted, 1024, "]]>\n"); + } + else { + QTest::qt_snprintf(formatted, 1024, " -->\n"); + } + return; + } + + if(!element->childElements()) + QTest::qt_snprintf(formatted, 10, "/>\n"); + else + QTest::qt_snprintf(formatted, 10, ">\n"); } void QTestXunitStreamer::output(QTestElement *element) const @@ -122,7 +195,7 @@ void QTestXunitStreamer::outputElements(QTestElement *element, bool) const formatBeforeAttributes(element, buf); outputString(buf); - outputElementAttributes(element->attributes()); + outputElementAttributes(element, element->attributes()); formatAfterAttributes(element, buf); outputString(buf); diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h index 1ce9576..b4b82f0 100644 --- a/src/testlib/qtestxunitstreamer.h +++ b/src/testlib/qtestxunitstreamer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QTESTXUNITSTREAMER_H #define QTESTXUNITSTREAMER_H @@ -16,7 +57,7 @@ class QTestXunitStreamer: public QTestBasicStreamer void formatStart(const QTestElement *element = 0, char *formatted = 0) const; void formatEnd(const QTestElement *element = 0, char *formatted = 0) const; void formatAfterAttributes(const QTestElement *element = 0, char *formatted = 0) const; - void formatAttributes(const QTestElementAttribute *attribute = 0, char *formatted = 0) const; + void formatAttributes(const QTestElement *element = 0, const QTestElementAttribute *attribute = 0, char *formatted = 0) const; void output(QTestElement *element) const; void outputElements(QTestElement *element, bool isChildElement = false) const; diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index ec9a5d2..0606ced 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -325,6 +325,10 @@ void QXmlTestLogger::xmlQuote(char* dest, char const* src, size_t n) MAP_ENTITY('"', """); MAP_ENTITY('&', "&"); + // not strictly necessary, but allows handling of comments without + // having to explicitly look for `--' + MAP_ENTITY('-', "-"); + #undef MAP_ENTITY case 0: diff --git a/src/xmlpatterns/expr/qapplytemplate.cpp b/src/xmlpatterns/expr/qapplytemplate.cpp index 95f4fdf..b91c2f0 100644 --- a/src/xmlpatterns/expr/qapplytemplate.cpp +++ b/src/xmlpatterns/expr/qapplytemplate.cpp @@ -160,8 +160,7 @@ Item::Iterator::Ptr ApplyTemplate::evaluateSequence(const DynamicContext::Ptr &c focus->setFocusIterator(focusIterator); return makeSequenceMappingIterator<Item>(ConstPtr(this), focusIterator, focus); } - else - return CommonValues::emptyIterator; + return CommonValues::emptyIterator; } } diff --git a/src/xmlpatterns/functions/qsequencefns.cpp b/src/xmlpatterns/functions/qsequencefns.cpp index f6d5391..faa787e 100644 --- a/src/xmlpatterns/functions/qsequencefns.cpp +++ b/src/xmlpatterns/functions/qsequencefns.cpp @@ -246,8 +246,7 @@ Item::Iterator::Ptr SubsequenceFN::evaluateSequence(const DynamicContext::Ptr &c if(length < 1 && length != -1) return CommonValues::emptyIterator; - else - return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length)); + return Item::Iterator::Ptr(new SubsequenceIterator(it, startingLoc, length)); } Item SubsequenceFN::evaluateSingleton(const DynamicContext::Ptr &context) const diff --git a/tests/arthur/common/images.qrc b/tests/arthur/common/images.qrc index 8e94760..060b52c 100644 --- a/tests/arthur/common/images.qrc +++ b/tests/arthur/common/images.qrc @@ -3,6 +3,7 @@ <qresource> <file>images/alpha.png</file> <file>images/border.png</file> + <file>images/borderimage.png</file> <file>images/dome_argb32.png</file> <file>images/dome_indexed.png</file> <file>images/dome_mono_palette.png</file> diff --git a/tests/arthur/common/images/borderimage.png b/tests/arthur/common/images/borderimage.png Binary files differnew file mode 100644 index 0000000..f7f6b66 --- /dev/null +++ b/tests/arthur/common/images/borderimage.png diff --git a/tests/arthur/data/qps/borderimage.qps b/tests/arthur/data/qps/borderimage.qps new file mode 100644 index 0000000..8d2e54b --- /dev/null +++ b/tests/arthur/data/qps/borderimage.qps @@ -0,0 +1,164 @@ +image_load borderimage.png borderimage + +translate -128 -128 +begin_block draw_border + +# top +drawImage borderimage 0 0 16 16 0 0 16 16 +drawImage borderimage 16 0 36 16 16 0 32 16 +drawImage borderimage 52 0 16 16 48 0 16 16 + +# sides +drawImage borderimage 0 16 16 16 0 16 16 32 +drawImage borderimage 52 16 16 16 48 16 16 32 + +#bottom +drawImage borderimage 0 32 16 16 0 48 16 16 +drawImage borderimage 16 32 36 16 16 48 32 16 +drawImage borderimage 52 32 16 16 48 48 16 16 + +end_block draw_border + +resetMatrix + +begin_block draw_column + +translate 1 1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border + +end_block draw_column + +setRenderHint Antialiasing + +resetMatrix +translate 72 0 + +repeat_block draw_column + +resetMatrix +scale 1.25 1.25 +translate 144 0 + +repeat_block draw_border + +resetMatrix +scale 1.25 1.25 +translate 246 0 +rotate 30 + +repeat_block draw_border + +setRenderHint SmoothPixmapTransform + +resetMatrix +scale 1.25 1.25 +translate 144 120 + +repeat_block draw_border + +resetMatrix +scale 1.25 1.25 +translate 246 120 +rotate 30 + +repeat_block draw_border + +resetMatrix +translate 215 260 +scale 3.55 3.55 +rotate 30 + +repeat_block draw_border + +resetMatrix +setRenderHint SmoothPixmapTransform off +setRenderHint Antialiasing off + +translate 480 627 +rotate 180 +repeat_block draw_column + +resetMatrix +setRenderHint Antialiasing + +translate 552 627 +rotate 180 +repeat_block draw_column + +resetMatrix +setRenderHint Antialiasing off + +translate 200.1 520.1 + +begin_block one_pixel_border +drawImage borderimage 0 0 16 16 0 0 16 16 +drawImage borderimage 16 0 64 16 16 0 1 1 +drawImage borderimage 80 0 16 16 48 0 16 16 + +drawImage borderimage 0 16 16 64 16 0 1 1 +drawImage borderimage 80 16 16 64 16 0 1 1 + +drawImage borderimage 0 80 16 16 0 48 16 16 +drawImage borderimage 16 80 64 16 16 0 1 1 +drawImage borderimage 80 80 16 16 48 48 16 16 +end_block one_pixel_border + +resetMatrix + +translate 205.1 626.1 +scale 0.4 0.4 + +repeat_block one_pixel_border + +resetMatrix + +translate 255.1 624.1 +scale 0.4 0.4 +rotate 10 + +repeat_block one_pixel_border + +resetMatrix + +setPen red + +drawRect 0 0 70 680 +drawText 10 670 "aa off" + +drawRect 72 0 70 680 +drawText 80 670 "aa on" + +drawRect 409 0 70 680 +drawText 419 650 "rot 180" +drawText 419 670 "aa off" + +drawRect 481 0 70 680 +drawText 491 650 "rot 180" +drawText 491 670 "aa on" + +drawRect 164 0 224 124 +drawText 174 114 "smoothpixmaptransform off" + +drawRect 164 128 224 134 +drawText 174 252 "smoothpixmaptransform on" + +drawRect 200 520 97 188 +drawText 210 698 "1x1 edges" diff --git a/tests/arthur/data/qps/borderimage_qps.png b/tests/arthur/data/qps/borderimage_qps.png Binary files differnew file mode 100644 index 0000000..ed51d5f --- /dev/null +++ b/tests/arthur/data/qps/borderimage_qps.png diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 443ee7e..a3a6916 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -238,6 +238,7 @@ SUBDIRS += bic \ qregexpvalidator \ qregion \ qresourceengine \ + qringbuffer \ qscriptable \ qscriptclass \ qscriptcontext \ diff --git a/tests/auto/q3accel/q3accel.pro b/tests/auto/q3accel/q3accel.pro index 002033f..61d4f38 100644 --- a/tests/auto/q3accel/q3accel.pro +++ b/tests/auto/q3accel/q3accel.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3accel.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3action/q3action.pro b/tests/auto/q3action/q3action.pro index ee5d780..c85a158 100644 --- a/tests/auto/q3action/q3action.pro +++ b/tests/auto/q3action/q3action.pro @@ -1,3 +1,4 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3action.cpp diff --git a/tests/auto/q3actiongroup/q3actiongroup.pro b/tests/auto/q3actiongroup/q3actiongroup.pro index bfe1f68..139e48c 100644 --- a/tests/auto/q3actiongroup/q3actiongroup.pro +++ b/tests/auto/q3actiongroup/q3actiongroup.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3actiongroup.cpp diff --git a/tests/auto/q3buttongroup/clickLock/clickLock.pro b/tests/auto/q3buttongroup/clickLock/clickLock.pro index 68f5ed2..a1aa105 100644 --- a/tests/auto/q3buttongroup/clickLock/clickLock.pro +++ b/tests/auto/q3buttongroup/clickLock/clickLock.pro @@ -3,7 +3,8 @@ TEMPLATE = app win32:TARGET = ../clickLock !win32:TARGET = clickLock -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) DEPENDPATH += . INCLUDEPATH += . CONFIG -= app_bundle diff --git a/tests/auto/q3buttongroup/tst_q3buttongroup.pro b/tests/auto/q3buttongroup/tst_q3buttongroup.pro index 8ec25d0..9f1f090 100644 --- a/tests/auto/q3buttongroup/tst_q3buttongroup.pro +++ b/tests/auto/q3buttongroup/tst_q3buttongroup.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) # Input SOURCES += tst_q3buttongroup.cpp diff --git a/tests/auto/q3canvas/q3canvas.pro b/tests/auto/q3canvas/q3canvas.pro index cac538d..70e9b88 100644 --- a/tests/auto/q3canvas/q3canvas.pro +++ b/tests/auto/q3canvas/q3canvas.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3canvas.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3checklistitem/q3checklistitem.pro b/tests/auto/q3checklistitem/q3checklistitem.pro index 77d96e8..9ae9c55 100644 --- a/tests/auto/q3checklistitem/q3checklistitem.pro +++ b/tests/auto/q3checklistitem/q3checklistitem.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3checklistitem.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3combobox/q3combobox.pro b/tests/auto/q3combobox/q3combobox.pro index 2391f6c..7dcde2b 100644 --- a/tests/auto/q3combobox/q3combobox.pro +++ b/tests/auto/q3combobox/q3combobox.pro @@ -1,3 +1,4 @@ load(qttest_p4) SOURCES += tst_q3combobox.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3cstring/q3cstring.pro b/tests/auto/q3cstring/q3cstring.pro index 78077b8..1171093 100644 --- a/tests/auto/q3cstring/q3cstring.pro +++ b/tests/auto/q3cstring/q3cstring.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3cstring.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3databrowser/q3databrowser.pro b/tests/auto/q3databrowser/q3databrowser.pro index 09c16b7..d65a5ef 100644 --- a/tests/auto/q3databrowser/q3databrowser.pro +++ b/tests/auto/q3databrowser/q3databrowser.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3databrowser.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dateedit/q3dateedit.pro b/tests/auto/q3dateedit/q3dateedit.pro index ba585ce..85e0ebf 100644 --- a/tests/auto/q3dateedit/q3dateedit.pro +++ b/tests/auto/q3dateedit/q3dateedit.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3dateedit.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3datetimeedit/q3datetimeedit.pro b/tests/auto/q3datetimeedit/q3datetimeedit.pro index f2c0097..9c980be 100644 --- a/tests/auto/q3datetimeedit/q3datetimeedit.pro +++ b/tests/auto/q3datetimeedit/q3datetimeedit.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3datetimeedit.cpp diff --git a/tests/auto/q3deepcopy/q3deepcopy.pro b/tests/auto/q3deepcopy/q3deepcopy.pro index 04e0690..9ac1a10 100644 --- a/tests/auto/q3deepcopy/q3deepcopy.pro +++ b/tests/auto/q3deepcopy/q3deepcopy.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3deepcopy.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dict/q3dict.pro b/tests/auto/q3dict/q3dict.pro index 5ccd875..7bbea61 100644 --- a/tests/auto/q3dict/q3dict.pro +++ b/tests/auto/q3dict/q3dict.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3dict.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dns/q3dns.pro b/tests/auto/q3dns/q3dns.pro index 10c24e5..7fd2e4c 100644 --- a/tests/auto/q3dns/q3dns.pro +++ b/tests/auto/q3dns/q3dns.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3dns.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3dockwindow/q3dockwindow.pro b/tests/auto/q3dockwindow/q3dockwindow.pro index 5f23c40..1352123 100644 --- a/tests/auto/q3dockwindow/q3dockwindow.pro +++ b/tests/auto/q3dockwindow/q3dockwindow.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3dockwindow.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3filedialog/q3filedialog.pro b/tests/auto/q3filedialog/q3filedialog.pro index 2394111..f57f9c0 100644 --- a/tests/auto/q3filedialog/q3filedialog.pro +++ b/tests/auto/q3filedialog/q3filedialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3filedialog.cpp diff --git a/tests/auto/q3frame/q3frame.pro b/tests/auto/q3frame/q3frame.pro index 7f0d24f..1d1f5a7 100644 --- a/tests/auto/q3frame/q3frame.pro +++ b/tests/auto/q3frame/q3frame.pro @@ -1,4 +1,5 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3frame.cpp diff --git a/tests/auto/q3groupbox/q3groupbox.pro b/tests/auto/q3groupbox/q3groupbox.pro index 5153a25..fd4cced 100644 --- a/tests/auto/q3groupbox/q3groupbox.pro +++ b/tests/auto/q3groupbox/q3groupbox.pro @@ -1,5 +1,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) # Input SOURCES += tst_q3groupbox.cpp diff --git a/tests/auto/q3hbox/q3hbox.pro b/tests/auto/q3hbox/q3hbox.pro index d5b7c65..bbd7f5b 100644 --- a/tests/auto/q3hbox/q3hbox.pro +++ b/tests/auto/q3hbox/q3hbox.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3hbox.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3header/q3header.pro b/tests/auto/q3header/q3header.pro index 64ffb0f..d1a913a 100644 --- a/tests/auto/q3header/q3header.pro +++ b/tests/auto/q3header/q3header.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3header.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3iconview/q3iconview.pro b/tests/auto/q3iconview/q3iconview.pro index 37a138b..9416c08 100644 --- a/tests/auto/q3iconview/q3iconview.pro +++ b/tests/auto/q3iconview/q3iconview.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3iconview.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3listbox/q3listbox.pro b/tests/auto/q3listbox/q3listbox.pro index d193ace..dc2d197 100644 --- a/tests/auto/q3listbox/q3listbox.pro +++ b/tests/auto/q3listbox/q3listbox.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_qlistbox.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3listview/q3listview.pro b/tests/auto/q3listview/q3listview.pro index 56c62d1..5d72ea6 100644 --- a/tests/auto/q3listview/q3listview.pro +++ b/tests/auto/q3listview/q3listview.pro @@ -2,4 +2,5 @@ load(qttest_p4) SOURCES += tst_q3listview.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro b/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro index 143e0c0..b50d012 100644 --- a/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro +++ b/tests/auto/q3listviewitemiterator/q3listviewitemiterator.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3listviewitemiterator.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3mainwindow/q3mainwindow.pro b/tests/auto/q3mainwindow/q3mainwindow.pro index 7a198d1..c4cb7c4 100644 --- a/tests/auto/q3mainwindow/q3mainwindow.pro +++ b/tests/auto/q3mainwindow/q3mainwindow.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3mainwindow.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) CONFIG += console diff --git a/tests/auto/q3popupmenu/q3popupmenu.pro b/tests/auto/q3popupmenu/q3popupmenu.pro index c9c0dd5..216722b 100644 --- a/tests/auto/q3popupmenu/q3popupmenu.pro +++ b/tests/auto/q3popupmenu/q3popupmenu.pro @@ -4,5 +4,6 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3popupmenu.cpp diff --git a/tests/auto/q3process/q3process.pro b/tests/auto/q3process/q3process.pro index 8dc3541..a665c2b 100644 --- a/tests/auto/q3process/q3process.pro +++ b/tests/auto/q3process/q3process.pro @@ -5,6 +5,7 @@ SUBDIRS = cat \ tst TARGET = tst_q3process QT += qt3support +requires(contains(QT_CONFIG,qt3support)) #no install rule for subdir INSTALLS = diff --git a/tests/auto/q3process/tst/tst.pro b/tests/auto/q3process/tst/tst.pro index 090d76b..359148b 100644 --- a/tests/auto/q3process/tst/tst.pro +++ b/tests/auto/q3process/tst/tst.pro @@ -11,6 +11,7 @@ win32 { } } -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3progressbar/q3progressbar.pro b/tests/auto/q3progressbar/q3progressbar.pro index b3c8864..582c39e 100644 --- a/tests/auto/q3progressbar/q3progressbar.pro +++ b/tests/auto/q3progressbar/q3progressbar.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3progressbar.cpp diff --git a/tests/auto/q3progressdialog/q3progressdialog.pro b/tests/auto/q3progressdialog/q3progressdialog.pro index 65e24ed..08528db 100644 --- a/tests/auto/q3progressdialog/q3progressdialog.pro +++ b/tests/auto/q3progressdialog/q3progressdialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3progressdialog.cpp diff --git a/tests/auto/q3ptrlist/q3ptrlist.pro b/tests/auto/q3ptrlist/q3ptrlist.pro index 186a707..d7431f4 100644 --- a/tests/auto/q3ptrlist/q3ptrlist.pro +++ b/tests/auto/q3ptrlist/q3ptrlist.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3ptrlist.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3richtext/q3richtext.pro b/tests/auto/q3richtext/q3richtext.pro index 2d4fc5a..e22fa37 100644 --- a/tests/auto/q3richtext/q3richtext.pro +++ b/tests/auto/q3richtext/q3richtext.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3richtext.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3scrollview/q3scrollview.pro b/tests/auto/q3scrollview/q3scrollview.pro index 1750e8b..d98d234 100644 --- a/tests/auto/q3scrollview/q3scrollview.pro +++ b/tests/auto/q3scrollview/q3scrollview.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_qscrollview.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3semaphore/q3semaphore.pro b/tests/auto/q3semaphore/q3semaphore.pro index ad8c154..935917d 100644 --- a/tests/auto/q3semaphore/q3semaphore.pro +++ b/tests/auto/q3semaphore/q3semaphore.pro @@ -1,5 +1,6 @@ load(qttest_p4) SOURCES += tst_q3semaphore.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3serversocket/q3serversocket.pro b/tests/auto/q3serversocket/q3serversocket.pro index 4fa9dce..4e5e364 100644 --- a/tests/auto/q3serversocket/q3serversocket.pro +++ b/tests/auto/q3serversocket/q3serversocket.pro @@ -3,5 +3,6 @@ SOURCES += tst_q3serversocket.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3socket/q3socket.pro b/tests/auto/q3socket/q3socket.pro index a9bf0c0..a8324e9 100644 --- a/tests/auto/q3socket/q3socket.pro +++ b/tests/auto/q3socket/q3socket.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_qsocket.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3socketdevice/q3socketdevice.pro b/tests/auto/q3socketdevice/q3socketdevice.pro index c6e9e93..d2cbfb2 100644 --- a/tests/auto/q3socketdevice/q3socketdevice.pro +++ b/tests/auto/q3socketdevice/q3socketdevice.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3socketdevice.cpp QT += network qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3sqlcursor/q3sqlcursor.pro b/tests/auto/q3sqlcursor/q3sqlcursor.pro index 2844540..2d316fb 100644 --- a/tests/auto/q3sqlcursor/q3sqlcursor.pro +++ b/tests/auto/q3sqlcursor/q3sqlcursor.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3sqlcursor.cpp QT += sql qt3support +requires(contains(QT_CONFIG,qt3support)) win32:LIBS += -lws2_32 diff --git a/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro b/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro index 21e311f..59448eb 100644 --- a/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro +++ b/tests/auto/q3sqlselectcursor/q3sqlselectcursor.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3sqlselectcursor.cpp QT += sql qt3support +requires(contains(QT_CONFIG,qt3support)) win32:LIBS += -lws2_32 diff --git a/tests/auto/q3stylesheet/q3stylesheet.pro b/tests/auto/q3stylesheet/q3stylesheet.pro index a5e8438..f0fcd8b 100644 --- a/tests/auto/q3stylesheet/q3stylesheet.pro +++ b/tests/auto/q3stylesheet/q3stylesheet.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3stylesheet.cpp diff --git a/tests/auto/q3tabdialog/q3tabdialog.pro b/tests/auto/q3tabdialog/q3tabdialog.pro index 1ba72f9..815510d 100644 --- a/tests/auto/q3tabdialog/q3tabdialog.pro +++ b/tests/auto/q3tabdialog/q3tabdialog.pro @@ -4,6 +4,7 @@ load(qttest_p4) QT += qt3support +requires(contains(QT_CONFIG,qt3support)) SOURCES += tst_q3tabdialog.cpp diff --git a/tests/auto/q3table/q3table.pro b/tests/auto/q3table/q3table.pro index 6d96a4e..bdda8ba 100644 --- a/tests/auto/q3table/q3table.pro +++ b/tests/auto/q3table/q3table.pro @@ -2,5 +2,6 @@ load(qttest_p4) SOURCES += tst_q3table.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3textbrowser/q3textbrowser.pro b/tests/auto/q3textbrowser/q3textbrowser.pro index 8ddeaba..4dfd12e 100644 --- a/tests/auto/q3textbrowser/q3textbrowser.pro +++ b/tests/auto/q3textbrowser/q3textbrowser.pro @@ -3,6 +3,7 @@ HEADERS += SOURCES += tst_q3textbrowser.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3textedit/q3textedit.pro b/tests/auto/q3textedit/q3textedit.pro index a4b24a9..ff90c4a 100644 --- a/tests/auto/q3textedit/q3textedit.pro +++ b/tests/auto/q3textedit/q3textedit.pro @@ -4,5 +4,6 @@ SOURCES += tst_q3textedit.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3textstream/q3textstream.pro b/tests/auto/q3textstream/q3textstream.pro index 7c80af7..bf2584a 100644 --- a/tests/auto/q3textstream/q3textstream.pro +++ b/tests/auto/q3textstream/q3textstream.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3textstream.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) MOC_DIR=tmp diff --git a/tests/auto/q3timeedit/q3timeedit.pro b/tests/auto/q3timeedit/q3timeedit.pro index 17b4a84..0f231df 100644 --- a/tests/auto/q3timeedit/q3timeedit.pro +++ b/tests/auto/q3timeedit/q3timeedit.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3timeedit.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3toolbar/q3toolbar.pro b/tests/auto/q3toolbar/q3toolbar.pro index 8fcab99..974f14f 100644 --- a/tests/auto/q3toolbar/q3toolbar.pro +++ b/tests/auto/q3toolbar/q3toolbar.pro @@ -1,6 +1,7 @@ load(qttest_p4) SOURCES += tst_q3toolbar.cpp QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3uridrag/q3uridrag.pro b/tests/auto/q3uridrag/q3uridrag.pro index 526623e..b6e77fc 100644 --- a/tests/auto/q3uridrag/q3uridrag.pro +++ b/tests/auto/q3uridrag/q3uridrag.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3uridrag.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3urloperator/q3urloperator.pro b/tests/auto/q3urloperator/q3urloperator.pro index 3364dac..29282eb 100644 --- a/tests/auto/q3urloperator/q3urloperator.pro +++ b/tests/auto/q3urloperator/q3urloperator.pro @@ -2,7 +2,8 @@ load(qttest_p4) SOURCES += tst_q3urloperator.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) QT += network diff --git a/tests/auto/q3valuelist/q3valuelist.pro b/tests/auto/q3valuelist/q3valuelist.pro index ab82d31..d359779 100644 --- a/tests/auto/q3valuelist/q3valuelist.pro +++ b/tests/auto/q3valuelist/q3valuelist.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3valuelist.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3valuevector/q3valuevector.pro b/tests/auto/q3valuevector/q3valuevector.pro index 883fda2..55956cb 100644 --- a/tests/auto/q3valuevector/q3valuevector.pro +++ b/tests/auto/q3valuevector/q3valuevector.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3valuevector.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/q3widgetstack/q3widgetstack.pro b/tests/auto/q3widgetstack/q3widgetstack.pro index 9783f58..1bd6a89 100644 --- a/tests/auto/q3widgetstack/q3widgetstack.pro +++ b/tests/auto/q3widgetstack/q3widgetstack.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_q3widgetstack.cpp -contains(QT_CONFIG, qt3support): QT += qt3support +QT += qt3support +requires(contains(QT_CONFIG,qt3support)) diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp index 15cca56..4bb414c 100644 --- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp @@ -92,11 +92,15 @@ private slots: void exclusive(); void exclusiveWithActions(); void testSignals(); - void checkedButton(); void task106609(); + // fixed for Qt 4.6.0 +#if QT_VERSION >= 0x040600 + void autoIncrementId(); +#endif + void task209485_removeFromGroupInEventHandler_data(); void task209485_removeFromGroupInEventHandler(); }; @@ -329,13 +333,19 @@ void tst_QButtonGroup::testSignals() QCOMPARE(clickedSpy.count(), 1); QCOMPARE(clickedIdSpy.count(), 1); - QVERIFY(clickedIdSpy.takeFirst().at(0).toInt() == -1); + + int expectedId = -1; +#if QT_VERSION >= 0x040600 + expectedId = -2; +#endif + + QVERIFY(clickedIdSpy.takeFirst().at(0).toInt() == expectedId); QCOMPARE(pressedSpy.count(), 1); QCOMPARE(pressedIdSpy.count(), 1); - QVERIFY(pressedIdSpy.takeFirst().at(0).toInt() == -1); + QVERIFY(pressedIdSpy.takeFirst().at(0).toInt() == expectedId); QCOMPARE(releasedSpy.count(), 1); QCOMPARE(releasedIdSpy.count(), 1); - QVERIFY(releasedIdSpy.takeFirst().at(0).toInt() == -1); + QVERIFY(releasedIdSpy.takeFirst().at(0).toInt() == expectedId); clickedSpy.clear(); clickedIdSpy.clear(); @@ -483,5 +493,36 @@ void tst_QButtonGroup::task209485_removeFromGroupInEventHandler() QCOMPARE(spy1.count() + spy2.count(), signalCount); } +#if QT_VERSION >= 0x040600 +void tst_QButtonGroup::autoIncrementId() +{ + QDialog dlg(0); + QButtonGroup *buttons = new QButtonGroup(&dlg); + QVBoxLayout *vbox = new QVBoxLayout(&dlg); + + QRadioButton *radio1 = new QRadioButton(&dlg); + radio1->setText("radio1"); + QRadioButton *radio2 = new QRadioButton(&dlg); + radio2->setText("radio2"); + QRadioButton *radio3 = new QRadioButton(&dlg); + radio3->setText("radio3"); + + buttons->addButton(radio1); + vbox->addWidget(radio1); + buttons->addButton(radio2); + vbox->addWidget(radio2); + buttons->addButton(radio3); + vbox->addWidget(radio3); + + radio1->setChecked(true); + + QVERIFY(buttons->id(radio1) == -2); + QVERIFY(buttons->id(radio2) == -3); + QVERIFY(buttons->id(radio3) == -4); + + dlg.show(); +} +#endif + QTEST_MAIN(tst_QButtonGroup) #include "tst_qbuttongroup.moc" diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 656995a..b71cdc6 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -143,6 +143,9 @@ private slots: void task246056_setCompletionPrefix(); void task250064_lostFocus(); + void task253125_lineEditCompletion_data(); + void task253125_lineEditCompletion(); + private: void filter(); void testRowCount(); @@ -1184,5 +1187,48 @@ void tst_QCompleter::task250064_lostFocus() QCOMPARE(textEdit->focusPolicy(), origPolicy); } +void tst_QCompleter::task253125_lineEditCompletion_data() +{ + QTest::addColumn<QStringList>("list"); + QTest::addColumn<int>("completionMode"); + + QStringList list = QStringList() + << "alpha" << "beta" << "gamma" << "delta" << "epsilon" << "zeta" + << "eta" << "theta" << "iota" << "kappa" << "lambda" << "mu" + << "nu" << "xi" << "omicron" << "pi" << "rho" << "sigma" + << "tau" << "upsilon" << "phi" << "chi" << "psi" << "omega"; + + QTest::newRow("Inline") << list << (int)QCompleter::InlineCompletion; + QTest::newRow("Filtered") << list << (int)QCompleter::PopupCompletion; + QTest::newRow("Unfiltered") << list << (int)QCompleter::UnfilteredPopupCompletion; +} + +void tst_QCompleter::task253125_lineEditCompletion() +{ + QFETCH(QStringList, list); + QFETCH(int, completionMode); + + QStringListModel *model = new QStringListModel; + model->setStringList(list); + + QCompleter *completer = new QCompleter(list); + completer->setModel(model); + completer->setCompletionMode((QCompleter::CompletionMode)completionMode); + + QLineEdit edit; + edit.setCompleter(completer); + edit.show(); + edit.setFocus(); + + QTest::qWait(100); + + QTest::keyClick(&edit, 'i'); + QCOMPARE(edit.completer()->currentCompletion(), QString("iota")); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("iota")); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" diff --git a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp index 58707f1..947e8d6 100644 --- a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp +++ b/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp @@ -90,6 +90,8 @@ private Q_SLOTS: void watcher(); void watcher_error(); void watcher_waitForFinished(); + void watcher_waitForFinished_alreadyFinished(); + void watcher_waitForFinished_alreadyFinished_eventLoop(); void watcher_waitForFinished_error(); void callInsideWaitForFinished(); @@ -375,6 +377,77 @@ void tst_QDBusPendingCall::watcher_waitForFinished() QVERIFY(args2.at(0).toStringList().contains(conn.baseService())); } +void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished() +{ + QDBusPendingCall ac = sendMessage(); + QVERIFY(!ac.isFinished()); + QVERIFY(!ac.isError()); + QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage); + + ac.waitForFinished(); + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + callCount = 0; + watchArgument = 0; + + // create a watcher on an already-finished reply + QDBusPendingCallWatcher watch(ac); + connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), + SLOT(finished(QDBusPendingCallWatcher*))); + + watch.waitForFinished(); + + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + QCOMPARE(callCount, 1); + QCOMPARE(slotCalled, (int)FinishCalled); + QCOMPARE(watchArgument, &watch); + QVERIFY(!watch.isError()); + + const QVariantList args2 = ac.reply().arguments(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toStringList().contains(conn.baseService())); +} + +void tst_QDBusPendingCall::watcher_waitForFinished_alreadyFinished_eventLoop() +{ + QDBusPendingCall ac = sendMessage(); + QVERIFY(!ac.isFinished()); + QVERIFY(!ac.isError()); + QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage); + + ac.waitForFinished(); + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + callCount = 0; + watchArgument = 0; + + // create a watcher on an already-finished reply + QDBusPendingCallWatcher watch(ac); + connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), + SLOT(finished(QDBusPendingCallWatcher*))); + connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), + &QTestEventLoop::instance(), SLOT(exitLoop())); + + QTestEventLoop::instance().enterLoop(1); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(ac.isFinished()); + QVERIFY(!ac.isError()); + + QCOMPARE(callCount, 1); + QCOMPARE(slotCalled, (int)FinishCalled); + QCOMPARE(watchArgument, &watch); + QVERIFY(!watch.isError()); + + const QVariantList args2 = ac.reply().arguments(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toStringList().contains(conn.baseService())); +} + void tst_QDBusPendingCall::watcher_waitForFinished_error() { QDBusPendingCall ac = sendError(); diff --git a/tests/auto/qformlayout/tst_qformlayout.cpp b/tests/auto/qformlayout/tst_qformlayout.cpp index c4c6f70..242974d 100644 --- a/tests/auto/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/qformlayout/tst_qformlayout.cpp @@ -125,6 +125,7 @@ private slots: Qt::Orientations expandingDirections() const; */ + void fieldMinimumSize(); }; tst_QFormLayout::tst_QFormLayout() @@ -905,6 +906,35 @@ void tst_QFormLayout::layoutAlone() QTest::qWait(500); } + +void tst_QFormLayout::fieldMinimumSize() +{ + //check that the field with is bigger than its minimumSizeHint for any size of the widget + // even if the label with is not fixed + QWidget w; + QFormLayout layout; + layout.setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); + w.setLayout(&layout); + QLabel label1("Here is a strange test case"); + label1.setWordWrap(true); + QLabel label2("Here is another label"); + label2.setWordWrap(true); + QLabel shortLabel("short"); + QLabel longLabel("Quite long label"); + layout.addRow(&label1, &shortLabel); + layout.addRow(&label2, &longLabel); + w.show(); + int width = w.size().width() + 9; + + do { + w.resize(width, w.size().height()); + layout.activate(); + QVERIFY(shortLabel.size().width() >= shortLabel.minimumSizeHint().width()); + QVERIFY(longLabel.size().width() >= longLabel.minimumSizeHint().width()); + width -= 3; + } while(width >= w.minimumSizeHint().width()); +} + QTEST_MAIN(tst_QFormLayout) #include "tst_qformlayout.moc" diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 88c64d3..3b9895d 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -78,8 +78,7 @@ Q_DECLARE_METATYPE(QRectF) class EventTester : public QGraphicsItem { public: - EventTester() - : repaints(0) + EventTester(QGraphicsItem *parent = 0) : QGraphicsItem(parent), repaints(0) { br = QRectF(-10, -10, 20, 20); } void setGeometry(const QRectF &rect) @@ -209,6 +208,7 @@ private slots: void itemTransform_unrelated(); void opacity_data(); void opacity(); + void opacity2(); void itemStacksBehindParent(); void nestedClipping(); void nestedClippingTransforms(); @@ -5641,6 +5641,91 @@ void tst_QGraphicsItem::opacity() QCOMPARE(c3->effectiveOpacity(), c3_effectiveOpacity); } +void tst_QGraphicsItem::opacity2() +{ + EventTester *parent = new EventTester; + EventTester *child = new EventTester(parent); + EventTester *grandChild = new EventTester(child); + + QGraphicsScene scene; + scene.addItem(parent); + + class MyGraphicsView : public QGraphicsView + { public: + int repaints; + MyGraphicsView(QGraphicsScene *scene) : QGraphicsView(scene), repaints(0) {} + void paintEvent(QPaintEvent *e) { ++repaints; QGraphicsView::paintEvent(e); } + }; + + MyGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(250); + +#define RESET_REPAINT_COUNTERS \ + parent->repaints = 0; \ + child->repaints = 0; \ + grandChild->repaints = 0; \ + view.repaints = 0; + + RESET_REPAINT_COUNTERS + + child->setOpacity(0.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 0); + + RESET_REPAINT_COUNTERS + + child->setOpacity(1.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 1); + QCOMPARE(grandChild->repaints, 1); + + RESET_REPAINT_COUNTERS + + parent->setOpacity(0.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 0); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 0); + + RESET_REPAINT_COUNTERS + + parent->setOpacity(1.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 1); + QCOMPARE(grandChild->repaints, 1); + + grandChild->setFlag(QGraphicsItem::ItemIgnoresParentOpacity); + RESET_REPAINT_COUNTERS + + child->setOpacity(0.0); + QTest::qWait(100); + QCOMPARE(view.repaints, 1); + QCOMPARE(parent->repaints, 1); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 1); + + RESET_REPAINT_COUNTERS + + child->setOpacity(0.0); // Already 0.0; no change. + QTest::qWait(100); + QCOMPARE(view.repaints, 0); + QCOMPARE(parent->repaints, 0); + QCOMPARE(child->repaints, 0); + QCOMPARE(grandChild->repaints, 0); +} + void tst_QGraphicsItem::itemStacksBehindParent() { QGraphicsRectItem *parent1 = new QGraphicsRectItem(QRectF(0, 0, 100, 50)); diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index ca88afc..920cba7 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -190,6 +190,7 @@ private slots: void scrollAfterResize(); void centerOnDirtyItem(); void mouseTracking(); + void mouseTracking2(); // task specific tests below me void task172231_untransformableItems(); @@ -203,6 +204,7 @@ private slots: void task239729_noViewUpdate(); void task239047_fitInViewSmallViewport(); void task245469_itemsAtPointWithClip(); + void task253415_reconnectUpdateSceneOnSceneChanged(); }; void tst_QGraphicsView::initTestCase() @@ -3173,5 +3175,54 @@ void tst_QGraphicsView::mouseTracking() } } +void tst_QGraphicsView::mouseTracking2() +{ + // Make sure mouse move events propagates to the scene when + // mouse tracking is explicitly enabled on the view, + // even when all items ignore hover events / use default cursor. + + QGraphicsScene scene; + scene.addRect(0, 0, 100, 100); + + QGraphicsView view(&scene); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(200); + + QVERIFY(!view.viewport()->hasMouseTracking()); + view.viewport()->setMouseTracking(true); // Explicitly enable mouse tracking. + QVERIFY(view.viewport()->hasMouseTracking()); + + EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove); + QCOMPARE(spy.count(), 0); + sendMouseMove(view.viewport(), view.viewport()->rect().center()); + QCOMPARE(spy.count(), 1); +} + +void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() +{ + QGraphicsView view; + QGraphicsView dummyView; + view.setWindowFlags(view.windowFlags() | Qt::WindowStaysOnTopHint); + view.resize(200, 200); + + QGraphicsScene scene1; + QObject::connect(&scene1, SIGNAL(changed(QList<QRectF>)), &dummyView, SLOT(updateScene(QList<QRectF>))); + view.setScene(&scene1); + + QTest::qWait(125); + + QGraphicsScene scene2; + QObject::connect(&scene2, SIGNAL(changed(QList<QRectF>)), &dummyView, SLOT(updateScene(QList<QRectF>))); + view.setScene(&scene2); + + QTest::qWait(125); + + bool wasConnected2 = QObject::disconnect(&scene2, SIGNAL(changed(QList<QRectF>)), &view, 0); + QVERIFY(wasConnected2); +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 56737c3..343aac6 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -50,6 +50,7 @@ #include <qcleanlooksstyle.h> #include <qlineedit.h> #include <qboxlayout.h> +#include <qaction.h> #include "../../shared/util.h" @@ -155,6 +156,7 @@ private slots: // Task fixes void task236127_bspTreeIndexFails(); void task243004_setStyleCrash(); + void task250119_shortcutContext(); }; @@ -2212,6 +2214,89 @@ void tst_QGraphicsWidget::task243004_setStyleCrash() delete item2; } +class GraphicsWidget_task250119 : public QGraphicsWidget +{ +public: + GraphicsWidget_task250119() + : shortcutEvents(0) + { + setFocusPolicy(Qt::StrongFocus); + resize(100, 100); + } + + int shortcutEvents; + +private: + bool event(QEvent *event) + { + if (event->type() == QEvent::Shortcut) + shortcutEvents++; + return QGraphicsWidget::event(event); + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) + { + if (hasFocus()) { + painter->setPen(QPen(Qt::black, 0, Qt::DashLine)); + painter->drawRect(rect()); + } + painter->setPen(QPen(Qt::black, 0, Qt::SolidLine)); + painter->fillRect(rect().adjusted(2, 2, -2, -2), Qt::yellow); + painter->drawRect(rect().adjusted(2, 2, -2, -2)); + } +}; + +void tst_QGraphicsWidget::task250119_shortcutContext() +{ + QGraphicsScene scene; + QGraphicsView view; + view.setScene(&scene); + view.show(); + QTest::qWait(100); + + + // *** Event: *** + + GraphicsWidget_task250119 w_event; + scene.addItem(&w_event); + + const int id = w_event.grabShortcut(Qt::Key_A, Qt::WidgetWithChildrenShortcut); + w_event.setShortcutEnabled(id, true); + + w_event.setFocus(); + QTest::keyPress(&view, Qt::Key_A); + QCOMPARE(w_event.shortcutEvents, 1); + + w_event.clearFocus(); + QTest::keyPress(&view, Qt::Key_A); + QCOMPARE(w_event.shortcutEvents, 1); + + scene.removeItem(&w_event); + + + // *** Signal: *** + + GraphicsWidget_task250119 w_signal; + scene.addItem(&w_signal); + + QAction action(0); + action.setShortcut(Qt::Key_B); + action.setShortcutContext(Qt::WidgetWithChildrenShortcut); + QSignalSpy spy(&action, SIGNAL(triggered())); + + w_signal.addAction(&action); + + w_signal.setFocus(); + QTest::keyPress(&view, Qt::Key_B); + QCOMPARE(spy.count(), 1); + + w_signal.clearFocus(); + QTest::keyPress(&view, Qt::Key_B); + QCOMPARE(spy.count(), 1); + + scene.removeItem(&w_signal); +} + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index c372475..f70db14 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -106,6 +106,8 @@ private slots: void task228566_infiniteRelayout(); void task248430_crashWith0SizedItem(); void task250446_scrollChanged(); + void task196118_visualRegionForSelection(); + void keyboardSearch(); }; // Testing get/set functions @@ -1555,6 +1557,53 @@ void tst_QListView::task250446_scrollChanged() QCOMPARE(view.currentIndex(), index); } +void tst_QListView::task196118_visualRegionForSelection() +{ + class MyListView : public QListView + { + public: + QRegion visualRegionForSelection() const + { return QListView::visualRegionForSelection( selectionModel()->selection()); } + } view; + + QStandardItemModel model; + QStandardItem top1("top1"); + QStandardItem sub1("sub1"); + top1.appendRow(QList<QStandardItem*>() << &sub1); + model.appendColumn(QList<QStandardItem*>() << &top1); + view.setModel(&model); + view.setRootIndex(top1.index()); + + view.selectionModel()->select(top1.index(), QItemSelectionModel::Select); + + QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QVERIFY(view.visualRegionForSelection().isEmpty()); +} + +void tst_QListView::keyboardSearch() +{ + QStringList items; + items << "AB" << "AC" << "BA" << "BB" << "BD" << "KAFEINE" << "KONQUEROR" << "KOPETE" << "KOOKA" << "OKULAR"; + QStringListModel model(items); + + QListView view; + view.setModel(&model); + view.show(); + QTest::qWait(30); +// QCOMPARE(view.currentIndex() , model.index(0,0)); + + QTest::keyClick(&view, Qt::Key_K); + QTest::qWait(10); + QCOMPARE(view.currentIndex() , model.index(5,0)); //KAFEINE + + QTest::keyClick(&view, Qt::Key_O); + QTest::qWait(10); + QCOMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR + + QTest::keyClick(&view, Qt::Key_N); + QTest::qWait(10); + QCOMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR +} QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index deabda6..785eab0 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -101,6 +101,8 @@ private slots: void recycleServer(); + void multiConnect(); + void debug(); }; @@ -842,6 +844,31 @@ void tst_QLocalSocket::recycleServer() QVERIFY(server.nextPendingConnection() != 0); } +void tst_QLocalSocket::multiConnect() +{ + QLocalServer server; + QLocalSocket client1; + QLocalSocket client2; + QLocalSocket client3; + + QVERIFY(server.listen("multiconnect")); + + client1.connectToServer("multiconnect"); + client2.connectToServer("multiconnect"); + client3.connectToServer("multiconnect"); + + QVERIFY(client1.waitForConnected(201)); + QVERIFY(client2.waitForConnected(202)); + QVERIFY(client3.waitForConnected(203)); + + QVERIFY(server.waitForNewConnection(201)); + QVERIFY(server.nextPendingConnection() != 0); + QVERIFY(server.waitForNewConnection(202)); + QVERIFY(server.nextPendingConnection() != 0); + QVERIFY(server.waitForNewConnection(203)); + QVERIFY(server.nextPendingConnection() != 0); +} + void tst_QLocalSocket::debug() { // Make sure this compiles diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp index 36a4b45..4ee5b9f 100644 --- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp @@ -234,7 +234,7 @@ void tst_QNetworkCookie::parseSingleCookie_data() QTest::newRow("path-with-utf8-2") << "a=b;path=/R%C3%A9sum%C3%A9" << cookie; cookie.setPath(QString()); - cookie.setDomain("trolltech.com"); + cookie.setDomain(".trolltech.com"); QTest::newRow("plain-domain1") << "a=b;domain=trolltech.com" << cookie; QTest::newRow("plain-domain2") << "a=b; domain=trolltech.com " << cookie; QTest::newRow("plain-domain3") << "a=b;domain=TROLLTECH.COM" << cookie; @@ -246,7 +246,7 @@ void tst_QNetworkCookie::parseSingleCookie_data() QTest::newRow("dot-domain3") << "a=b; domain=.TROLLTECH.COM" << cookie; QTest::newRow("dot-domain4") << "a=b; Domain = .TROLLTECH.COM" << cookie; - cookie.setDomain(QString::fromUtf8("d\303\270gn\303\245pent.troll.no")); + cookie.setDomain(QString::fromUtf8(".d\303\270gn\303\245pent.troll.no")); QTest::newRow("idn-domain1") << "a=b;domain=xn--dgnpent-gxa2o.troll.no" << cookie; QTest::newRow("idn-domain2") << "a=b;domain=d\303\270gn\303\245pent.troll.no" << cookie; QTest::newRow("idn-domain3") << "a=b;domain=XN--DGNPENT-GXA2O.TROLL.NO" << cookie; @@ -259,7 +259,7 @@ void tst_QNetworkCookie::parseSingleCookie_data() QTest::newRow("dot-idn-domain3") << "a=b;domain=.XN--DGNPENT-GXA2O.TROLL.NO" << cookie; QTest::newRow("dot-idn-domain4") << "a=b;domain=.D\303\230GN\303\205PENT.troll.NO" << cookie; - cookie.setDomain("trolltech.com"); + cookie.setDomain(".trolltech.com"); cookie.setPath("/"); QTest::newRow("two-fields") << "a=b;domain=trolltech.com;path=/" << cookie; QTest::newRow("two-fields2") << "a=b; domain=trolltech.com; path=/" << cookie; @@ -662,7 +662,7 @@ void tst_QNetworkCookie::parseMultipleCookies_data() QTest::newRow("complex-1") << "c=d, a=, foo=bar; path=/" << list; cookie.setName("baz"); - cookie.setDomain("trolltech.com"); + cookie.setDomain(".trolltech.com"); list.prepend(cookie); QTest::newRow("complex-2") << "baz=bar; path=/; domain=trolltech.com, c=d,a=,foo=bar; path=/" << list; diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index e87a3bf..7aa1d24 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -171,6 +171,17 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data() result.clear(); result += finalCookie; QTest::newRow("defaults-2") << preset << cookie << "http://www.foo.tld" << result << true; + + // security test: do not accept cookie domains like ".com" nor ".com." (see RFC 2109 section 4.3.2) + result.clear(); + preset.clear(); + cookie.setDomain(".com"); + QTest::newRow("rfc2109-4.3.2-ex3") << preset << cookie << "http://x.foo.com" << result << false; + + result.clear(); + preset.clear(); + cookie.setDomain(".com."); + QTest::newRow("rfc2109-4.3.2-ex3-2") << preset << cookie << "http://x.foo.com" << result << false; } void tst_QNetworkCookieJar::setCookiesFromUrl() diff --git a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp index 31a5391..0760ce8 100644 --- a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp +++ b/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp @@ -59,6 +59,7 @@ public: private slots: void getSetCheck(); + void capabilitiesPerType(); }; tst_QNetworkProxy::tst_QNetworkProxy() @@ -79,6 +80,38 @@ void tst_QNetworkProxy::getSetCheck() QCOMPARE(quint16(0), obj1.port()); obj1.setPort(quint16(0xffff)); QCOMPARE(quint16(0xffff), obj1.port()); + + obj1.setType(QNetworkProxy::DefaultProxy); + QCOMPARE(obj1.type(), QNetworkProxy::DefaultProxy); + obj1.setType(QNetworkProxy::HttpProxy); + QCOMPARE(obj1.type(), QNetworkProxy::HttpProxy); + obj1.setType(QNetworkProxy::Socks5Proxy); + QCOMPARE(obj1.type(), QNetworkProxy::Socks5Proxy); +} + +void tst_QNetworkProxy::capabilitiesPerType() +{ + QNetworkProxy proxy(QNetworkProxy::Socks5Proxy); + QVERIFY(proxy.capabilities() & QNetworkProxy::TunnelingCapability); + QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability); + QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability); + + proxy.setType(QNetworkProxy::NoProxy); + // verify that the capabilities changed + QVERIFY(!(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability)); + QVERIFY(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability); + + proxy.setType(QNetworkProxy::HttpProxy); + QVERIFY(proxy.capabilities() & QNetworkProxy::HostNameLookupCapability); + QVERIFY(!(proxy.capabilities() & QNetworkProxy::UdpTunnelingCapability)); + + // now set the capabilities on stone: + proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability); + QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability); + + // changing the type shouldn't change the capabilities any more + proxy.setType(QNetworkProxy::Socks5Proxy); + QCOMPARE(proxy.capabilities(), QNetworkProxy::TunnelingCapability | QNetworkProxy::UdpTunnelingCapability); } QTEST_MAIN(tst_QNetworkProxy) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 104b788..6c622f7 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -52,6 +52,7 @@ #include <QtNetwork/QTcpSocket> #include <QtNetwork/QLocalSocket> #include <QtNetwork/QLocalServer> +#include <QtNetwork/QHostInfo> #include <QtNetwork/QFtp> #include <QtNetwork/qauthenticator.h> #include <QtNetwork/qnetworkaccessmanager.h> @@ -91,6 +92,15 @@ class tst_QNetworkReply: public QObject { Q_OBJECT + struct ProxyData { + ProxyData(const QNetworkProxy &p, const QByteArray &t, bool auth) + : tag(t), proxy(p), requiresAuthentication(auth) + { } + QByteArray tag; + QNetworkProxy proxy; + bool requiresAuthentication; + }; + QEventLoop *loop; enum RunSimpleRequestReturn { Timeout = 0, Success, Failure }; int returnCode; @@ -99,6 +109,7 @@ class tst_QNetworkReply: public QObject QString wronlyFileName; #endif QString uniqueExtension; + QList<ProxyData> proxies; QNetworkAccessManager manager; MyCookieJar *cookieJar; #ifndef QT_NO_OPENSSL @@ -172,6 +183,8 @@ private Q_SLOTS: void ioGetFromHttpsWithIgnoreSslErrors(); void ioGetFromHttpsWithSslHandshakeError(); #endif + void ioGetFromHttpBrokenServer_data(); + void ioGetFromHttpBrokenServer(); void ioGetWithManyProxies_data(); void ioGetWithManyProxies(); @@ -190,11 +203,20 @@ private Q_SLOTS: void ioPutToHttpFromFile(); void ioPostToHttpFromFile_data(); void ioPostToHttpFromFile(); + void ioPostToHttpFromSocket_data(); + void ioPostToHttpFromSocket(); + void ioPostToHttpFromMiddleOfFileToEnd(); + void ioPostToHttpFromMiddleOfFileFiveBytes(); + void ioPostToHttpFromMiddleOfQBufferFiveBytes(); + void ioPostToHttpNoBufferFlag(); + void ioPostToHttpUploadProgress(); + void ioPostToHttpEmtpyUploadProgress(); void rateControl_data(); void rateControl(); void downloadPerformance(); void uploadPerformance(); + void httpUploadPerformance(); void performanceControlRate(); void downloadProgress_data(); @@ -364,6 +386,63 @@ public slots: } }; +class FixedSizeDataGenerator : public QIODevice +{ + Q_OBJECT + enum { Idle, Started, Stopped } state; +public: + FixedSizeDataGenerator(qint64 size) : state(Idle) + { open(ReadOnly | Unbuffered); + toBeGeneratedTotalCount = toBeGeneratedCount = size; + } + + virtual qint64 bytesAvailable() const + { + return state == Started ? toBeGeneratedCount + QIODevice::bytesAvailable() : 0; + } + + virtual bool isSequential() const{ + return false; + } + + virtual bool reset() const{ + return false; + } + + qint64 size() const { + return toBeGeneratedTotalCount; + } + +public slots: + void start() { state = Started; emit readyRead(); } + +protected: + virtual qint64 readData(char *data, qint64 maxlen) + { + memset(data, '@', maxlen); + + if (toBeGeneratedCount <= 0) { + return -1; + } + + qint64 n = qMin(maxlen, toBeGeneratedCount); + toBeGeneratedCount -= n; + + if (toBeGeneratedCount <= 0) { + // make sure this is a queued connection! + emit readChannelFinished(); + } + + return n; + } + virtual qint64 writeData(const char *, qint64) + { return -1; } + + qint64 toBeGeneratedCount; + qint64 toBeGeneratedTotalCount; +}; + + class DataGenerator: public QIODevice { Q_OBJECT @@ -384,6 +463,7 @@ protected: { if (state == Stopped) return -1; // EOF + // return as many bytes as are wanted memset(data, '@', maxlen); return maxlen; @@ -392,6 +472,8 @@ protected: { return -1; } }; + + class SocketPair: public QObject { Q_OBJECT @@ -629,7 +711,7 @@ protected: return; transferRate = totalBytes * 1000 / timer.elapsed(); - qDebug() << "receive rate:" << (transferRate / 1024) << "kB/s in" + qDebug() << "TimedSender::run" << "receive rate:" << (transferRate / 1024) << "kB/s in" << timer.elapsed() << "ms"; } @@ -643,12 +725,13 @@ protected: class ThreadedDataReader: public QThread { Q_OBJECT + // used to make the constructor only return after the tcp server started listening QSemaphore ready; QTcpSocket *client; int timeout; int port; public: - int transferRate; + qint64 transferRate; ThreadedDataReader() : port(-1), transferRate(-1) { @@ -676,12 +759,65 @@ protected: QTime timer; timer.start(); eventLoop.exec(); + qint64 elapsed = timer.elapsed(); - transferRate = reader.totalBytes * 1000 / timer.elapsed(); - qDebug() << "send rate:" << (transferRate / 1024) << "kB/s"; + transferRate = reader.totalBytes * 1000 / elapsed; + qDebug() << "ThreadedDataReader::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; } }; +class ThreadedDataReaderHttpServer: public QThread +{ + Q_OBJECT + // used to make the constructor only return after the tcp server started listening + QSemaphore ready; + QTcpSocket *client; + int timeout; + int port; +public: + qint64 transferRate; + ThreadedDataReaderHttpServer() + : port(-1), transferRate(-1) + { + start(); + ready.acquire(); + } + + inline int serverPort() const { return port; } + +protected: + void run() + { + QTcpServer server; + server.listen(); + port = server.serverPort(); + ready.release(); + + server.waitForNewConnection(-1); + client = server.nextPendingConnection(); + client->write("HTTP/1.0 200 OK\r\n"); + client->write("Content-length: 0\r\n"); + client->write("\r\n"); + client->flush(); + + QCoreApplication::processEvents(); + + QEventLoop eventLoop; + DataReader reader(client, false); + QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); + + QTime timer; + timer.start(); + eventLoop.exec(); + qint64 elapsed = timer.elapsed(); + + transferRate = reader.totalBytes * 1000 / elapsed; + qDebug() << "ThreadedDataReaderHttpServer::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; + } +}; + + + tst_QNetworkReply::tst_QNetworkReply() { testFileName = QDir::currentPath() + "/testfile"; @@ -692,8 +828,28 @@ tst_QNetworkReply::tst_QNetworkReply() #endif cookieJar = new MyCookieJar; manager.setCookieJar(cookieJar); + + QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName()); + + proxies << ProxyData(QNetworkProxy::NoProxy, "", false); + + if (hostInfo.error() == QHostInfo::NoError && !hostInfo.addresses().isEmpty()) { + QString proxyserver = hostInfo.addresses().first().toString(); + proxies << ProxyData(QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3128), "+proxy", false) + << ProxyData(QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3129), "+proxyauth", true) + // currently unsupported + // << ProxyData(QNetworkProxy(QNetworkProxy::HttpProxy, proxyserver, 3130), "+proxyauth-ntlm", true); + << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080), "+socks", false) + << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1081), "+socksauth", true); + } else { + printf("==================================================================\n"); + printf("Proxy could not be looked up. No proxy will be used while testing!\n"); + printf("==================================================================\n"); + } } + + void tst_QNetworkReply::authenticationRequired(QNetworkReply*, QAuthenticator* auth) { auth->setUser("httptest"); @@ -1887,6 +2043,53 @@ void tst_QNetworkReply::ioGetFromHttpsWithSslHandshakeError() } #endif +void tst_QNetworkReply::ioGetFromHttpBrokenServer_data() +{ + QTest::addColumn<QByteArray>("dataToSend"); + QTest::addColumn<bool>("doDisconnect"); + + QTest::newRow("no-newline") << QByteArray("Hello World") << false; + QTest::newRow("just-newline") << QByteArray("\r\n") << false; + QTest::newRow("just-2newline") << QByteArray("\r\n\r\n") << false; + QTest::newRow("with-newlines") << QByteArray("Long first line\r\nLong second line") << false; + QTest::newRow("with-newlines2") << QByteArray("\r\nSecond line") << false; + QTest::newRow("with-newlines3") << QByteArray("ICY\r\nSecond line") << false; + QTest::newRow("invalid-version") << QByteArray("HTTP/123 200 \r\n") << false; + QTest::newRow("invalid-version2") << QByteArray("HTTP/a.\033 200 \r\n") << false; + QTest::newRow("invalid-reply-code") << QByteArray("HTTP/1.0 fuu \r\n") << false; + + QTest::newRow("empty+disconnect") << QByteArray() << true; + + QTest::newRow("no-newline+disconnect") << QByteArray("Hello World") << true; + QTest::newRow("just-newline+disconnect") << QByteArray("\r\n") << true; + QTest::newRow("just-2newline+disconnect") << QByteArray("\r\n\r\n") << true; + QTest::newRow("with-newlines+disconnect") << QByteArray("Long first line\r\nLong second line") << true; + QTest::newRow("with-newlines2+disconnect") << QByteArray("\r\nSecond line") << true; + QTest::newRow("with-newlines3+disconnect") << QByteArray("ICY\r\nSecond line") << true; + + QTest::newRow("invalid-version+disconnect") << QByteArray("HTTP/123 200 ") << true; + QTest::newRow("invalid-version2+disconnect") << QByteArray("HTTP/a.\033 200 ") << true; + QTest::newRow("invalid-reply-code+disconnect") << QByteArray("HTTP/1.0 fuu ") << true; +} + +void tst_QNetworkReply::ioGetFromHttpBrokenServer() +{ + QFETCH(QByteArray, dataToSend); + QFETCH(bool, doDisconnect); + MiniHttpServer server(dataToSend); + server.doClose = doDisconnect; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), request.url()); + QVERIFY(reply->error() != QNetworkReply::NoError); +} + void tst_QNetworkReply::ioGetWithManyProxies_data() { QTest::addColumn<QList<QNetworkProxy> >("proxyList"); @@ -2452,6 +2655,320 @@ void tst_QNetworkReply::ioPostToHttpFromFile() QCOMPARE(reply->readAll().trimmed(), md5sum(sourceFile.readAll()).toHex()); } +void tst_QNetworkReply::ioPostToHttpFromSocket_data() +{ + QTest::addColumn<QByteArray>("data"); + QTest::addColumn<QByteArray>("md5sum"); + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QNetworkProxy>("proxy"); + QTest::addColumn<int>("authenticationRequiredCount"); + QTest::addColumn<int>("proxyAuthenticationRequiredCount"); + + for (int i = 0; i < proxies.count(); ++i) + for (int auth = 0; auth < 2; ++auth) { + QUrl url; + if (auth) + url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + else + url = "http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi"; + + QNetworkProxy proxy = proxies.at(i).proxy; + QByteArray testsuffix = QByteArray(auth ? "+auth" : "") + proxies.at(i).tag; + int proxyauthcount = proxies.at(i).requiresAuthentication; + + QByteArray data; + data = ""; + QTest::newRow("empty" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = "This is a normal message."; + QTest::newRow("generic" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = "This is a message to show that Qt rocks!\r\n\n"; + QTest::newRow("small" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = QByteArray("abcd\0\1\2\abcd",12); + QTest::newRow("with-nul" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = QByteArray(4097, '\4'); + QTest::newRow("4k+1" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + + data = QByteArray(128*1024+1, '\177'); + QTest::newRow("128k+1" + testsuffix) << data << md5sum(data) << url << proxy << auth << proxyauthcount; + } +} + +void tst_QNetworkReply::ioPostToHttpFromSocket() +{ + qRegisterMetaType<QNetworkProxy>(); // for QSignalSpy + qRegisterMetaType<QAuthenticator *>(); + qRegisterMetaType<QNetworkReply *>(); + + QFETCH(QByteArray, data); + QFETCH(QUrl, url); + QFETCH(QNetworkProxy, proxy); + SocketPair socketpair; + socketpair.create(); + QVERIFY(socketpair.endPoints[0] && socketpair.endPoints[1]); + + socketpair.endPoints[0]->write(data); + + QNetworkRequest request(url); + manager.setProxy(proxy); + QNetworkReplyPtr reply = manager.post(QNetworkRequest(url), socketpair.endPoints[1]); + socketpair.endPoints[0]->close(); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QSignalSpy authenticationRequiredSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QSignalSpy proxyAuthenticationRequiredSpy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(1); + + disconnect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), url); + QCOMPARE(reply->error(), QNetworkReply::NoError); + // verify that the HTTP status code is 200 Ok + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); + + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); + + QTEST(authenticationRequiredSpy.count(), "authenticationRequiredCount"); + QTEST(proxyAuthenticationRequiredSpy.count(), "proxyAuthenticationRequiredCount"); + } + +// this tests checks if rewinding the POST-data to some place in the middle +// worked. +void tst_QNetworkReply::ioPostToHttpFromMiddleOfFileToEnd() +{ + QFile sourceFile(SRCDIR "/rfc3252.txt"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + // seeking to the middle + sourceFile.seek(sourceFile.size() / 2); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(QNetworkRequest(url), &sourceFile); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // compare half data + sourceFile.seek(sourceFile.size() / 2); + QByteArray data = sourceFile.readAll(); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + +void tst_QNetworkReply::ioPostToHttpFromMiddleOfFileFiveBytes() +{ + QFile sourceFile(SRCDIR "/rfc3252.txt"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + // seeking to the middle + sourceFile.seek(sourceFile.size() / 2); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + // only send 5 bytes + request.setHeader(QNetworkRequest::ContentLengthHeader, 5); + QVERIFY(request.header(QNetworkRequest::ContentLengthHeader).isValid()); + QNetworkReplyPtr reply = manager.post(request, &sourceFile); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // compare half data + sourceFile.seek(sourceFile.size() / 2); + QByteArray data = sourceFile.read(5); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + +void tst_QNetworkReply::ioPostToHttpFromMiddleOfQBufferFiveBytes() +{ + // test needed since a QBuffer goes with a different codepath than the QFile + // tested in ioPostToHttpFromMiddleOfFileFiveBytes + QBuffer uploadBuffer; + uploadBuffer.open(QIODevice::ReadWrite); + uploadBuffer.write("1234567890"); + uploadBuffer.seek(5); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &uploadBuffer); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + QVERIFY(!QTestEventLoop::instance().timeout()); + + // compare half data + uploadBuffer.seek(5); + QByteArray data = uploadBuffer.read(5); + QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); +} + + +void tst_QNetworkReply::ioPostToHttpNoBufferFlag() +{ + QByteArray data = QByteArray("daaaaaaataaaaaaa"); + // create a sequential QIODevice by feeding the data into a local TCP server + SocketPair socketpair; + socketpair.create(); + QVERIFY(socketpair.endPoints[0] && socketpair.endPoints[1]); + socketpair.endPoints[0]->write(data); + + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; + QNetworkRequest request(url); + // disallow buffering + request.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, true); + request.setHeader(QNetworkRequest::ContentLengthHeader, data.size()); + QNetworkReplyPtr reply = manager.post(request, socketpair.endPoints[1]); + socketpair.endPoints[0]->close(); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + connect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + QTestEventLoop::instance().enterLoop(2); + disconnect(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*))); + + // verify: error code is QNetworkReply::ContentReSendError + QCOMPARE(reply->error(), QNetworkReply::ContentReSendError); +} + + +void tst_QNetworkReply::ioPostToHttpUploadProgress() +{ + QFile sourceFile(SRCDIR "/bigfile"); + QVERIFY(sourceFile.open(QIODevice::ReadOnly)); + + // emulate a minimal http server + QTcpServer server; + server.listen(QHostAddress(QHostAddress::LocalHost), 0); + + // create the request + QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &sourceFile); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + // get the request started and the incoming socket connected + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QTcpSocket *incomingSocket = server.nextPendingConnection(); + QVERIFY(incomingSocket); + disconnect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + incomingSocket->setReadBufferSize(1*1024); + QTestEventLoop::instance().enterLoop(2); + // some progress should have been made + QList<QVariant> args = spy.last(); + QVERIFY(!args.isEmpty()); + QVERIFY(args.at(0).toLongLong() > 0); + + incomingSocket->setReadBufferSize(32*1024); + incomingSocket->read(16*1024); + QTestEventLoop::instance().enterLoop(2); + // some more progress than before + QList<QVariant> args2 = spy.last(); + QVERIFY(!args2.isEmpty()); + QVERIFY(args2.at(0).toLongLong() > args.at(0).toLongLong()); + + // set the read buffer to unlimited + incomingSocket->setReadBufferSize(0); + QTestEventLoop::instance().enterLoop(10); + // progress should be finished + QList<QVariant> args3 = spy.last(); + QVERIFY(!args3.isEmpty()); + QVERIFY(args3.at(0).toLongLong() > args2.at(0).toLongLong()); + QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong()); + QCOMPARE(args3.at(0).toLongLong(), sourceFile.size()); + + // after sending this, the QNAM should emit finished() + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + incomingSocket->write("HTTP/1.0 200 OK\r\n"); + incomingSocket->write("Content-Length: 0\r\n"); + incomingSocket->write("\r\n"); + QTestEventLoop::instance().enterLoop(10); + // not timeouted -> finished() was emitted + QVERIFY(!QTestEventLoop::instance().timeout()); + + incomingSocket->close(); + server.close(); +} + +void tst_QNetworkReply::ioPostToHttpEmtpyUploadProgress() +{ + QByteArray ba; + ba.resize(0); + QBuffer buffer(&ba,0); + QVERIFY(buffer.open(QIODevice::ReadOnly)); + + // emulate a minimal http server + QTcpServer server; + server.listen(QHostAddress(QHostAddress::LocalHost), 0); + + // create the request + QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QNetworkRequest request(url); + QNetworkReplyPtr reply = manager.post(request, &buffer); + QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); + connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + + // get the request started and the incoming socket connected + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QTcpSocket *incomingSocket = server.nextPendingConnection(); + QVERIFY(incomingSocket); + + // after sending this, the QNAM should emit finished() + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + incomingSocket->write("HTTP/1.0 200 OK\r\n"); + incomingSocket->write("Content-Length: 0\r\n"); + incomingSocket->write("\r\n"); + incomingSocket->flush(); + QTestEventLoop::instance().enterLoop(10); + // not timeouted -> finished() was emitted + QVERIFY(!QTestEventLoop::instance().timeout()); + + // final check: only 1 uploadProgress has been emitted + QVERIFY(spy.length() == 1); + QList<QVariant> args = spy.last(); + QVERIFY(!args.isEmpty()); + QCOMPARE(args.at(0).toLongLong(), buffer.size()); + QCOMPARE(args.at(0).toLongLong(), buffer.size()); + + incomingSocket->close(); + server.close(); +} + + void tst_QNetworkReply::rateControl_data() { QTest::addColumn<int>("rate"); @@ -2488,8 +3005,8 @@ void tst_QNetworkReply::rateControl() QTestEventLoop::instance().enterLoop(40); int elapsedTime = loopTime.elapsed(); - qDebug() << "send rate:" << sender.transferRate; - qDebug() << "receive rate:" << reader.totalBytesRead * 1000 / elapsedTime + qDebug() << "tst_QNetworkReply::rateControl" << "send rate:" << sender.transferRate; + qDebug() << "tst_QNetworkReply::rateControl" << "receive rate:" << reader.totalBytesRead * 1000 / elapsedTime << "(it received" << reader.totalBytesRead << "bytes in" << elapsedTime << "ms)"; sender.wait(); @@ -2523,23 +3040,54 @@ void tst_QNetworkReply::downloadPerformance() sender.wait(); qint64 receivedBytes = reader.totalBytes; - qDebug() << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" + qDebug() << "tst_QNetworkReply::downloadPerformance" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" << elapsedTime << "ms"; } void tst_QNetworkReply::uploadPerformance() { - ThreadedDataReader reader; - DataGenerator generator; - QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); - QNetworkReplyPtr reply = manager.put(request, &generator); + ThreadedDataReader reader; + DataGenerator generator; - connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTimer::singleShot(5000, &generator, SLOT(stop())); - generator.start(); - QTestEventLoop::instance().enterLoop(40); + + QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); + QNetworkReplyPtr reply = manager.put(request, &generator); + generator.start(); + connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTimer::singleShot(5000, &generator, SLOT(stop())); + + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); +} + +void tst_QNetworkReply::httpUploadPerformance() +{ + enum {UploadSize = 1000*1024*1024}; // 1000 MB + ThreadedDataReaderHttpServer reader; + FixedSizeDataGenerator generator(UploadSize); + + QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1")); + request.setHeader(QNetworkRequest::ContentLengthHeader,UploadSize); + + QNetworkReplyPtr reply = manager.put(request, &generator); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + QTime time; + generator.start(); + time.start(); + QTestEventLoop::instance().enterLoop(40); + QVERIFY(!QTestEventLoop::instance().timeout()); + + qint64 elapsed = time.elapsed(); + qWarning() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " + << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; + + reader.exit(); + reader.wait(3000); } + void tst_QNetworkReply::performanceControlRate() { // this is a control comparison for the other two above @@ -2560,7 +3108,7 @@ void tst_QNetworkReply::performanceControlRate() sender.wait(); qint64 receivedBytes = reader.totalBytes; - qDebug() << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" + qDebug() << "tst_QNetworkReply::performanceControlRate" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" << elapsedTime << "ms"; } @@ -2592,6 +3140,7 @@ void tst_QNetworkReply::downloadProgress() QByteArray data(128, 'a'); QTcpSocket *sender = server.nextPendingConnection(); + QVERIFY(sender); QFETCH(int, loopCount); for (int i = 1; i <= loopCount; ++i) { diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index c81bf67..87f9c13 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -225,6 +225,8 @@ private slots: void extendedBlendModes(); + void zeroOpacity(); + private: void fillData(); QColor baseColor( int k, int intensity=255 ); @@ -4150,5 +4152,21 @@ void tst_QPainter::extendedBlendModes() QVERIFY(testCompositionMode(191, 191, 96, QPainter::CompositionMode_Exclusion)); } +void tst_QPainter::zeroOpacity() +{ + QImage source(1, 1, QImage::Format_ARGB32_Premultiplied); + source.fill(0xffffffff); + + QImage target(1, 1, QImage::Format_RGB32); + target.fill(0xff000000); + + QPainter p(&target); + p.setOpacity(0.0); + p.drawImage(0, 0, source); + p.end(); + + QCOMPARE(target.pixel(0, 0), 0xff000000); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index a598bfc..cde4ae5 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -103,6 +103,7 @@ private slots: void valuePreservation(); void errorReporting(); void testCustomPageSizes(); + void printDialogCompleter(); private: }; @@ -940,5 +941,22 @@ void tst_QPrinter::testCustomPageSizes() QCOMPARE(paperSize, customSize); } +void tst_QPrinter::printDialogCompleter() +{ +#if defined(QT_NO_COMPLETER) || defined(QT_NO_FILEDIALOG) + QSKIP("QT_NO_COMPLETER || QT_NO_FILEDIALOG: Auto-complete turned off in QPrinterDialog.", QTest::SkipAll); +#else + QPrintDialog dialog; + dialog.printer()->setOutputFileName("file.pdf"); + dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile); + dialog.show(); + + QTest::qWait(100); + + QTest::keyClick(0, Qt::Key_Tab); + QTest::keyClick(0, 'P'); +#endif +} + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" diff --git a/tests/auto/qringbuffer/qringbuffer.pro b/tests/auto/qringbuffer/qringbuffer.pro new file mode 100644 index 0000000..91fb0a0 --- /dev/null +++ b/tests/auto/qringbuffer/qringbuffer.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +SOURCES += tst_qringbuffer.cpp + +QT = core + + diff --git a/tests/auto/qringbuffer/tst_qringbuffer.cpp b/tests/auto/qringbuffer/tst_qringbuffer.cpp new file mode 100644 index 0000000..c741c2e --- /dev/null +++ b/tests/auto/qringbuffer/tst_qringbuffer.cpp @@ -0,0 +1,200 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +#include <private/qringbuffer_p.h> + +class tst_QRingBuffer : public QObject +{ + Q_OBJECT + +public: + tst_QRingBuffer(); + virtual ~tst_QRingBuffer(); +public slots: + void initTestCase(); + void cleanupTestCase(); +private slots: + void readPointerAtPositionWriteRead(); + void readPointerAtPositionEmptyRead(); + void readPointerAtPositionWithHead(); + void readPointerAtPositionReadTooMuch(); + void sizeWhenEmpty(); + void sizeWhenReservedAndChopped(); + void sizeWhenReserved(); +}; + +tst_QRingBuffer::tst_QRingBuffer() +{ +} + +tst_QRingBuffer::~tst_QRingBuffer() +{ +} + +void tst_QRingBuffer::initTestCase() +{ +} + +void tst_QRingBuffer::cleanupTestCase() +{ +} + +void tst_QRingBuffer::sizeWhenReserved() +{ + QRingBuffer ringBuffer; + ringBuffer.reserve(5); + + QCOMPARE(ringBuffer.size(), 5); +} + +void tst_QRingBuffer::sizeWhenReservedAndChopped() +{ + QRingBuffer ringBuffer; + ringBuffer.reserve(31337); + ringBuffer.chop(31337); + + QCOMPARE(ringBuffer.size(), 0); +} + +void tst_QRingBuffer::sizeWhenEmpty() +{ + QRingBuffer ringBuffer; + + QCOMPARE(ringBuffer.size(), 0); +} + +void tst_QRingBuffer::readPointerAtPositionReadTooMuch() +{ + QRingBuffer ringBuffer; + + qint64 length; + const char *buf = ringBuffer.readPointerAtPosition(42, length); + QVERIFY(buf == 0); + QVERIFY(length == 0); +} + +void tst_QRingBuffer::readPointerAtPositionWithHead() +{ + QRingBuffer ringBuffer; + char *buf = ringBuffer.reserve(4); + memcpy (buf, "0123", 4); + ringBuffer.free(2); + + // ringBuffer should have stayed the same except + // its head it had moved to position 2 + qint64 length; + const char* buf2 = ringBuffer.readPointerAtPosition(0, length); + + QCOMPARE(length, qint64(2)); + QVERIFY(*buf2 == '2'); + QVERIFY(*(buf2+1) == '3'); + + // advance 2 more, ringBuffer should be empty then + ringBuffer.free(2); + buf2 = ringBuffer.readPointerAtPosition(0, length); + QCOMPARE(length, qint64(0)); + QVERIFY(buf2 == 0); +} + +void tst_QRingBuffer::readPointerAtPositionEmptyRead() +{ + QRingBuffer ringBuffer; + + qint64 length; + const char *buf = ringBuffer.readPointerAtPosition(0, length); + QVERIFY(buf == 0); + QVERIFY(length == 0); +} + +void tst_QRingBuffer::readPointerAtPositionWriteRead() +{ + //create some data + QBuffer inData; + inData.open(QIODevice::ReadWrite); + inData.putChar(0x42); + inData.putChar(0x23); + inData.write("Qt rocks!"); + for (int i = 0; i < 5000; i++) + inData.write(QString("Number %1").arg(i).toUtf8()); + inData.reset(); + QVERIFY(inData.size() > 0); + + //put the inData in the QRingBuffer + QRingBuffer ringBuffer; + qint64 remaining = inData.size(); + while (remaining > 0) { + // write in chunks of 50 bytes + // this ensures there will be multiple QByteArrays inside the QRingBuffer + // since QRingBuffer is then only using individual arrays of around 4000 bytes + qint64 thisWrite = qMin(remaining, qint64(50)); + char *pos = ringBuffer.reserve(thisWrite); + inData.read(pos, thisWrite); + remaining -= thisWrite; + } + // was data put into it? + QVERIFY(ringBuffer.size() > 0); + QCOMPARE(qint64(ringBuffer.size()), inData.size()); + + //read from the QRingBuffer in loop, put back into another QBuffer + QBuffer outData; + outData.open(QIODevice::ReadWrite); + remaining = ringBuffer.size(); + while (remaining > 0) { + qint64 thisRead; + // always try to read as much as possible + const char *buf = ringBuffer.readPointerAtPosition(ringBuffer.size() - remaining, thisRead); + outData.write(buf, thisRead); + remaining -= thisRead; + } + outData.reset(); + + QVERIFY(outData.size() > 0); + + // was the data read from the QRingBuffer the same as the one written into it? + QCOMPARE(outData.size(), inData.size()); + QVERIFY(outData.buffer().startsWith(inData.buffer())); +} + + +QTEST_APPLESS_MAIN(tst_QRingBuffer) +#include "tst_qringbuffer.moc" diff --git a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp index 1413b0d..257ec0b 100644 --- a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp +++ b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp @@ -68,6 +68,7 @@ private slots: void iterateString(); void iterateGetterSetter(); void iterateArgumentsObject(); + void assignObjectToIterator(); void undefinedBehavior(); }; @@ -562,5 +563,37 @@ void tst_QScriptValueIterator::undefinedBehavior() QVERIFY(it.value().isNumber()); } +void tst_QScriptValueIterator::assignObjectToIterator() +{ + QScriptEngine eng; + QScriptValue obj1 = eng.newObject(); + obj1.setProperty("foo", 123); + QScriptValue obj2 = eng.newObject(); + obj2.setProperty("bar", 456); + + QScriptValueIterator it(obj1); + QVERIFY(it.hasNext()); + it.next(); + it = obj2; + QVERIFY(it.hasNext()); + it.next(); + QCOMPARE(it.name(), QString::fromLatin1("bar")); + + it = obj1; + QVERIFY(it.hasNext()); + it.next(); + QCOMPARE(it.name(), QString::fromLatin1("foo")); + + it = obj2; + QVERIFY(it.hasNext()); + it.next(); + QCOMPARE(it.name(), QString::fromLatin1("bar")); + + it = obj2; + QVERIFY(it.hasNext()); + it.next(); + QCOMPARE(it.name(), QString::fromLatin1("bar")); +} + QTEST_MAIN(tst_QScriptValueIterator) #include "tst_qscriptvalueiterator.moc" diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index ea73a5e..f414d3a 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -133,6 +133,7 @@ private slots: void task248868_dynamicSorting(); void task250023_fetchMore(); void task251296_hiddenChildren(); + void task252507_mapFromToSource(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -2612,6 +2613,7 @@ class QtTestModel: public QAbstractItemModel return fetched.contains(parent) ? rows : 0; } int columnCount(const QModelIndex& parent = QModelIndex()) const { + Q_UNUSED(parent); return cols; } @@ -2727,6 +2729,22 @@ void tst_QSortFilterProxyModel::task251296_hiddenChildren() QCOMPARE(proxy.rowCount(indexA) , 0); } +void tst_QSortFilterProxyModel::task252507_mapFromToSource() +{ + QtTestModel source(10,10); + source.fetchMore(QModelIndex()); + QSortFilterProxyModel proxy; + proxy.setSourceModel(&source); + QCOMPARE(proxy.mapFromSource(source.index(5, 4)), proxy.index(5, 4)); + QCOMPARE(proxy.mapToSource(proxy.index(3, 2)), source.index(3, 2)); + QCOMPARE(proxy.mapFromSource(QModelIndex()), QModelIndex()); + QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex()); + + QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource "); + QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex()); + QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource "); + QCOMPARE(proxy.mapFromSource(proxy.index(6, 2)), QModelIndex()); +} QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 8dede12..4fa3dc4 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -517,6 +517,8 @@ void tst_QSqlDatabase::tables() // MySQL doesn't give back anything when calling QSqlDatabase::tables() with QSql::Views // May be fixable by doing a select on informational_schema.views instead of using the client library api QEXPECT_FAIL("", "MySQL driver thinks that views are tables", Continue); + if(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)) + qDebug() << "failed to find" << qTableName("qtest_view") << "in" << tables; QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)); } if (tempTables) @@ -1880,17 +1882,26 @@ void tst_QSqlDatabase::ibase_procWithReturnValues() "\nRESULT INTEGER)" "\nAS" "\nbegin" - "\nRESULT = 10;" + "\nRESULT = 10 * ABC;" "\nsuspend;" "\nend")); // Interbase procedures can be executed in two ways: EXECUTE PROCEDURE or SELECT QVERIFY_SQL(q, exec(QString("execute procedure %1(123)").arg(procName))); QVERIFY_SQL(q, next()); - QCOMPARE(q.value(0).toInt(), 10); + QCOMPARE(q.value(0).toInt(), 1230); QVERIFY_SQL(q, exec(QString("select result from %1(456)").arg(procName))); QVERIFY_SQL(q, next()); - QCOMPARE(q.value(0).toInt(), 10); + QCOMPARE(q.value(0).toInt(), 4560); + QVERIFY_SQL(q, prepare(QLatin1String("execute procedure ")+procName+QLatin1String("(?)"))); + q.bindValue(0, 123); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1230); + q.bindValue(0, 456); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 4560); q.exec(QString("drop procedure %1").arg(procName)); } @@ -2276,7 +2287,7 @@ void tst_QSqlDatabase::db2_valueCacheUpdate() void tst_QSqlDatabase::sqlStatementUseIsNull_189093() { - // NULL = NULL is unknow, the sqlStatment must use IS NULL + // NULL = NULL is unknown, the sqlStatment must use IS NULL QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 074f16f..7f97972 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -178,9 +178,11 @@ private slots: void task_217003_data() { generic_data(); } void task_217003(); #endif - void task_250026_data() { generic_data("QODBC"); } void task_250026(); + void task_205701_data() { generic_data("QMYSQL"); } + void task_205701(); + private: @@ -297,7 +299,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) #ifdef NOT_READY_YET tablenames << qTableName( "Planet" ); #endif - tablenames << qTableName( "task_250026" ); + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); } @@ -2711,5 +2713,21 @@ void tst_QSqlQuery::task_250026() QCOMPARE( q.value( 0 ).toString().length(), data1026.length() ); } +void tst_QSqlQuery::task_205701() +{ + QSqlDatabase qsdb = QSqlDatabase::addDatabase("QMYSQL", "atest"); + qsdb.setHostName("test"); + qsdb.setDatabaseName("test"); + qsdb.setUserName("test"); + qsdb.setPassword("test"); + qsdb.open(); + +// { + QSqlQuery query(qsdb); +// } + QSqlDatabase::removeDatabase("atest"); +} + + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index b9725fd..432092a 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1286,6 +1286,8 @@ protected: // delayed start of encryption QTest::qSleep(100); QSslSocket *socket = server.socket; + Q_ASSERT(socket); + Q_ASSERT(socket->isValid()); socket->ignoreSslErrors(); socket->startServerEncryption(); if (!socket->waitForEncrypted(2000)) diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp index 139eb6e..116f46e 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -74,6 +74,7 @@ private slots: void incrementalResults(); void noDetatch(); void stlContainers(); + void qFutureAssignmentLeak(); void stressTest(); public slots: void throttling(); @@ -2323,6 +2324,36 @@ void tst_map::stlContainers() #endif } +InstanceCounter ic_fn(const InstanceCounter & ic) +{ + return InstanceCounter(ic); +}; + +// Verify that held results are deleted when a future is +// assigned over with operator == +void tst_map::qFutureAssignmentLeak() +{ + currentInstanceCount = 0; + peakInstanceCount = 0; + QFuture<InstanceCounter> future; + { + QList<InstanceCounter> list; + for (int i=0;i<1000;++i) + list += InstanceCounter(); + future = QtConcurrent::mapped(list, ic_fn); + future.waitForFinished(); + + future = QtConcurrent::mapped(list, ic_fn); + future.waitForFinished(); + + future = QtConcurrent::mapped(list, ic_fn); + future.waitForFinished(); + } + + QCOMPARE(int(currentInstanceCount), 1000); + future = QFuture<InstanceCounter>(); + QCOMPARE(int(currentInstanceCount), 0); +} inline void increment(int &num) { diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/qtemporaryfile/qtemporaryfile.pro index 0c90994..bde990a 100644 --- a/tests/auto/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/qtemporaryfile/qtemporaryfile.pro @@ -2,5 +2,4 @@ load(qttest_p4) SOURCES += tst_qtemporaryfile.cpp QT = core - - +DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp index f5155ae..2daa0f6 100644 --- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp @@ -51,6 +51,13 @@ #if defined(Q_OS_WIN) # include <windows.h> #endif +#if defined(Q_OS_UNIX) +# include <sys/types.h> +# include <sys/stat.h> +# include <errno.h> +# include <fcntl.h> // open(2) +# include <unistd.h> // close(2) +#endif //TESTED_CLASS= //TESTED_FILES= @@ -78,6 +85,7 @@ private slots: void openOnRootDrives(); void stressTest(); void rename(); + void renameFdLeak(); public: }; @@ -356,5 +364,42 @@ void tst_QTemporaryFile::rename() QVERIFY(!dir.exists("temporary-file.txt")); } +void tst_QTemporaryFile::renameFdLeak() +{ +#ifdef Q_OS_UNIX + // Test this on Unix only + + // Open a bunch of files to force the fd count to go up + static const int count = 10; + int bunch_of_files[count]; + for (int i = 0; i < count; ++i) { + bunch_of_files[i] = ::open(SRCDIR "tst_qtemporaryfile.cpp", O_RDONLY); + QVERIFY(bunch_of_files[i] != -1); + } + + int fd; + { + QTemporaryFile file; + file.setAutoRemove(false); + QVERIFY(file.open()); + + // close the bunch of files + for (int i = 0; i < count; ++i) + ::close(bunch_of_files[i]); + + // save the file descriptor for later + fd = file.handle(); + + // rename the file to something + QString newPath = QDir::tempPath() + "/tst_qtemporaryfile-renameFdLeak-" + QString::number(getpid()); + file.rename(newPath); + QFile::remove(newPath); + } + + // check if QTemporaryFile closed the file + QVERIFY(::close(fd) == -1 && errno == EBADF); +#endif +} + QTEST_MAIN(tst_QTemporaryFile) #include "tst_qtemporaryfile.moc" diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index cf4135b..22f9557 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -79,6 +79,9 @@ private slots: void codecForHtml(); + void codecForUtfText_data(); + void codecForUtfText(); + #ifdef Q_OS_UNIX void toLocal8Bit(); #endif @@ -1744,6 +1747,62 @@ void tst_QTextCodec::codecForHtml() QCOMPARE(QTextCodec::codecForHtml(html, QTextCodec::codecForMib(106))->mibEnum(), 111); // latin 15 } +void tst_QTextCodec::codecForUtfText_data() +{ + QTest::addColumn<QByteArray>("encoded"); + QTest::addColumn<bool>("detected"); + QTest::addColumn<int>("mib"); + + + QTest::newRow("utf8 bom") + << QByteArray("\xef\xbb\xbfhello") + << true + << 106; + QTest::newRow("utf8 nobom") + << QByteArray("hello") + << false + << 0; + + QTest::newRow("utf16 bom be") + << QByteArray("\xfe\xff\0h\0e\0l", 8) + << true + << 1013; + QTest::newRow("utf16 bom le") + << QByteArray("\xff\xfeh\0e\0l\0", 8) + << true + << 1014; + QTest::newRow("utf16 nobom") + << QByteArray("\0h\0e\0l", 6) + << false + << 0; + + QTest::newRow("utf32 bom be") + << QByteArray("\0\0\xfe\xff\0\0\0h\0\0\0e\0\0\0l", 16) + << true + << 1018; + QTest::newRow("utf32 bom le") + << QByteArray("\xff\xfe\0\0h\0\0\0e\0\0\0l\0\0\0", 16) + << true + << 1019; + QTest::newRow("utf32 nobom") + << QByteArray("\0\0\0h\0\0\0e\0\0\0l", 12) + << false + << 0; +} + +void tst_QTextCodec::codecForUtfText() +{ + QFETCH(QByteArray, encoded); + QFETCH(bool, detected); + QFETCH(int, mib); + + QTextCodec *codec = QTextCodec::codecForUtfText(encoded, 0); + if (detected) + QCOMPARE(codec->mibEnum(), mib); + else + QVERIFY(codec == 0); +} + #ifdef Q_OS_UNIX void tst_QTextCodec::toLocal8Bit() { diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 4ef5299..63a172b 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -161,6 +161,8 @@ private slots: void testUndoCommandAdded(); + void testUndoBlocks(); + private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); @@ -2435,5 +2437,21 @@ void tst_QTextDocument::testUndoCommandAdded() QCOMPARE(spy.count(), 1); } +void tst_QTextDocument::testUndoBlocks() +{ + QVERIFY(doc); + cursor.insertText("Hello World"); + cursor.insertText("period"); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); + cursor.insertText("Hello World"); + cursor.insertText("One\nTwo\nThree"); + QCOMPARE(doc->toPlainText(), QString("Hello WorldOne\nTwo\nThree")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("Hello World")); + doc->undo(); + QCOMPARE(doc->toPlainText(), QString("")); +} + QTEST_MAIN(tst_QTextDocument) #include "tst_qtextdocument.moc" diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 37cb5b0..c4517d6 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -208,8 +208,8 @@ private slots: void indexRowSizeHint(); void addRowsWhileSectionsAreHidden(); - void filterProxyModelCrash(); + void styleOptionViewItem(); // task-specific tests: void task174627_moveLeftToRoot(); @@ -226,6 +226,7 @@ private slots: void task244304_clickOnDecoration(); void task246536_scrollbarsNotWorking(); void task250683_wrongSectionSize(); + void task239271_addRowsWithFirstColumnHidden(); }; class QtTestModel: public QAbstractItemModel @@ -2027,6 +2028,8 @@ void tst_QTreeView::scrollTo() // view.show(); + view.setVerticalScrollMode(QAbstractItemView::ScrollPerItem); //some styles change that in Polish + view.resize(300, 200); //view.verticalScrollBar()->setValue(0); @@ -2039,6 +2042,7 @@ void tst_QTreeView::scrollTo() QCOMPARE(view.verticalScrollBar()->value(), 5); view.scrollTo(model.index(60, 60, QModelIndex())); + CHECK_VISIBLE(60,60); view.scrollTo(model.index(60, 30, QModelIndex())); CHECK_VISIBLE(60,30); @@ -2848,6 +2852,75 @@ void tst_QTreeView::filterProxyModelCrash() view.repaint(); //used to crash } +void tst_QTreeView::styleOptionViewItem() +{ + class MyDelegate : public QStyledItemDelegate + { + public: + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const + { + QVERIFY(qstyleoption_cast<const QStyleOptionViewItemV4 *>(&option)); + QStyleOptionViewItemV4 opt(option); + initStyleOption(&opt, index); + + QVERIFY(!opt.text.isEmpty()); + QCOMPARE(opt.index, index); + QCOMPARE(!(opt.features & QStyleOptionViewItemV2::Alternate), !(index.row() % 2)); + QCOMPARE(!(opt.features & QStyleOptionViewItemV2::HasCheckIndicator), !opt.text.contains("Checkable")); + + if (opt.text.contains("Beginning")) + QCOMPARE(opt.viewItemPosition, QStyleOptionViewItemV4::Beginning); + + if (opt.text.contains("Middle")) + QCOMPARE(opt.viewItemPosition, QStyleOptionViewItemV4::Middle); + + if (opt.text.contains("End")) + QCOMPARE(opt.viewItemPosition, QStyleOptionViewItemV4::End); + + if (opt.text.contains("OnlyOne")) + QCOMPARE(opt.viewItemPosition, QStyleOptionViewItemV4::OnlyOne); + + if (opt.text.contains("Checked")) + QCOMPARE(opt.checkState, Qt::Checked); + else + QCOMPARE(opt.checkState, Qt::Unchecked); + + QVERIFY(!opt.text.contains("Assert")); + + QStyledItemDelegate::paint(painter, option, index); + count++; + } + mutable int count; + }; + + QTreeView view; + QStandardItemModel model; + view.setModel(&model); + MyDelegate delegate; + view.setItemDelegate(&delegate); + model.appendRow(QList<QStandardItem*>() + << new QStandardItem("Beginning") << new QStandardItem("Middle") << new QStandardItem("Middle") << new QStandardItem("End") ); + model.appendRow(QList<QStandardItem*>() + << new QStandardItem("Beginning") << new QStandardItem("Middle") << new QStandardItem("Middle") << new QStandardItem("End") ); + model.appendRow(QList<QStandardItem*>() + << new QStandardItem("OnlyOne") << new QStandardItem("Assert") << new QStandardItem("Assert") << new QStandardItem("Assert") ); + QStandardItem *checkable = new QStandardItem("Checkable"); + checkable->setCheckable(true); + QStandardItem *checked = new QStandardItem("Checkable Checked"); + checkable->setCheckable(true); + checked->setCheckState(Qt::Checked); + model.appendRow(QList<QStandardItem*>() + << new QStandardItem("Beginning") << checkable << checked << new QStandardItem("End") ); + + view.setFirstColumnSpanned(2, QModelIndex(), true); + view.setAlternatingRowColors(true); + + delegate.count = 0; + view.showMaximized(); + QTest::qWait(30); + QVERIFY(delegate.count >= 13); +} + class task174627_TreeView : public QTreeView { Q_OBJECT @@ -3289,6 +3362,43 @@ void tst_QTreeView::task250683_wrongSectionSize() QCOMPARE(treeView.header()->sectionSize(0) + treeView.header()->sectionSize(1), treeView.viewport()->width()); } +void tst_QTreeView::task239271_addRowsWithFirstColumnHidden() +{ + class MyDelegate : public QStyledItemDelegate + { + public: + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const + { + paintedIndexes << index; + QStyledItemDelegate::paint(painter, option, index); + } + + mutable QSet<QModelIndex> paintedIndexes; + }; + + QTreeView view; + QStandardItemModel model; + view.setModel(&model); + MyDelegate delegate; + view.setItemDelegate(&delegate); + QStandardItem root0("root0"), root1("root1"); + model.invisibleRootItem()->appendRow(QList<QStandardItem*>() << &root0 << &root1); + QStandardItem sub0("sub0"), sub00("sub00"); + root0.appendRow(QList<QStandardItem*>() << &sub0 << &sub00); + view.expand(root0.index()); + + view.hideColumn(0); + view.show(); + QTest::qWait(200); + delegate.paintedIndexes.clear(); + QStandardItem sub1("sub1"), sub11("sub11"); + root0.appendRow(QList<QStandardItem*>() << &sub1 << &sub11); + + QTest::qWait(200); + //items in the 2nd column should have been painted + QVERIFY(delegate.paintedIndexes.contains(sub00.index())); + QVERIFY(delegate.paintedIndexes.contains(sub11.index())); +} QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index c3595c2..906332c 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -136,6 +136,7 @@ private slots: void rootItemFlags(); void task218661_setHeaderData(); void task245280_sortChildren(); + void task253109_itemHeight(); // QTreeWidgetItem void itemOperatorLessThan(); @@ -2879,6 +2880,25 @@ void tst_QTreeWidget::task245280_sortChildren() QCOMPARE(top.child(i)->text(1), QString::number(i)); } +void tst_QTreeWidget::task253109_itemHeight() +{ + QTreeWidget treeWidget; + treeWidget.setColumnCount(1); + treeWidget.show(); + QTest::qWait(200); + + QTreeWidgetItem item(&treeWidget); + class MyWidget : public QWidget + { + virtual QSize sizeHint() const { return QSize(200,100); } + } w; + treeWidget.setItemWidget(&item, 0, &w); + + QTest::qWait(200); + QCOMPARE(w.geometry(), treeWidget.visualItemRect(&item)); + +} + void tst_QTreeWidget::task206367_duplication() { QTreeWidget treeWidget; diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index ee61871..efdaaec 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -287,6 +287,7 @@ private slots: void render_systemClip2(); void render_systemClip3_data(); void render_systemClip3(); + void render_task252837(); void setContentsMargins(); @@ -7138,6 +7139,16 @@ void tst_QWidget::render_systemClip3() } } +void tst_QWidget::render_task252837() +{ + QWidget widget; + widget.resize(200, 200); + + QPixmap pixmap(widget.size()); + QPainter painter(&pixmap); + // Please do not crash. + widget.render(&painter); +} void tst_QWidget::setContentsMargins() { QLabel label("why does it always rain on me?"); diff --git a/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt b/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt new file mode 100644 index 0000000..bd84fae --- /dev/null +++ b/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt @@ -0,0 +1,59 @@ +The XML testsuite available here is a copy of the Extensible Markup +Language (XML) Conformance Test Suites provided by W3C. Please see +http://www.w3.org/XML/Test/ for updates and other information. + +These files are licensed under the W3C Software License (19980720), +reproduced below: + +--- +W3C® SOFTWARE NOTICE AND LICENSE + +Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts +Institute of Technology, Institut National de Recherche en +Informatique et en Automatique, Keio University). All Rights +Reserved. http://www.w3.org/Consortium/Legal/ + +This W3C work (including software, documents, or other related items) +is being provided by the copyright holders under the following +license. By obtaining, using and/or copying this work, you (the +licensee) agree that you have read, understood, and will comply with +the following terms and conditions: + +Permission to use, copy, modify, and distribute this software and its +documentation, with or without modification, for any purpose and +without fee or royalty is hereby granted, provided that you include +the following on ALL copies of the software and documentation or +portions thereof, including modifications, that you make: + + 1. The full text of this NOTICE in a location viewable to users of + the redistributed or derivative work. + + 2. Any pre-existing intellectual property disclaimers, notices, or + terms and conditions. If none exist, a short notice of the + following form (hypertext is preferred, text is permitted) should + be used within the body of any redistributed or derivative code: + "Copyright © [$date-of-software] World Wide Web Consortium, + (Massachusetts Institute of Technology, Institut National de + Recherche en Informatique et en Automatique, Keio University). All + Rights Reserved. http://www.w3.org/Consortium/Legal/" + + 3. Notice of any changes or modifications to the W3C files, including + the date changes were made. (We recommend you provide URIs to the + location from which the code is derived.) + +THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT +HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR +DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, +TRADEMARKS OR OTHER RIGHTS. + +COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL +OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR +DOCUMENTATION. + +The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to the software without specific, +written prior permission. Title to copyright in this software and any +associated documentation will at all times remain with copyright +holders. diff --git a/tests/auto/selftests/badxml/tst_badxml.cpp b/tests/auto/selftests/badxml/tst_badxml.cpp index 6b2e4c4..fa5b717 100644 --- a/tests/auto/selftests/badxml/tst_badxml.cpp +++ b/tests/auto/selftests/badxml/tst_badxml.cpp @@ -58,6 +58,8 @@ private slots: void badMessage() const; void badMessage_data() const; + void failWithNoFile() const; + public: static QList<QByteArray> const& badStrings(); }; @@ -116,6 +118,11 @@ void tst_BadXml::badDataTag_data() const } } +void tst_BadXml::failWithNoFile() const +{ + QTest::qFail("failure message", 0, 0); +} + /* Outputs a message containing a bad string. */ diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/selftests/expected_xunit.txt index 0f7e70a..875dda6 100644 --- a/tests/auto/selftests/expected_xunit.txt +++ b/tests/auto/selftests/expected_xunit.txt @@ -6,19 +6,24 @@ </properties> <testcase result="pass" name="initTestCase"/> <testcase result="pass" name="testFunc1"> - <error message="just a QWARN() !" type="warn"/> + <!-- message="just a QWARN() !" type="warn" --> </testcase> <testcase result="fail" name="testFunc2"> - <error message="a qDebug() call!" type="qdebug"/> + <!-- message="a qDebug() call with comment-ending stuff -->" type="qdebug" --> <failure message="Compared values are not the same Actual (2): 2 Expected (3): 3" result="fail"/> </testcase> <testcase name="testFunc3"> - <error message="skipping this function!" type="skip"/> + <!-- message="skipping this function!" type="skip" --> </testcase> <testcase result="fail" name="testFunc4"> <failure message="a forced failure!" result="fail"/> </testcase> <testcase result="pass" name="cleanupTestCase"/> + <system-err> +<![CDATA[just a QWARN() !]]> +<![CDATA[a qDebug() call with comment-ending stuff -->]]> +<![CDATA[skipping this function!]]> + </system-err> </testsuite> diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index aa1048b..603e730 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -307,13 +307,12 @@ void tst_Selftests::initTestCase() m_checkXMLBlacklist.append("qexecstringlist"); m_checkXMLBlacklist.append("benchliboptions"); + /* These tests use printf and therefore corrupt the testlog */ + m_checkXMLBlacklist.append("subtest"); + m_checkXMLBlacklist.append("globaldata"); + m_checkXMLBlacklist.append("warnings"); + m_checkXunitBlacklist = m_checkXMLBlacklist; - m_checkXunitBlacklist.append("benchlibwalltime"); - m_checkXunitBlacklist.append("benchlibeventcounter"); - m_checkXunitBlacklist.append("benchlibcallgrind"); - m_checkXunitBlacklist.append("subtest"); - m_checkXunitBlacklist.append("globaldata"); - m_checkXunitBlacklist.append("warnings"); } void tst_Selftests::checkXML() const @@ -324,34 +323,41 @@ void tst_Selftests::checkXML() const if(m_checkXMLBlacklist.contains(subdir)) return; - arguments.prepend("-xml"); - arguments.prepend("-flush"); - - QProcess proc; - proc.setEnvironment(QStringList("")); - proc.start(subdir + "/" + subdir, arguments); - QVERIFY(proc.waitForFinished()); - - QByteArray out(proc.readAllStandardOutput()); - QByteArray err(proc.readAllStandardError()); - - /* Some platforms decides to output a message for uncaught exceptions. For instance, - * this is what windows platforms says: - * "This application has requested the Runtime to terminate it in an unusual way. - * Please contact the application's support team for more information." */ - if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus")) - QVERIFY2(err.isEmpty(), err.constData()); - - QXmlStreamReader reader(out); - - while(!reader.atEnd()) - reader.readNext(); - - QVERIFY2(!reader.error(), qPrintable(QString("line %1, col %2: %3") - .arg(reader.lineNumber()) - .arg(reader.columnNumber()) - .arg(reader.errorString()) - )); + QStringList args; + /* Test both old (-flush) and new XML logger implementation */ + for (int i = 0; i < 2; ++i) { + bool flush = i; + args = arguments; + args.prepend("-xml"); + if (flush) args.prepend("-flush"); + + QProcess proc; + proc.setEnvironment(QStringList("")); + proc.start(subdir + "/" + subdir, args); + QVERIFY(proc.waitForFinished()); + + QByteArray out(proc.readAllStandardOutput()); + QByteArray err(proc.readAllStandardError()); + + /* Some platforms decides to output a message for uncaught exceptions. For instance, + * this is what windows platforms says: + * "This application has requested the Runtime to terminate it in an unusual way. + * Please contact the application's support team for more information." */ + if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus")) + QVERIFY2(err.isEmpty(), err.constData()); + + QXmlStreamReader reader(out); + + while(!reader.atEnd()) + reader.readNext(); + + QVERIFY2(!reader.error(), qPrintable(QString("(flush %0) line %1, col %2: %3") + .arg(flush) + .arg(reader.lineNumber()) + .arg(reader.columnNumber()) + .arg(reader.errorString()) + )); + } } void tst_Selftests::checkXunitxml() const diff --git a/tests/auto/selftests/xunit/tst_xunit.cpp b/tests/auto/selftests/xunit/tst_xunit.cpp index d0b585f..dbe9fec 100644 --- a/tests/auto/selftests/xunit/tst_xunit.cpp +++ b/tests/auto/selftests/xunit/tst_xunit.cpp @@ -67,7 +67,7 @@ void tst_Xunit::testFunc1() void tst_Xunit::testFunc2() { - qDebug("a qDebug() call!"); + qDebug("a qDebug() call with comment-ending stuff -->"); QCOMPARE(2, 3); } diff --git a/tests/auto/utf8/tst_utf8.cpp b/tests/auto/utf8/tst_utf8.cpp new file mode 100644 index 0000000..3aef69f --- /dev/null +++ b/tests/auto/utf8/tst_utf8.cpp @@ -0,0 +1,309 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtTest/QtTest> + +#include <qtextcodec.h> +#include <qsharedpointer.h> + +//TESTED_CLASS= +//TESTED_FILES= + +static const char utf8bom[] = "\xEF\xBB\xBF"; + +class tst_Utf8 : public QObject +{ + Q_OBJECT + +public: + // test data: + QTextCodec *codec; + QString (*from8BitPtr)(const char *, int); + QByteArray (QString:: *to8Bit)() const; + + inline QString from8Bit(const QByteArray &ba) + { return from8BitPtr(ba.constData(), ba.length()); } +public slots: + void initTestCase(); + void init(); + +private slots: + void roundTrip_data(); + void roundTrip(); + + void charByChar_data(); + void charByChar(); + + void invalidUtf8_data(); + void invalidUtf8(); +}; + +void tst_Utf8::initTestCase() +{ + QTest::addColumn<bool>("useLocale"); + QTest::newRow("utf8codec") << false; + + // is the locale UTF-8? + if (QString(QChar(QChar::ReplacementCharacter)).toLocal8Bit() == "\xEF\xBF\xBD") { + QTest::newRow("localecodec") << true; + qDebug() << "locale is utf8"; + } +} + +void tst_Utf8::init() +{ + QFETCH_GLOBAL(bool, useLocale); + if (useLocale) { + codec = QTextCodec::codecForLocale(); + from8BitPtr = &QString::fromLocal8Bit; + to8Bit = &QString::toLocal8Bit; + } else { + codec = QTextCodec::codecForMib(106); + from8BitPtr = &QString::fromUtf8; + to8Bit = &QString::toUtf8; + } +} + +void tst_Utf8::roundTrip_data() +{ + QTest::addColumn<QByteArray>("utf8"); + QTest::addColumn<QString>("utf16"); + + QTest::newRow("empty") << QByteArray() << QString(); + QTest::newRow("nul") << QByteArray("", 1) << QString(QChar(QChar::Null)); + + static const char ascii[] = "This is a standard US-ASCII message"; + QTest::newRow("ascii") << QByteArray(ascii) << ascii; + + static const char ascii2[] = "\1This\2is\3an\4US-ASCII\020 message interspersed with control chars"; + QTest::newRow("ascii2") << QByteArray(ascii2) << ascii2; + + static const char utf8_1[] = "\302\240"; // NBSP + QTest::newRow("utf8_1") << QByteArray(utf8_1) << QString(QChar(QChar::Nbsp)); + + static const char utf8_2[] = "\342\202\254"; // Euro symbol + QTest::newRow("utf8_2") << QByteArray(utf8_2) << QString(QChar(0x20AC)); + +#if 0 + // Can't test this because QString::fromUtf8 consumes it + static const char utf8_3[] = "\357\273\277"; // byte order mark + QTest::newRow("utf8_3") << QByteArray(utf8_3) << QString(QChar(QChar::ByteOrderMark)); +#endif + + static const char utf8_4[] = "\357\277\275"; // replacement char + QTest::newRow("utf8_4") << QByteArray(utf8_4) << QString(QChar(QChar::ReplacementCharacter)); + + static const char utf8_5[] = "\360\220\210\203"; // U+010203 + static const uint utf32_5[] = { 0x010203 }; + QTest::newRow("utf8_5") << QByteArray(utf8_5) << QString::fromUcs4(utf32_5, 1); + + static const char utf8_6[] = "\364\217\277\277"; // U+10FFFF + static const uint utf32_6[] = { 0x10FFFF }; + QTest::newRow("utf8_6") << QByteArray(utf8_6) << QString::fromUcs4(utf32_6, 1); + + static const char utf8_7[] = "abc\302\240\303\241\303\251\307\275 \342\202\254def"; + static const ushort utf16_7[] = { 'a', 'b', 'c', 0x00A0, + 0x00E1, 0x00E9, 0x01FD, + ' ', 0x20AC, 'd', 'e', 'f', 0 }; + QTest::newRow("utf8_7") << QByteArray(utf8_7) << QString::fromUtf16(utf16_7); + + static const char utf8_8[] = "abc\302\240\303\241\303\251\307\275 \364\217\277\277 \342\202\254def"; + static const uint utf32_8[] = { 'a', 'b', 'c', 0x00A0, + 0x00E1, 0x00E9, 0x01FD, + ' ', 0x10FFFF, ' ', + 0x20AC, 'd', 'e', 'f', 0 }; + QTest::newRow("utf8_8") << QByteArray(utf8_8) << QString::fromUcs4(utf32_8); +} + +void tst_Utf8::roundTrip() +{ + QFETCH(QByteArray, utf8); + QFETCH(QString, utf16); + + QCOMPARE((utf16.*to8Bit)(), utf8); + QCOMPARE(from8Bit(utf8), utf16); + + QCOMPARE((from8Bit(utf8).*to8Bit)(), utf8); + QCOMPARE(from8Bit((utf16.*to8Bit)()), utf16); +} + +void tst_Utf8::charByChar_data() +{ + roundTrip_data(); +} + +void tst_Utf8::charByChar() +{ + QFETCH(QByteArray, utf8); + QFETCH(QString, utf16); + + { + // from utf16 to utf8 char by char: + QSharedPointer<QTextEncoder> encoder = QSharedPointer<QTextEncoder>(codec->makeEncoder()); + QByteArray encoded; + + for (int i = 0; i < utf16.length(); ++i) { + encoded += encoder->fromUnicode(utf16.constData() + i, 1); + QVERIFY(!encoder->hasFailure()); + } + + if (encoded.startsWith(utf8bom)) + encoded = encoded.mid(strlen(utf8bom)); + QCOMPARE(encoded, utf8); + } + { + // from utf8 to utf16 char by char: + QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder()); + QString decoded; + + for (int i = 0; i < utf8.length(); ++i) { + decoded += decoder->toUnicode(utf8.constData() + i, 1); + QVERIFY(!decoder->hasFailure()); + } + + QCOMPARE(decoded, utf16); + } +} + +void tst_Utf8::invalidUtf8_data() +{ + QTest::addColumn<QByteArray>("utf8"); + + QTest::newRow("1char") << QByteArray("\x80"); + QTest::newRow("2chars") << QByteArray("\xC2\xC0"); + QTest::newRow("3chars-1") << QByteArray("\xE0\xA0\xC0"); + QTest::newRow("3chars-2") << QByteArray("\xE0\xC0\xA0"); + QTest::newRow("4chars-1") << QByteArray("\xF0\x90\x80\xC0"); + QTest::newRow("4chars-2") << QByteArray("\xF0\x90\xC0\x80"); + QTest::newRow("4chars-3") << QByteArray("\xF0\xC0\x80\x80"); + + // U+FFFE and U+FFFF are non-characters and must not be present + // U+FFFE: 1111 11 1111 11 1110 + // encoding: xxxz:1111 xz11:1111 xz11:1110 + QTest::newRow("fffe") << QByteArray("\xEF\xBF\xBE"); + // U+FFFF: 1111 11 1111 11 1111 + // encoding: xxxz:1111 xz11:1111 xz11:1111 + QTest::newRow("ffff") << QByteArray("\xEF\xBF\xBF"); + + // Surrogate pairs must now be present either + // U+D800: 1101 10 0000 00 0000 + // encoding: xxxz:1101 xz10:0000 xz00:0000 + QTest::newRow("hi-surrogate") << QByteArray("\xED\xA0\x80"); + // U+DC00: 1101 11 0000 00 0000 + // encoding: xxxz:1101 xz11:0000 xz00:0000 + QTest::newRow("lo-surrogate") << QByteArray("\xED\xB0\x80"); + + // not even in pair: + QTest::newRow("surrogate-pair") << QByteArray("\xED\xA0\x80\xED\xB0\x80"); + + // Characters outside the Unicode range: + // 0x110000: 00 0100 01 0000 00 0000 00 0000 + // encoding: xxxx:z100 xz01:0000 xz00:0000 xz00:0000 + QTest::newRow("non-unicode-1") << QByteArray("\xF4\x90\x80\x80"); + // 0x200000: 00 1000 00 0000 00 0000 00 0000 + // encoding: xxxx:xz00 xz00:1000 xz00:0000 xz00:0000 xz00:0000 + QTest::newRow("non-unicode-2") << QByteArray("\xF8\x88\x80\x80\x80"); + // 0x04000000: 0100 00 0000 00 0000 00 0000 00 0000 + // encoding: xxxx:xxz0 xz00:0100 xz00:0000 xz00:0000 xz00:0001 xz00:0001 + QTest::newRow("non-unicode-3") << QByteArray("\xFC\x84\x80\x80\x80\x80"); + // 0x7fffffff: 1 11 1111 11 1111 11 1111 11 1111 11 1111 + // encoding: xxxx:xxz0 xz00:0100 xz00:0000 xz00:0000 xz00:0001 xz00:0001 + QTest::newRow("non-unicode-3") << QByteArray("\xFD\xBF\xBF\xBF\xBF\xBF"); + + // As seen above, 0xFE and 0xFF never appear: + QTest::newRow("fe") << QByteArray("\xFE"); + QTest::newRow("fe-bis") << QByteArray("\xFE\xBF\xBF\xBF\xBF\xBF\xBF"); + QTest::newRow("ff") << QByteArray("\xFF"); + QTest::newRow("ff-bis") << QByteArray("\xFF\xBF\xBF\xBF\xBF\xBF\xBF\xBF"); + + // some combinations in UTF-8 are invalid even though they have the proper bits set + // these are known as overlong sequences + + // "A": U+0041: 01 00 0001 + // overlong 2: xxz0:0001 xz00:0001 + QTest::newRow("overlong-1-2") << QByteArray("\xC1\x81"); + // overlong 3: xxxz:0000 xz00:0001 xz00:0001 + QTest::newRow("overlong-1-3") << QByteArray("\xE0\x81\x81"); + // overlong 4: xxxx:z000 xz00:0000 xz00:0001 xz00:0001 + QTest::newRow("overlong-1-4") << QByteArray("\xF0\x80\x81\x81"); + // overlong 5: xxxx:xz00 xz00:0000 xz00:0000 xz00:0001 xz00:0001 + QTest::newRow("overlong-1-5") << QByteArray("\xF8\x80\x80\x81\x81"); + // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0000 xz00:0001 xz00:0001 + QTest::newRow("overlong-1-6") << QByteArray("\xFC\x80\x80\x80\x81\x81"); + + // NBSP: U+00A0: 10 00 0000 + // proper encoding: xxz0:0010 xz00:0000 + // overlong 3: xxxz:0000 xz00:0010 xz00:0000 + QTest::newRow("overlong-2-3") << QByteArray("\xC0\x82\x80"); + // overlong 4: xxxx:z000 xz00:0000 xz00:0010 xz00:0000 + QTest::newRow("overlong-2-4") << QByteArray("\xF0\x80\x82\x80"); + // overlong 5: xxxx:xz00 xz00:0000 xz00:0000 xz00:0010 xz00:0000 + QTest::newRow("overlong-2-4") << QByteArray("\xF8\x80\x80\x82\x80"); + // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0000 xz00:0010 xz00:0000 + QTest::newRow("overlong-2-4") << QByteArray("\xFC\x80\x80\x80\x82\x80"); + + // U+0800: 10 0000 00 0000 + // proper encoding: xxxz:0000 xz10:0000 xz00:0000 + // overlong 4: xxxx:z000 xz00:0000 xz10:0000 xz00:0000 + QTest::newRow("overlong-3-4") << QByteArray("\xF0\x80\xA0\x80"); + // overlong 5: xxxx:xz00 xz00:0000 xz00:0000 xz10:0000 xz00:0000 + QTest::newRow("overlong-3-5") << QByteArray("\xF8\x80\x80\xA0\x80"); + // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0000 xz10:0000 xz00:0000 + QTest::newRow("overlong-3-6") << QByteArray("\xFC\x80\x80\x80\xA0\x80"); + + // U+010000: 00 0100 00 0000 00 0000 + // proper encoding: xxxx:z000 xz00:0100 xz00:0000 xz00:0000 + // overlong 5: xxxx:xz00 xz00:0000 xz00:0100 xz00:0000 xz00:0000 + QTest::newRow("overlong-4-5") << QByteArray("\xF8\x80\x84\x80\x80"); + // overlong 6: xxxx:xxz0 xz00:0000 xz00:0000 xz00:0100 xz00:0000 xz00:0000 + QTest::newRow("overlong-4-6") << QByteArray("\xFC\x80\x80\x84\x80\x80"); +} + +void tst_Utf8::invalidUtf8() +{ + QFETCH(QByteArray, utf8); + + QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder()); + QString decoded = decoder->toUnicode(utf8); + QVERIFY(decoder->hasFailure()); +} + +QTEST_MAIN(tst_Utf8) +#include "tst_utf8.moc" diff --git a/tests/auto/utf8/utf8.pro b/tests/auto/utf8/utf8.pro new file mode 100644 index 0000000..4ec6851 --- /dev/null +++ b/tests/auto/utf8/utf8.pro @@ -0,0 +1,3 @@ +load(qttest_p4) +QT -= gui +SOURCES += tst_utf8.cpp diff --git a/tests/auto/windowsmobile/test/ddhelper.cpp b/tests/auto/windowsmobile/test/ddhelper.cpp new file mode 100644 index 0000000..5955cd3 --- /dev/null +++ b/tests/auto/windowsmobile/test/ddhelper.cpp @@ -0,0 +1,121 @@ + +#ifdef Q_OS_WINCE_WM + +#include <Ddraw.h> +#include <QDebug> + +static LPDIRECTDRAW g_pDD = NULL; // DirectDraw object +static LPDIRECTDRAWSURFACE g_pDDSSurface = NULL; // DirectDraw primary surface + +static DDSCAPS ddsCaps; +static DDSURFACEDESC ddsSurfaceDesc; +static void *buffer = NULL; + +static int width = 0; +static int height = 0; +static int pitch = 0; +static int bitCount = 0; +static int windowId = 0; + +static bool initialized = false; +static bool locked = false; + +void q_lock() +{ + if (locked) { + qWarning("Direct Painter already locked (QDirectPainter::lock())"); + return; + } + locked = true; + + + memset(&ddsSurfaceDesc, 0, sizeof(ddsSurfaceDesc)); + ddsSurfaceDesc.dwSize = sizeof(ddsSurfaceDesc); + + HRESULT h = g_pDDSSurface->Lock(0, &ddsSurfaceDesc, DDLOCK_WRITEONLY, 0); + if (h != DD_OK) + qDebug() << "GetSurfaceDesc failed!"; + + width = ddsSurfaceDesc.dwWidth; + height = ddsSurfaceDesc.dwHeight; + bitCount = ddsSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; + pitch = ddsSurfaceDesc.lPitch; + buffer = ddsSurfaceDesc.lpSurface; +} + +void q_unlock() +{ + if( !locked) { + qWarning("Direct Painter not locked (QDirectPainter::unlock()"); + return; + } + g_pDDSSurface->Unlock(0); + locked = false; +} + +void q_initDD() +{ + if (initialized) + return; + + DirectDrawCreate(NULL, &g_pDD, NULL); + + HRESULT h; + h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL); + + if (h != DD_OK) + qDebug() << "cooperation level failed"; + + h = g_pDD->TestCooperativeLevel(); + if (h != DD_OK) + qDebug() << "cooperation level failed test"; + + DDSURFACEDESC ddsd; + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + + ddsd.dwFlags = DDSD_CAPS; + + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL); + + if (h != DD_OK) + qDebug() << "CreateSurface failed!"; + + if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK) + qDebug() << "GetCaps failed"; + + q_lock(); + q_unlock(); + initialized = true; +} + +uchar* q_frameBuffer() +{ + return (uchar*) buffer; +} + +int q_screenDepth() +{ + return bitCount; +} + +int q_screenWidth() +{ + return width; +} + +int q_screenHeight() +{ + return height; +} + +int q_linestep() +{ + return pitch; +} + +#endif //Q_OS_WINCE_WM + + diff --git a/tests/auto/windowsmobile/test/ddhelper.h b/tests/auto/windowsmobile/test/ddhelper.h new file mode 100644 index 0000000..3dfa9e6 --- /dev/null +++ b/tests/auto/windowsmobile/test/ddhelper.h @@ -0,0 +1,21 @@ +#ifndef __DDHELPER__ +#define __DDHELPER__ + +extern uchar* q_frameBuffer(); + +extern int q_screenDepth(); + +extern int q_screenWidth(); + +extern int q_screenHeight(); + +extern int q_linestep(); + +extern void q_initDD(); + +extern void q_unlock(); + +extern void q_lock(); + +#endif //__DDHELPER__ + diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro new file mode 100644 index 0000000..2420bf1 --- /dev/null +++ b/tests/auto/windowsmobile/test/test.pro @@ -0,0 +1,24 @@ + +load(qttest_p4) + +HEADERS += ddhelper.h +SOURCES += tst_windowsmobile.cpp ddhelper.cpp +RESOURCES += windowsmobile.qrc + +TARGET = tst_windowsmobile + +wincewm*: { + addFiles.sources = \ + ../testQMenuBar/*.exe + + + addFiles.path = "\Program Files\tst_windowsmobile" + DEPLOYMENT += addFiles +} + +wincewm*: { + LIBS += Ddraw.lib +} + + + diff --git a/tests/auto/windowsmobile/test/testQMenuBar_current.png b/tests/auto/windowsmobile/test/testQMenuBar_current.png Binary files differnew file mode 100644 index 0000000..d03e69a --- /dev/null +++ b/tests/auto/windowsmobile/test/testQMenuBar_current.png diff --git a/tests/auto/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/windowsmobile/test/testSimpleWidget_current.png Binary files differnew file mode 100644 index 0000000..5cbc2bb --- /dev/null +++ b/tests/auto/windowsmobile/test/testSimpleWidget_current.png diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp new file mode 100644 index 0000000..391e206 --- /dev/null +++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> +#include <QtCore/QDate> +#include <QtCore/QDebug> +#include <QtCore/QObject> +#include <QtGui> +#include <windows.h> +#include <ddhelper.h> + + + +class tst_WindowsMobile : public QObject +{ + Q_OBJECT +public: + tst_WindowsMobile() + { +#ifdef Q_OS_WINCE_WM + q_initDD(); +#endif + } + +#ifdef Q_OS_WINCE_WM + private slots: + void testMainWindowAndMenuBar(); + void testSimpleWidget(); +#endif +}; + +#ifdef Q_OS_WINCE_WM + +bool qt_wince_is_platform(const QString &platformString) { + TCHAR tszPlatform[64]; + if (SystemParametersInfo(SPI_GETPLATFORMTYPE, + sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) + if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) + return true; + return false; +} + +bool qt_wince_is_smartphone() { + return qt_wince_is_platform(QString::fromLatin1("Smartphone")); +} + +void openMenu() +{ + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,450,630,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,450,630,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,55535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,58535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,40535,55535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,32535,55535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,65535,65535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,50535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,55535,40535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0); + QTest::qWait(2000); + ::mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE,48535,45535,0,0); +} + +void compareScreenshots(const QString &image1, const QString &image2) +{ + if (qt_wince_is_smartphone()) + QSKIP("This test is only for Windows Mobile", SkipAll); + QImage screenShot(image1); + QImage original(image2); + + //ignore the clock + QPainter p1(&screenShot); + QPainter p2(&original); + p1.fillRect(310, 6, 400, 34, Qt::black); + p2.fillRect(310, 6, 400, 34, Qt::black); + + QVERIFY(original == screenShot); +} + +void takeScreenShot(const QString filename) +{ + q_lock(); + QImage image = QImage(( uchar *) q_frameBuffer(), q_screenWidth(), + q_screenHeight(), q_screenWidth() * q_screenDepth() / 8, QImage::Format_RGB16); + image.save(filename, "PNG"); + q_unlock(); +} + +void tst_WindowsMobile::testMainWindowAndMenuBar() +{ + QProcess process; + process.start("testQMenuBar.exe"); + QCOMPARE(process.state(), QProcess::Running); + QTest::qWait(6000); + openMenu(); + QTest::qWait(1000); + takeScreenShot("testQMenuBar_current.png"); + process.close(); + compareScreenshots("testQMenuBar_current.png", ":/testQMenuBar_current.png"); +} + +void tst_WindowsMobile::testSimpleWidget() +{ + QMenuBar menubar; + menubar.show(); + QWidget maximized; + QPalette pal = maximized.palette(); + pal.setColor(QPalette::Background, Qt::red); + maximized.setPalette(pal); + maximized.showMaximized(); + QWidget widget; + widget.setGeometry(100, 100, 200, 200); + widget.setWindowTitle("Widget"); + widget.show(); + qApp->processEvents(); + QTest::qWait(1000); + + QWidget widget2; + widget2.setGeometry(100, 380, 300, 200); + widget2.setWindowTitle("Widget 2"); + widget2.setWindowFlags(Qt::Popup); + widget2.show(); + + qApp->processEvents(); + QTest::qWait(1000); + takeScreenShot("testSimpleWidget_current.png"); + compareScreenshots("testSimpleWidget_current.png", ":/testSimpleWidget_current.png"); +} + + +#endif //Q_OS_WINCE_WM + + +QTEST_MAIN(tst_WindowsMobile) +#include "tst_windowsmobile.moc" + diff --git a/tests/auto/windowsmobile/test/windowsmobile.qrc b/tests/auto/windowsmobile/test/windowsmobile.qrc new file mode 100644 index 0000000..5d6f614 --- /dev/null +++ b/tests/auto/windowsmobile/test/windowsmobile.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>testQMenuBar_current.png</file> + <file>testSimpleWidget_current.png</file> +</qresource> +</RCC> diff --git a/tests/auto/windowsmobile/testQMenuBar/main.cpp b/tests/auto/windowsmobile/testQMenuBar/main.cpp new file mode 100644 index 0000000..4a3b3b2 --- /dev/null +++ b/tests/auto/windowsmobile/testQMenuBar/main.cpp @@ -0,0 +1,72 @@ +#include <QtTest/QtTest> +#include <QtCore/QDate> +#include <QtCore/QDebug> +#include <QtCore/QObject> +#include <QtGui> +#include <windows.h> + +int main(int argc, char * argv[]) +{ + int widgetNum = 20; + + QList<QWidget*> widgets; + QApplication app(argc, argv); + + QMainWindow mainWindow; + mainWindow.setWindowTitle("Test"); + QMenu *fileMenu = mainWindow.menuBar()->addMenu("File"); + QMenu *editMenu = mainWindow.menuBar()->addMenu("Edit"); + QMenu *viewMenu = mainWindow.menuBar()->addMenu("View"); + QMenu *toolsMenu = mainWindow.menuBar()->addMenu("Tools"); + QMenu *optionsMenu = mainWindow.menuBar()->addMenu("Options"); + QMenu *helpMenu = mainWindow.menuBar()->addMenu("Help"); + + qApp->processEvents(); + + fileMenu->addAction("Open"); + QAction *close = fileMenu->addAction("Close"); + fileMenu->addSeparator(); + fileMenu->addAction("Exit"); + + close->setEnabled(false); + + editMenu->addAction("Cut"); + editMenu->addAction("Pase"); + editMenu->addAction("Copy"); + editMenu->addSeparator(); + editMenu->addAction("Find"); + + viewMenu->addAction("Hide"); + viewMenu->addAction("Show"); + viewMenu->addAction("Explore"); + QAction *visible = viewMenu->addAction("Visible"); + visible->setCheckable(true); + visible->setChecked(true); + + toolsMenu->addMenu("Hammer"); + toolsMenu->addMenu("Caliper"); + toolsMenu->addMenu("Helm"); + + optionsMenu->addMenu("Settings"); + optionsMenu->addMenu("Standard"); + optionsMenu->addMenu("Extended"); + + QMenu *subMenu = helpMenu->addMenu("Help"); + subMenu->addAction("Index"); + subMenu->addSeparator(); + subMenu->addAction("Vodoo Help"); + helpMenu->addAction("Contens"); + helpMenu->addSeparator(); + helpMenu->addAction("About"); + + QToolBar toolbar; + mainWindow.addToolBar(&toolbar); + toolbar.addAction(QIcon(qApp->style()->standardPixmap(QStyle::SP_FileIcon)), QString("textAction")); + + QTextEdit textEdit; + mainWindow.setCentralWidget(&textEdit); + + mainWindow.showMaximized(); + + app.exec(); +} diff --git a/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro b/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro new file mode 100644 index 0000000..6dd288b --- /dev/null +++ b/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro @@ -0,0 +1,2 @@ +SOURCES += main.cpp +DESTDIR = ./ diff --git a/tests/auto/windowsmobile/windowsmobile.pro b/tests/auto/windowsmobile/windowsmobile.pro new file mode 100644 index 0000000..2e6b444 --- /dev/null +++ b/tests/auto/windowsmobile/windowsmobile.pro @@ -0,0 +1,9 @@ + +TEMPLATE = subdirs + +wincewm* { + SUBDIRS = testQMenuBar +} + SUBDIRS += test + + diff --git a/tests/benchmarks/qgraphicsview/images/wine.jpeg b/tests/benchmarks/qgraphicsview/images/wine.jpeg Binary files differnew file mode 100644 index 0000000..8fe1d3a --- /dev/null +++ b/tests/benchmarks/qgraphicsview/images/wine.jpeg diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.qrc b/tests/benchmarks/qgraphicsview/qgraphicsview.qrc index 9f280dd..5e80029 100644 --- a/tests/benchmarks/qgraphicsview/qgraphicsview.qrc +++ b/tests/benchmarks/qgraphicsview/qgraphicsview.qrc @@ -1,6 +1,7 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>images/designer.png</file> + <file>images/wine.jpeg</file> <file>random.data</file> </qresource> </RCC> diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp index d2213f4..a293de4 100644 --- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp @@ -122,6 +122,8 @@ private slots: void imageRiver(); void textRiver_data(); void textRiver(); + void moveItemCache_data(); + void moveItemCache(); }; tst_QGraphicsView::tst_QGraphicsView() @@ -688,5 +690,112 @@ void tst_QGraphicsView::textRiver() } } +class AnimatedPixmapCacheItem : public QGraphicsPixmapItem +{ +public: + AnimatedPixmapCacheItem(int x, int y, QGraphicsItem *parent = 0) + : QGraphicsPixmapItem(parent) + { + xspeed = x; + yspeed = y; + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { + QGraphicsPixmapItem::paint(painter,option,widget); + //We just want to wait, and we don't want to process the event loop with qWait + QTest::qSleep(3); + + } +protected: + void advance(int i) + { + if (!i) + return; + int x = int(pos().x()) + pixmap().width(); + x += xspeed; + x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); + int y = int(pos().y()) + pixmap().width(); + y += yspeed; + y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); + setPos(x, y); + } + +private: + int xspeed; + int yspeed; +}; + +void tst_QGraphicsView::moveItemCache_data() +{ + QTest::addColumn<int>("direction"); + QTest::addColumn<bool>("rotation"); + QTest::addColumn<int>("cacheMode"); + QTest::newRow("Horizontal movement : ItemCoordinate Cache") << 0 << false << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Horizontal movement : DeviceCoordinate Cache") << 0 << false << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Horizontal movement : No Cache") << 0 << false << (int)QGraphicsItem::NoCache; + QTest::newRow("Vertical + Horizontal movement : ItemCoordinate Cache") << 2 << false << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Vertical + Horizontal movement : DeviceCoordinate Cache") << 2 << false << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Vertical + Horizontal movement : No Cache") << 2 << false << (int)QGraphicsItem::NoCache; + QTest::newRow("Horizontal movement + Rotation : ItemCoordinate Cache") << 0 << true << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Horizontal movement + Rotation : DeviceCoordinate Cache") << 0 << true << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Horizontal movement + Rotation : No Cache") << 0 << true << (int)QGraphicsItem::NoCache; +} + +void tst_QGraphicsView::moveItemCache() +{ + QFETCH(int, direction); + QFETCH(bool, rotation); + QFETCH(int, cacheMode); + + QGraphicsScene scene(0, 0, 300, 300); + + CountPaintEventView view(&scene); + view.resize(600, 600); + view.setFrameStyle(0); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.show(); + + QPixmap pix(":/images/wine.jpeg"); + QVERIFY(!pix.isNull()); + + QList<QGraphicsItem *> items; + QFile file(":/random.data"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QDataStream str(&file); + for (int i = 0; i < 50; ++i) { + AnimatedPixmapCacheItem *item; + if (direction == 0) item = new AnimatedPixmapCacheItem((i % 4) + 1, 0); + if (direction == 1) item = new AnimatedPixmapCacheItem(0, (i % 4) + 1); + if (direction == 2) item = new AnimatedPixmapCacheItem((i % 4) + 1, (i % 4) + 1); + item->setPixmap(pix); + item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); + if (rotation) + item->setTransform(QTransform().rotate(45)); + int rnd1, rnd2; + str >> rnd1 >> rnd2; + item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), + -pix.height() + rnd2 % (view.height() + pix.height())); + scene.addItem(item); + } + + view.count = 0; + + QBENCHMARK { +#ifdef CALLGRIND_DEBUG + CALLGRIND_START_INSTRUMENTATION +#endif + for (int i = 0; i < 100; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } +#ifdef CALLGRIND_DEBUG + CALLGRIND_STOP_INSTRUMENTATION +#endif + } +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" diff --git a/tools/assistant/tools/assistant/assistant.qch b/tools/assistant/tools/assistant/assistant.qch Binary files differindex 64763f7..99687ed 100644 --- a/tools/assistant/tools/assistant/assistant.qch +++ b/tools/assistant/tools/assistant/assistant.qch diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 4390a10..b78f346 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -262,8 +262,9 @@ CentralWidget::~CentralWidget() QString zoomCount; QString currentPages; QLatin1Char separator('|'); - int i = m_searchWidget->isAttached() ? 1 : 0; + bool searchAttached = m_searchWidget->isAttached(); + int i = searchAttached ? 1 : 0; for (; i < tabWidget->count(); ++i) { HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(i)); if (viewer && viewer->source().isValid()) { @@ -274,6 +275,7 @@ CentralWidget::~CentralWidget() engine.setCustomValue(QLatin1String("LastTabPage"), lastTabPage); engine.setCustomValue(QLatin1String("LastShownPages"), currentPages); + engine.setCustomValue(QLatin1String("SearchWasAttached"), searchAttached); #if !defined(QT_NO_WEBKIT) engine.setCustomValue(QLatin1String("LastPagesZoomWebView"), zoomCount); #else @@ -418,7 +420,18 @@ void CentralWidget::setLastShownPages() setSourceInNewTab((*it), (*zIt).toFloat()); const QLatin1String lastTab("LastTabPage"); - tabWidget->setCurrentIndex(helpEngine->customValue(lastTab, 1).toInt()); + int tab = helpEngine->customValue(lastTab, 1).toInt(); + + const QLatin1String searchKey("SearchWasAttached"); + const bool searchIsAttached = m_searchWidget->isAttached(); + const bool searchWasAttached = helpEngine->customValue(searchKey).toBool(); + + if (searchWasAttached && !searchIsAttached) + tabWidget->setCurrentIndex(--tab); + else if (!searchWasAttached && searchIsAttached) + tabWidget->setCurrentIndex(++tab); + else + tabWidget->setCurrentIndex(tab); } bool CentralWidget::hasSelection() const @@ -797,7 +810,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e) } } - if (QTabBar *tabBar = qobject_cast<QTabBar*>(object)) { + if (qobject_cast<QTabBar*>(object)) { const bool dblClick = e->type() == QEvent::MouseButtonDblClick; if ((e->type() == QEvent::MouseButtonRelease) || dblClick) { QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(e); @@ -978,22 +991,29 @@ void CentralWidget::updateBrowserFont() void CentralWidget::createSearchWidget(QHelpSearchEngine *searchEngine) { - if (!m_searchWidget) { - m_searchWidget = new SearchWidget(searchEngine, this); - connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), this, - SLOT(setSourceFromSearch(QUrl))); - connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this, - SLOT(setSourceFromSearchInNewTab(QUrl))); - } - tabWidget->insertTab(0, m_searchWidget, tr("Search")); - m_searchWidget->setAttached(true); + if (m_searchWidget) + return; + + m_searchWidget = new SearchWidget(searchEngine, this); + connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), this, + SLOT(setSourceFromSearch(QUrl))); + connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), this, + SLOT(setSourceFromSearchInNewTab(QUrl))); } -void CentralWidget::activateSearchWidget() +void CentralWidget::activateSearchWidget(bool updateLastTabPage) { - if (!m_searchWidget->isAttached()) + if (!m_searchWidget) createSearchWidget(helpEngine->searchEngine()); + if (!m_searchWidget->isAttached()) { + tabWidget->insertTab(0, m_searchWidget, tr("Search")); + m_searchWidget->setAttached(true); + + if (updateLastTabPage) + lastTabPage++; + } + tabWidget->setCurrentWidget(m_searchWidget); m_searchWidget->setFocus(); } diff --git a/tools/assistant/tools/assistant/centralwidget.h b/tools/assistant/tools/assistant/centralwidget.h index 2c28091..e3ce200 100644 --- a/tools/assistant/tools/assistant/centralwidget.h +++ b/tools/assistant/tools/assistant/centralwidget.h @@ -118,7 +118,7 @@ public: void activateTab(bool onlyHelpViewer = false); void createSearchWidget(QHelpSearchEngine *searchEngine); - void activateSearchWidget(); + void activateSearchWidget(bool updateLastTabPage = false); void removeSearchWidget(); int availableHelpViewer() const; diff --git a/tools/assistant/tools/assistant/cmdlineparser.cpp b/tools/assistant/tools/assistant/cmdlineparser.cpp index 0dae785..67eaa44 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.cpp +++ b/tools/assistant/tools/assistant/cmdlineparser.cpp @@ -56,6 +56,7 @@ CmdLineParser::CmdLineParser() m_bookmarks(Untouched), m_search(Untouched), m_register(None), + m_removeSearchIndex(false), m_copy(false), m_quiet(false) { @@ -83,6 +84,7 @@ CmdLineParser::CmdLineParser() " (.qch) from the give collection\n" " file.\n" "-setCurrentFilter filter Set the filter as the active filter.\n" + "-remove-search-index Removes the full text search index.\n" "-quiet Does not display any error or\n" " status message.\n" "-help Displays this help.\n" @@ -217,6 +219,8 @@ CmdLineParser::Result CmdLineParser::parse(const QStringList &arguments) error = QObject::tr("Missing filter argument!"); break; } + } else if (arg == QLatin1String("-remove-search-index")) { + m_removeSearchIndex = true; } else if (arg == QLatin1String("-quiet")) { continue; } else if (arg == QLatin1String("-help")) { @@ -307,6 +311,11 @@ QString CmdLineParser::currentFilter() const return m_currentFilter; } +bool CmdLineParser::removeSearchIndex() const +{ + return m_removeSearchIndex; +} + CmdLineParser::RegisterState CmdLineParser::registerRequest() const { return m_register; diff --git a/tools/assistant/tools/assistant/cmdlineparser.h b/tools/assistant/tools/assistant/cmdlineparser.h index 332d464..263138b 100644 --- a/tools/assistant/tools/assistant/cmdlineparser.h +++ b/tools/assistant/tools/assistant/cmdlineparser.h @@ -67,6 +67,7 @@ public: ShowState bookmarks() const; ShowState search() const; QString currentFilter() const; + bool removeSearchIndex() const; RegisterState registerRequest() const; QString helpFile() const; @@ -90,6 +91,7 @@ private: ShowState m_search; RegisterState m_register; QString m_currentFilter; + bool m_removeSearchIndex; bool m_copy; bool m_quiet; }; diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 794be02..75955ec 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -52,6 +52,8 @@ #include <QtHelp/QHelpEngineCore> +#include <QtNetwork/QLocalSocket> + #include <QtSql/QSqlDatabase> #include "mainwindow.h" @@ -166,6 +168,17 @@ referencedHelpFilesExistAll(QHelpEngineCore& user, QStringList& nameSpaces) return (counter != nameSpaces.count()) ? false : true; } +QString indexFilesFolder(const QString &collectionFile) +{ + QString indexFilesFolder = QLatin1String(".fulltextsearch"); + if (!collectionFile.isEmpty()) { + QFileInfo fi(collectionFile); + indexFilesFolder = QLatin1Char('.') + + fi.fileName().left(fi.fileName().lastIndexOf(QLatin1String(".qhc"))); + } + return indexFilesFolder; +} + int main(int argc, char *argv[]) { QApplication a(argc, argv); @@ -212,6 +225,28 @@ int main(int argc, char *argv[]) return 0; } + if (cmd.removeSearchIndex()) { + QString file = cmdCollectionFile; + if (file.isEmpty()) + file = MainWindow::defaultHelpCollectionFileName(); + QString path = QFileInfo(file).path(); + path += QLatin1String("/") + indexFilesFolder(file); + + QLocalSocket localSocket; + localSocket.connectToServer(QString(QLatin1String("QtAssistant%1")) + .arg(QLatin1String(QT_VERSION_STR))); + + QDir dir(path); // check if there is no other instance ruinning + if (!localSocket.waitForConnected() && dir.exists()) { + QStringList lst = dir.entryList(QDir::Files | QDir::Hidden); + foreach (const QString &item, lst) + dir.remove(item); + return 0; + } else { + return -1; + } + } + { QSqlDatabase db; QStringList sqlDrivers(db.drivers()); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 426a828..cb10e3f 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -126,6 +126,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished())); m_centralWidget->createSearchWidget(searchEngine); + m_centralWidget->activateSearchWidget(); QString defWindowTitle = tr("Qt Assistant"); setWindowTitle(defWindowTitle); @@ -234,6 +235,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) else checkInitState(); } + setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); } MainWindow::~MainWindow() @@ -410,7 +412,7 @@ void MainWindow::setupActions() m_closeTabAction->setShortcuts(QKeySequence::Close); QAction *tmp = menu->addAction(tr("&Quit"), this, SLOT(close())); - tmp->setShortcut(tr("CTRL+Q")); + tmp->setShortcut(QKeySequence::Quit); tmp->setMenuRole(QAction::QuitRole); menu = menuBar()->addMenu(tr("&Edit")); @@ -461,7 +463,7 @@ void MainWindow::setupActions() QKeySequence(tr("ALT+I"))); m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarks()), QKeySequence(tr("ALT+O"))); - m_viewMenu->addAction(tr("Search"), this, SLOT(showSearch()), + m_viewMenu->addAction(tr("Search"), this, SLOT(showSearchWidget()), QKeySequence(tr("ALT+S"))); menu = menuBar()->addMenu(tr("&Go")); @@ -880,6 +882,11 @@ void MainWindow::showSearch() m_centralWidget->activateSearchWidget(); } +void MainWindow::showSearchWidget() +{ + m_centralWidget->activateSearchWidget(true); +} + void MainWindow::hideSearch() { m_centralWidget->removeSearchWidget(); diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h index 7d08a74..d7f5c69 100644 --- a/tools/assistant/tools/assistant/mainwindow.h +++ b/tools/assistant/tools/assistant/mainwindow.h @@ -92,6 +92,7 @@ public slots: void showIndex(); void showBookmarks(); void showSearch(); + void showSearchWidget(); void syncContents(); void activateCurrentCentralWidgetTab(); diff --git a/tools/assistant/tools/assistant/preferencesdialog.cpp b/tools/assistant/tools/assistant/preferencesdialog.cpp index 094bd9c..74f7ba8 100644 --- a/tools/assistant/tools/assistant/preferencesdialog.cpp +++ b/tools/assistant/tools/assistant/preferencesdialog.cpp @@ -44,6 +44,7 @@ #include "installdialog.h" #include "fontpanel.h" #include "centralwidget.h" +#include "aboutdialog.h" #include <QtAlgorithms> @@ -52,6 +53,8 @@ #include <QtGui/QMessageBox> #include <QtGui/QMenu> #include <QtGui/QFontDatabase> +#include <QtGui/QApplication> +#include <QtGui/QDesktopWidget> #include <QtHelp/QHelpEngineCore> @@ -59,36 +62,38 @@ QT_BEGIN_NAMESPACE PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *parent) : QDialog(parent) + , m_helpEngine(helpEngine) , m_appFontChanged(false) , m_browserFontChanged(false) { - m_helpEngine = helpEngine; m_ui.setupUi(this); - connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), - SIGNAL(clicked()), this, SLOT(applyChanges())); - connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), - SIGNAL(clicked()), this, SLOT(reject())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), + this, SLOT(applyChanges())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), + this, SLOT(reject())); - m_hideFiltersTab = !m_helpEngine->customValue(QLatin1String("EnableFilterFunctionality"), - true).toBool(); - m_hideDocsTab = !m_helpEngine->customValue(QLatin1String("EnableDocumentationManager"), - true).toBool(); + QLatin1String key("EnableFilterFunctionality"); + m_hideFiltersTab = !m_helpEngine->customValue(key, true).toBool(); + + key = QLatin1String("EnableDocumentationManager"); + m_hideDocsTab = !m_helpEngine->customValue(key, true).toBool(); if (!m_hideFiltersTab) { m_ui.attributeWidget->header()->hide(); m_ui.attributeWidget->setRootIsDecorated(false); + connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(updateFilterMap())); connect(m_ui.filterWidget, - SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(updateAttributes(QListWidgetItem*))); + SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, + SLOT(updateAttributes(QListWidgetItem*))); - connect(m_ui.filterAddButton, SIGNAL(clicked()), - this, SLOT(addFilter())); - connect(m_ui.filterRemoveButton, SIGNAL(clicked()), - this, SLOT(removeFilter())); + connect(m_ui.filterAddButton, SIGNAL(clicked()), this, + SLOT(addFilter())); + connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this, + SLOT(removeFilter())); updateFilterPage(); } else { @@ -106,22 +111,34 @@ PreferencesDialog::PreferencesDialog(QHelpEngineCore *helpEngine, QWidget *paren } else { m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.docsTab)); } + updateFontSettingsPage(); updateOptionsPage(); } PreferencesDialog::~PreferencesDialog() { + QLatin1String key(""); if (m_appFontChanged) { - m_helpEngine->setCustomValue(QLatin1String("appFont"), m_appFontPanel->selectedFont()); - m_helpEngine->setCustomValue(QLatin1String("useAppFont"), m_appFontPanel->isChecked()); - m_helpEngine->setCustomValue(QLatin1String("appWritingSystem"), m_appFontPanel->writingSystem()); + key = QLatin1String("appFont"); + m_helpEngine->setCustomValue(key, m_appFontPanel->selectedFont()); + + key = QLatin1String("useAppFont"); + m_helpEngine->setCustomValue(key, m_appFontPanel->isChecked()); + + key = QLatin1String("appWritingSystem"); + m_helpEngine->setCustomValue(key, m_appFontPanel->writingSystem()); } if (m_browserFontChanged) { - m_helpEngine->setCustomValue(QLatin1String("browserFont"), m_browserFontPanel->selectedFont()); - m_helpEngine->setCustomValue(QLatin1String("useBrowserFont"), m_browserFontPanel->isChecked()); - m_helpEngine->setCustomValue(QLatin1String("browserWritingSystem"), m_browserFontPanel->writingSystem()); + key = QLatin1String("browserFont"); + m_helpEngine->setCustomValue(key, m_browserFontPanel->selectedFont()); + + key = QLatin1String("useBrowserFont"); + m_helpEngine->setCustomValue(key, m_browserFontPanel->isChecked()); + + key = QLatin1String("browserWritingSystem"); + m_helpEngine->setCustomValue(key, m_browserFontPanel->writingSystem()); } if (m_appFontChanged || m_browserFontChanged) { @@ -129,8 +146,10 @@ PreferencesDialog::~PreferencesDialog() emit updateBrowserFont(); } - if (!m_ui.homePageLineEdit->text().isEmpty()) - m_helpEngine->setCustomValue(QLatin1String("homepage"), m_ui.homePageLineEdit->text()); + if (!m_ui.homePageLineEdit->text().isEmpty()) { + key = QLatin1String("homepage"); + m_helpEngine->setCustomValue(key, m_ui.homePageLineEdit->text()); + } } void PreferencesDialog::showDialog() @@ -173,7 +192,7 @@ void PreferencesDialog::updateAttributes(QListWidgetItem *item) if (item) checkedList = m_filterMap.value(item->text()); QTreeWidgetItem *itm; - for (int i=0; i<m_ui.attributeWidget->topLevelItemCount(); ++i) { + for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) { itm = m_ui.attributeWidget->topLevelItem(i); if (checkedList.contains(itm->text(0))) itm->setCheckState(0, Qt::Checked); @@ -192,7 +211,7 @@ void PreferencesDialog::updateFilterMap() QStringList newAtts; QTreeWidgetItem *itm = 0; - for (int i=0; i<m_ui.attributeWidget->topLevelItemCount(); ++i) { + for (int i = 0; i < m_ui.attributeWidget->topLevelItemCount(); ++i) { itm = m_ui.attributeWidget->topLevelItem(i); if (itm->checkState(0) == Qt::Checked) newAtts.append(itm->text(0)); @@ -219,8 +238,8 @@ void PreferencesDialog::addFilter() void PreferencesDialog::removeFilter() { - QListWidgetItem *item = m_ui.filterWidget - ->takeItem(m_ui.filterWidget->currentRow()); + QListWidgetItem *item = + m_ui.filterWidget ->takeItem(m_ui.filterWidget->currentRow()); if (!item) return; @@ -238,25 +257,48 @@ void PreferencesDialog::addDocumentationLocal() if (fileNames.isEmpty()) return; + QStringList invalidFiles; + QStringList alreadyRegistered; foreach (const QString &fileName, fileNames) { - const QString ns = QHelpEngineCore::namespaceName(fileName); - if (ns.isEmpty()) { - QMessageBox::warning(this, tr("Add Documentation"), - tr("The specified file is not a valid Qt Help File!")); + const QString nameSpace = QHelpEngineCore::namespaceName(fileName); + if (nameSpace.isEmpty()) { + invalidFiles.append(fileName); continue; } - if (m_ui.registeredDocsListWidget->findItems(ns, Qt::MatchFixedString).count()) { - QMessageBox::warning(this, tr("Add Documentation"), - tr("The namespace %1 is already registered!").arg(ns)); - continue; + if (m_ui.registeredDocsListWidget->findItems(nameSpace, + Qt::MatchFixedString).count()) { + alreadyRegistered.append(nameSpace); + continue; } m_helpEngine->registerDocumentation(fileName); - m_ui.registeredDocsListWidget->addItem(ns); - m_regDocs.append(ns); - m_unregDocs.removeAll(ns); + m_ui.registeredDocsListWidget->addItem(nameSpace); + m_regDocs.append(nameSpace); + m_unregDocs.removeAll(nameSpace); + } + + if (!invalidFiles.isEmpty() || !alreadyRegistered.isEmpty()) { + QString message; + if (!alreadyRegistered.isEmpty()) { + foreach (const QString &ns, alreadyRegistered) { + message += tr("The namespace %1 is already registered!") + .arg(QString("<b>%1</b>").arg(ns)) + QLatin1String("<br>"); + } + if (!invalidFiles.isEmpty()) + message.append(QLatin1String("<br>")); + } + + if (!invalidFiles.isEmpty()) { + message += tr("The specified file is not a valid Qt Help File!"); + message.append(QLatin1String("<ul>")); + foreach (const QString &file, invalidFiles) + message += QLatin1String("<li>") + file + QLatin1String("</li>"); + message.append(QLatin1String("</ul>")); + } + QMessageBox::warning(this, tr("Add Documentation"), message); } + updateFilterPage(); } @@ -362,35 +404,50 @@ void PreferencesDialog::updateFontSettingsPage() m_ui.stackedWidget_2->setCurrentIndex(0); const QString customSettings(tr("Use custom settings")); - QFont font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("appFont"))); - QFontDatabase::WritingSystem writingSystem = static_cast<QFontDatabase::WritingSystem> - (m_helpEngine->customValue(QLatin1String("appWritingSystem")).toInt()); - m_appFontPanel->setTitle(customSettings); + + QLatin1String key = QLatin1String("appFont"); + QFont font = qVariantValue<QFont>(m_helpEngine->customValue(key)); m_appFontPanel->setSelectedFont(font); - m_appFontPanel->setWritingSystem(writingSystem); - m_appFontPanel->setChecked(m_helpEngine->customValue(QLatin1String("useAppFont")).toBool()); - QFont font2 = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("browserFont"))); - writingSystem = static_cast<QFontDatabase::WritingSystem> - (m_helpEngine->customValue(QLatin1String("browserWritingSystem")).toInt()); + key = QLatin1String("appWritingSystem"); + QFontDatabase::WritingSystem system = static_cast<QFontDatabase::WritingSystem> + (m_helpEngine->customValue(key).toInt()); + m_appFontPanel->setWritingSystem(system); + + key = QLatin1String("useAppFont"); + m_appFontPanel->setChecked(m_helpEngine->customValue(key).toBool()); m_browserFontPanel->setTitle(customSettings); - m_browserFontPanel->setSelectedFont(font2); - m_browserFontPanel->setWritingSystem(writingSystem); - m_browserFontPanel->setChecked(m_helpEngine->customValue(QLatin1String("useBrowserFont")).toBool()); - connect(m_appFontPanel, SIGNAL(toggled(bool)), this, SLOT(appFontSettingToggled(bool))); - connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, SLOT(browserFontSettingToggled(bool))); + key = QLatin1String("browserFont"); + font = qVariantValue<QFont>(m_helpEngine->customValue(key)); + m_browserFontPanel->setSelectedFont(font); + + key = QLatin1String("browserWritingSystem"); + system = static_cast<QFontDatabase::WritingSystem> + (m_helpEngine->customValue(key).toInt()); + m_browserFontPanel->setWritingSystem(system); + + key = QLatin1String("useBrowserFont"); + m_browserFontPanel->setChecked(m_helpEngine->customValue(key).toBool()); + + connect(m_appFontPanel, SIGNAL(toggled(bool)), this, + SLOT(appFontSettingToggled(bool))); + connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, + SLOT(browserFontSettingToggled(bool))); QList<QComboBox*> allCombos = qFindChildren<QComboBox*>(m_appFontPanel); - foreach (QComboBox* box, allCombos) - connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(appFontSettingChanged(int))); + foreach (QComboBox* box, allCombos) { + connect(box, SIGNAL(currentIndexChanged(int)), this, + SLOT(appFontSettingChanged(int))); + } - allCombos.clear(); allCombos = qFindChildren<QComboBox*>(m_browserFontPanel); - foreach (QComboBox* box, allCombos) - connect(box, SIGNAL(currentIndexChanged(int)), this, SLOT(browserFontSettingChanged(int))); + foreach (QComboBox* box, allCombos) { + connect(box, SIGNAL(currentIndexChanged(int)), this, + SLOT(browserFontSettingChanged(int))); + } } void PreferencesDialog::appFontSettingToggled(bool on) @@ -436,8 +493,8 @@ void PreferencesDialog::updateOptionsPage() void PreferencesDialog::restoreDefaultHomepage() { - QString homepage = m_helpEngine->customValue( - QLatin1String("defaultHomepage"), QLatin1String("help")).toString(); + QString homepage = m_helpEngine->customValue(QLatin1String("defaultHomepage"), + QLatin1String("help")).toString(); m_ui.homePageLineEdit->setText(homepage); } diff --git a/tools/designer/src/designer/qdesigner_actions.cpp b/tools/designer/src/designer/qdesigner_actions.cpp index 65e5937..d5d01f4 100644 --- a/tools/designer/src/designer/qdesigner_actions.cpp +++ b/tools/designer/src/designer/qdesigner_actions.cpp @@ -280,7 +280,7 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) m_fileActions->addAction(createSeparator(this)); - m_quitAction->setShortcut(tr("CTRL+Q")); + m_quitAction->setShortcuts(QKeySequence::Quit); m_quitAction->setMenuRole(QAction::QuitRole); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(shutdown())); m_fileActions->addAction(m_quitAction); diff --git a/tools/designer/src/lib/sdk/abstractformeditor.cpp b/tools/designer/src/lib/sdk/abstractformeditor.cpp index e6debd5..09d6976 100644 --- a/tools/designer/src/lib/sdk/abstractformeditor.cpp +++ b/tools/designer/src/lib/sdk/abstractformeditor.cpp @@ -72,7 +72,6 @@ static void initResources() Q_INIT_RESOURCE(shared); Q_INIT_RESOURCE(ClamshellPhone); Q_INIT_RESOURCE(PDAPhone); - Q_INIT_RESOURCE(pda); Q_INIT_RESOURCE(PortableMedia); Q_INIT_RESOURCE(S60_nHD_Touchscreen); Q_INIT_RESOURCE(S60_QVGA_Candybar); diff --git a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp index 1c465da..0bb91ee 100644 --- a/tools/designer/src/lib/shared/qdesigner_toolbar.cpp +++ b/tools/designer/src/lib/shared/qdesigner_toolbar.cpp @@ -61,7 +61,6 @@ #include <QtGui/QMenu> #include <QtGui/qevent.h> #include <QtGui/QApplication> -#include <QtGui/private/qtoolbarlayout_p.h> #include <QtCore/QDebug> Q_DECLARE_METATYPE(QAction*) @@ -443,9 +442,19 @@ QAction *ToolBarEventFilter::actionAt(const QToolBar *tb, const QPoint &pos) QRect ToolBarEventFilter::handleArea(const QToolBar *tb) { - const QToolBarLayout *tbl = qobject_cast<QToolBarLayout *>(tb->layout()); - Q_ASSERT(tbl); - return tbl->handleRect(); + //that's a trick to get acces to the initStyleOption which is a protected member + class FriendlyToolBar : public QToolBar + { + public: +#ifdef Q_NO_USING_KEYWORD + void initStyleOption(QStyleOptionToolBar *option) { QToolBar::initStyleOption(option); } +#else + using QToolBar::initStyleOption; +#endif + }; + QStyleOptionToolBar opt; + static_cast<const FriendlyToolBar*>(tb)->initStyleOption(&opt); + return tb->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, tb); } bool ToolBarEventFilter::withinHandleArea(const QToolBar *tb, const QPoint &pos) diff --git a/tools/designer/src/lib/shared/shared.pri b/tools/designer/src/lib/shared/shared.pri index 0424a41..8ed051a 100644 --- a/tools/designer/src/lib/shared/shared.pri +++ b/tools/designer/src/lib/shared/shared.pri @@ -186,17 +186,4 @@ SOURCES += \ $$PWD/filterwidget.cpp \ $$PWD/plugindialog.cpp -RESOURCES += $$PWD/shared.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/ClamshellPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/PDAPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/pda.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/PortableMedia.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/qvfb.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/S60-nHD-Touchscreen.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/S60-QVGA-Candybar.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhone2.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/SmartPhoneWithButtons.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/TouchscreenPhone.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/Trolltech-Keypad.qrc \ -$$QT_SOURCE_TREE/tools/qvfb/Trolltech-Touchscreen.qrc +RESOURCES += $$PWD/shared.qrc diff --git a/tools/designer/src/uitools/quiloader.cpp b/tools/designer/src/uitools/quiloader.cpp index 67bd29c..2a66095 100644 --- a/tools/designer/src/uitools/quiloader.cpp +++ b/tools/designer/src/uitools/quiloader.cpp @@ -572,53 +572,52 @@ void QUiLoaderPrivate::setupWidgetMap() const \class QUiLoader \inmodule QtUiTools - \brief The QUiLoader class allows standalone applications dynamically - create user interfaces at run-time using the information stored in - .ui files or specified plugin paths. + \brief The QUiLoader class enables standalone applications to + dynamically create user interfaces at run-time using the + information stored in .ui files or specified in plugin paths. - In addition, you can customize of creating an user interface by + In addition, you can customize or create your own user interface by deriving your own loader class. - If you have a custom component or an application that embeds Qt - Designer, you can also use the QFormBuilder class provided by the - QtDesigner module to create user interfaces from .ui files. + If you have a custom component or an application that embeds \QD, you can + also use the QFormBuilder class provided by the QtDesigner module to create + user interfaces from \c{.ui} files. - The QUiLoader class provides a collection of functions that allows - you to create widgets based on the information stored in \c .ui - files (created with Qt Designer) or available in the specified - plugin paths. The specified plugin paths can be retrieved using - the pluginPaths() function. You can retrieve the contents of an \c - .ui file using the load() function. For example: + The QUiLoader class provides a collection of functions allowing you to + create widgets based on the information stored in \c .ui files (created + with \QD) or available in the specified plugin paths. The specified plugin + paths can be retrieved using the pluginPaths() function. Similarly, the + contents of a \c{.ui} file can be retrieved using the load() function. For + example: \snippet doc/src/snippets/quiloader/mywidget.cpp 0 - By including the user interface in the form's resources (\c myform.qrc), - we ensure that it will be present at run-time: + By including the user interface in the form's resources (\c myform.qrc), we + ensure that it will be present at run-time: \quotefile doc/src/snippets/quiloader/mywidget.qrc - The availableWidgets() function returns a QStringList with the - class names of the widgets available in the specified plugin - paths. You can create any of these widgets using the - createWidget() function. For example: + The availableWidgets() function returns a QStringList with the class names + of the widgets available in the specified plugin paths. To create these + widgets, simply use the createWidget() function. For example: \snippet doc/src/snippets/quiloader/main.cpp 0 - You can make a custom widget available to the loader using the - addPluginPath() function, and you can remove all the available widgets - by calling the clearPluginPaths() function. + To make a custom widget available to the loader, you can use the + addPluginPath() function; to remove all available widgets, you can call + the clearPluginPaths() function. - The createAction(), createActionGroup(), createLayout() and - createWidget() functions are used internally by the QUiLoader class - whenever it has to create an action, action group, layout or - widget respectively. For that reason, you can subclass the QUiLoader - class and reimplement these functions to intervene the process of - constructing an user interface. For example, you might want to - create a list of the actions created when loading a form or - creating a custom widget. + The createAction(), createActionGroup(), createLayout(), and createWidget() + functions are used internally by the QUiLoader class whenever it has to + create an action, action group, layout, or widget respectively. For that + reason, you can subclass the QUiLoader class and reimplement these + functions to intervene the process of constructing a user interface. For + example, you might want to have a list of the actions created when loading + a form or creating a custom widget. However, in your reimplementation, you + must call QUiLoader's original implementation of these functions first. - For a complete example using the QUiLoader class, see the \l - {designer/calculatorbuilder}{Calculator Builder} example. + For a complete example using the QUiLoader class, see the + \l{Calculator Builder Example}. \sa QtUiTools, QFormBuilder */ @@ -653,8 +652,8 @@ QUiLoader::~QUiLoader() } /*! - Loads a form from the given \a device and creates a new widget with the given - \a parentWidget to hold its contents. + Loads a form from the given \a device and creates a new widget with the + given \a parentWidget to hold its contents. \sa createWidget() */ @@ -668,8 +667,8 @@ QWidget *QUiLoader::load(QIODevice *device, QWidget *parentWidget) } /*! - Returns a list naming the paths the loader searches when locating - custom widget plugins. + Returns a list naming the paths in which the loader will search when + locating custom widget plugins. \sa addPluginPath(), clearPluginPaths() */ @@ -680,7 +679,7 @@ QStringList QUiLoader::pluginPaths() const } /*! - Clears the list of paths the loader searches when locating + Clears the list of paths in which the loader will search when locating plugins. \sa addPluginPath(), pluginPaths() @@ -692,7 +691,7 @@ void QUiLoader::clearPluginPaths() } /*! - Adds the given \a path to the list of paths the loader searches + Adds the given \a path to the list of paths in which the loader will search when locating plugins. \sa pluginPaths(), clearPluginPaths() @@ -704,17 +703,17 @@ void QUiLoader::addPluginPath(const QString &path) } /*! - Creates a new widget with the given \a parent and \a name - using the class specified by \a className. You can use this - function to create any of the widgets returned by the - availableWidgets() function. + Creates a new widget with the given \a parent and \a name using the class + specified by \a className. You can use this function to create any of the + widgets returned by the availableWidgets() function. - The function is also used internally by the QUiLoader class whenever - it has to create a widget. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene in the - process of constructing a user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. - \sa availableWidgets(), load() + \sa availableWidgets(), load() */ QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, const QString &name) { @@ -723,13 +722,14 @@ QWidget *QUiLoader::createWidget(const QString &className, QWidget *parent, cons } /*! - Creates a new layout with the given \a parent and \a name - using the class specified by \a className. + Creates a new layout with the given \a parent and \a name using the class + specified by \a className. - The function is used internally by the QUiLoader class whenever it - has to create a layout. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createWidget(), load() */ @@ -742,10 +742,11 @@ QLayout *QUiLoader::createLayout(const QString &className, QObject *parent, cons /*! Creates a new action group with the given \a parent and \a name. - The function is used internally by the QUiLoader class whenever it - has to create an action group. For that reason, you can subclass - the QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createAction(), createWidget(), load() */ @@ -758,10 +759,11 @@ QActionGroup *QUiLoader::createActionGroup(QObject *parent, const QString &name) /*! Creates a new action with the given \a parent and \a name. - The function is used internally by the QUiLoader class whenever it - has to create an action. For that reason, you can subclass the - QUiLoader class and reimplement this function to intervene the - process of constructing an user interface or widget. + The function is also used internally by the QUiLoader class whenever it + creates a widget. Hence, you can subclass QUiLoader and reimplement this + function to intervene process of constructing a user interface or widget. + However, in your implementation, ensure that you call QUiLoader's version + first. \sa createActionGroup(), createWidget(), load() */ @@ -772,9 +774,9 @@ QAction *QUiLoader::createAction(QObject *parent, const QString &name) } /*! - Returns a list naming the available widgets that can be built - using the createWidget() function, i.e all the widgets specified - within the given plugin paths. + Returns a list naming all available widgets that can be built using the + createWidget() function, i.e all the widgets specified within the given + plugin paths. \sa pluginPaths(), createWidget() @@ -795,11 +797,11 @@ QStringList QUiLoader::availableWidgets() const /*! - Returns a list naming the available layouts that can be built - using the createLayout() function + \since 4.5 + Returns a list naming all available layouts that can be built using the + createLayout() function \sa createLayout() - \since 4.5 */ QStringList QUiLoader::availableLayouts() const @@ -816,9 +818,9 @@ QStringList QUiLoader::availableLayouts() const } /*! - Sets the working directory of the loader to \a dir. The loader - looks for other resources, such as icons and resource files, - in paths relative to this directory. + Sets the working directory of the loader to \a dir. The loader will look + for other resources, such as icons and resource files, in paths relative to + this directory. \sa workingDirectory() */ @@ -842,9 +844,13 @@ QDir QUiLoader::workingDirectory() const } /*! - Sets whether the execution of scripts is enabled to \a enabled. - \since 4.3 \internal + \since 4.3 + + If \a enabled is true, the loader will be able to execute scripts. + Otherwise, execution of scripts will be disabled. + + \sa isScriptingEnabled() */ void QUiLoader::setScriptingEnabled(bool enabled) @@ -854,10 +860,12 @@ void QUiLoader::setScriptingEnabled(bool enabled) } /*! - Returns whether the execution of scripts is enabled. - \sa setScriptingEnabled() - \since 4.3 - \internal + \internal + \since 4.3 + + Returns true if execution of scripts is enabled; returns false otherwise. + + \sa setScriptingEnabled() */ bool QUiLoader::isScriptingEnabled() const @@ -867,11 +875,13 @@ bool QUiLoader::isScriptingEnabled() const } /*! - Sets whether user interfaces loaded by this loader automatically - retranslate themselves upon receiving a language change event or not, - depending on \a enabled. - \since 4.5 + + If \a enabled is true, user interfaces loaded by this loader will + automatically retranslate themselves upon receiving a language change + event. Otherwise, the user interfaces will not be retranslated. + + \sa isLanguageChangeEnabled() */ void QUiLoader::setLanguageChangeEnabled(bool enabled) @@ -881,9 +891,12 @@ void QUiLoader::setLanguageChangeEnabled(bool enabled) } /*! - Returns whether dynamic retranslation on language change is enabled. - \sa setLanguageChangeEnabled() - \since 4.5 + \since 4.5 + + Returns true if dynamic retranslation on language change is enabled; + returns false otherwise. + + \sa setLanguageChangeEnabled() */ bool QUiLoader::isLanguageChangeEnabled() const @@ -894,11 +907,14 @@ bool QUiLoader::isLanguageChangeEnabled() const /*! \internal + \since 4.5 - Sets whether user interfaces loaded by this loader are translated - at all. Note that this is orthogonal to languageChangeEnabled. + If \a enabled is true, user interfaces loaded by this loader will be + translated. Otherwise, the user interfaces will not be translated. - \since 4.5 + \note This is orthogonal to languageChangeEnabled. + + \sa isLanguageChangeEnabled(), setLanguageChangeEnabled() */ void QUiLoader::setTranslationEnabled(bool enabled) @@ -909,11 +925,11 @@ void QUiLoader::setTranslationEnabled(bool enabled) /*! \internal + \since 4.5 - Returns whether translation is enabled. - \sa setTranslationEnabled() + Returns true if translation is enabled; returns false otherwise. - \since 4.5 + \sa setTranslationEnabled() */ bool QUiLoader::isTranslationEnabled() const diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp index a871fe4..d7dab0b 100644 --- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -82,7 +82,6 @@ static QStringList wantedInterfaces; static const char help[] = "Usage: " PROGRAMNAME " [options...] [xml-or-xml-file] [interfaces...]\n" "Produces the C++ code to implement the interfaces defined in the input file.\n" - "If no options are given, the code is written to the standard output.\n" "\n" "Options:\n" " -a <filename> Write the adaptor code to <filename>\n" @@ -99,7 +98,10 @@ static const char help[] = "If the file name given to the options -a and -p does not end in .cpp or .h, the\n" "program will automatically append the suffixes and produce both files.\n" "You can also use a colon (:) to separate the header name from the source file\n" - "name, as in '-a filename_p.h:filename.cpp'.\n"; + "name, as in '-a filename_p.h:filename.cpp'.\n" + "\n" + "If you pass a dash (-) as the argument to either -p or -a, the output is written\n" + "to the standard output\n"; static const char includeList[] = "#include <QtCore/QByteArray>\n" diff --git a/tools/qtestlib/chart/3rdparty/excanvas.js b/tools/qtestlib/chart/3rdparty/excanvas.js new file mode 100644 index 0000000..e77763a --- /dev/null +++ b/tools/qtestlib/chart/3rdparty/excanvas.js @@ -0,0 +1,14 @@ +// Copyright 2006 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +if(!window.CanvasRenderingContext2D){(function(){var N=Math;var O=N.round;var L=N.sin;var U=N.cos;var A=10;var I=A/2;var G={init:function(W){var X=W||document;if(/MSIE/.test(navigator.userAgent)&&!window.opera){var V=this;X.attachEvent("onreadystatechange",function(){V.init_(X)})}},init_:function(Y){if(Y.readyState=="complete"){if(!Y.namespaces.g_vml_){Y.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml")}var X=Y.createStyleSheet();X.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}";var W=Y.getElementsByTagName("canvas");for(var V=0;V<W.length;V++){if(!W[V].getContext){this.initElement(W[V])}}}},fixElement_:function(X){var Z=X.outerHTML;var Y=X.ownerDocument.createElement(Z);if(Z.slice(-2)!="/>"){var V="/"+X.tagName;var W;while((W=X.nextSibling)&&W.tagName!=V){W.removeNode()}if(W){W.removeNode()}}X.parentNode.replaceChild(Y,X);return Y},initElement:function(W){W=this.fixElement_(W);W.getContext=function(){if(this.context_){return this.context_}return this.context_=new J(this)};W.attachEvent("onpropertychange",T);W.attachEvent("onresize",B);var V=W.attributes;if(V.width&&V.width.specified){W.style.width=V.width.nodeValue+"px"}else{W.width=W.clientWidth}if(V.height&&V.height.specified){W.style.height=V.height.nodeValue+"px"}else{W.height=W.clientHeight}return W}};function T(W){var V=W.srcElement;switch(W.propertyName){case"width":V.style.width=V.attributes.width.nodeValue+"px";V.getContext().clearRect();break;case"height":V.style.height=V.attributes.height.nodeValue+"px";V.getContext().clearRect();break}}function B(W){var V=W.srcElement;if(V.firstChild){V.firstChild.style.width=V.clientWidth+"px";V.firstChild.style.height=V.clientHeight+"px"}}G.init();var D=[];for(var R=0;R<16;R++){for(var Q=0;Q<16;Q++){D[R*16+Q]=R.toString(16)+Q.toString(16)}}function K(){return[[1,0,0],[0,1,0],[0,0,1]]}function E(Y,X){var W=K();for(var V=0;V<3;V++){for(var b=0;b<3;b++){var Z=0;for(var a=0;a<3;a++){Z+=Y[V][a]*X[a][b]}W[V][b]=Z}}return W}function P(W,V){V.fillStyle=W.fillStyle;V.lineCap=W.lineCap;V.lineJoin=W.lineJoin;V.lineWidth=W.lineWidth;V.miterLimit=W.miterLimit;V.shadowBlur=W.shadowBlur;V.shadowColor=W.shadowColor;V.shadowOffsetX=W.shadowOffsetX;V.shadowOffsetY=W.shadowOffsetY;V.strokeStyle=W.strokeStyle;V.arcScaleX_=W.arcScaleX_;V.arcScaleY_=W.arcScaleY_}function C(W){var Z,Y=1;W=String(W);if(W.substring(0,3)=="rgb"){var b=W.indexOf("(",3);var V=W.indexOf(")",b+1);var a=W.substring(b+1,V).split(",");Z="#";for(var X=0;X<3;X++){Z+=D[Number(a[X])]}if((a.length==4)&&(W.substr(3,1)=="a")){Y=a[3]}}else{Z=W}return[Z,Y]}function M(V){switch(V){case"butt":return"flat";case"round":return"round";case"square":default:return"square"}}function J(W){this.m_=K();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.strokeStyle="#000";this.fillStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=A*1;this.globalAlpha=1;this.canvas=W;var V=W.ownerDocument.createElement("div");V.style.width=W.clientWidth+"px";V.style.height=W.clientHeight+"px";V.style.overflow="hidden";V.style.position="absolute";W.appendChild(V);this.element_=V;this.arcScaleX_=1;this.arcScaleY_=1}var H=J.prototype;H.clearRect=function(){this.element_.innerHTML="";this.currentPath_=[]};H.beginPath=function(){this.currentPath_=[]};H.moveTo=function(W,V){this.currentPath_.push({type:"moveTo",x:W,y:V});this.currentX_=W;this.currentY_=V};H.lineTo=function(W,V){this.currentPath_.push({type:"lineTo",x:W,y:V});this.currentX_=W;this.currentY_=V};H.bezierCurveTo=function(X,V,a,Z,Y,W){this.currentPath_.push({type:"bezierCurveTo",cp1x:X,cp1y:V,cp2x:a,cp2y:Z,x:Y,y:W});this.currentX_=Y;this.currentY_=W};H.quadraticCurveTo=function(c,b,a,Z){var W=this.currentX_+2/3*(c-this.currentX_);var V=this.currentY_+2/3*(b-this.currentY_);var Y=W+(a-this.currentX_)/3;var X=V+(Z-this.currentY_)/3;this.bezierCurveTo(W,V,Y,X,a,Z)};H.arc=function(b,Z,a,Y,W,X){a*=A;var f=X?"at":"wa";var c=b+(U(Y)*a)-I;var e=Z+(L(Y)*a)-I;var V=b+(U(W)*a)-I;var d=Z+(L(W)*a)-I;if(c==V&&!X){c+=0.125}this.currentPath_.push({type:f,x:b,y:Z,radius:a,xStart:c,yStart:e,xEnd:V,yEnd:d})};H.rect=function(X,W,V,Y){this.moveTo(X,W);this.lineTo(X+V,W);this.lineTo(X+V,W+Y);this.lineTo(X,W+Y);this.closePath()};H.strokeRect=function(X,W,V,Y){this.beginPath();this.moveTo(X,W);this.lineTo(X+V,W);this.lineTo(X+V,W+Y);this.lineTo(X,W+Y);this.closePath();this.stroke()};H.fillRect=function(X,W,V,Y){this.beginPath();this.moveTo(X,W);this.lineTo(X+V,W);this.lineTo(X+V,W+Y);this.lineTo(X,W+Y);this.closePath();this.fill()};H.createLinearGradient=function(W,Y,V,X){var Z=new S("gradient");return Z};H.createRadialGradient=function(Y,a,X,W,Z,V){var b=new S("gradientradial");b.radius1_=X;b.radius2_=V;b.focus_.x=Y;b.focus_.y=a;return b};H.drawImage=function(n,Y){var f,c,i,u,l,j,p,x;var g=n.runtimeStyle.width;var m=n.runtimeStyle.height;n.runtimeStyle.width="auto";n.runtimeStyle.height="auto";var e=n.width;var s=n.height;n.runtimeStyle.width=g;n.runtimeStyle.height=m;if(arguments.length==3){f=arguments[1];c=arguments[2];l=j=0;p=i=e;x=u=s}else{if(arguments.length==5){f=arguments[1];c=arguments[2];i=arguments[3];u=arguments[4];l=j=0;p=e;x=s}else{if(arguments.length==9){l=arguments[1];j=arguments[2];p=arguments[3];x=arguments[4];f=arguments[5];c=arguments[6];i=arguments[7];u=arguments[8]}else{throw"Invalid number of arguments"}}}var v=this.getCoords_(f,c);var Z=p/2;var X=x/2;var t=[];var V=10;var b=10;t.push(" <g_vml_:group",' coordsize="',A*V,",",A*b,'"',' coordorigin="0,0"',' style="width:',V,";height:",b,";position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var a=[];a.push("M11='",this.m_[0][0],"',","M12='",this.m_[1][0],"',","M21='",this.m_[0][1],"',","M22='",this.m_[1][1],"',","Dx='",O(v.x/A),"',","Dy='",O(v.y/A),"'");var r=v;var q=this.getCoords_(f+i,c);var o=this.getCoords_(f,c+u);var k=this.getCoords_(f+i,c+u);r.x=Math.max(r.x,q.x,o.x,k.x);r.y=Math.max(r.y,q.y,o.y,k.y);t.push("padding:0 ",O(r.x/A),"px ",O(r.y/A),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",a.join(""),", sizingmethod='clip');")}else{t.push("top:",O(v.y/A),"px;left:",O(v.x/A),"px;")}t.push(' ">','<g_vml_:image src="',n.src,'"',' style="width:',A*i,";"," height:",A*u,';"',' cropleft="',l/e,'"',' croptop="',j/s,'"',' cropright="',(e-l-p)/e,'"',' cropbottom="',(s-j-x)/s,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",t.join(""))};H.stroke=function(y){var e=[];var d=false;var AB=C(y?this.fillStyle:this.strokeStyle);var u=AB[0];var Y=AB[1]*this.globalAlpha;var X=10;var j=10;e.push("<g_vml_:shape",' fillcolor="',u,'"',' filled="',Boolean(y),'"',' style="position:absolute;width:',X,";height:",j,';"',' coordorigin="0 0" coordsize="',A*X," ",A*j,'"',' stroked="',!y,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',u,'"',' path="');var h=false;var t={x:null,y:null};var v={x:null,y:null};for(var w=0;w<this.currentPath_.length;w++){var o=this.currentPath_[w];if(o.type=="moveTo"){e.push(" m ");var AA=this.getCoords_(o.x,o.y);e.push(O(AA.x),",",O(AA.y))}else{if(o.type=="lineTo"){e.push(" l ");var AA=this.getCoords_(o.x,o.y);e.push(O(AA.x),",",O(AA.y))}else{if(o.type=="close"){e.push(" x ")}else{if(o.type=="bezierCurveTo"){e.push(" c ");var AA=this.getCoords_(o.x,o.y);var s=this.getCoords_(o.cp1x,o.cp1y);var q=this.getCoords_(o.cp2x,o.cp2y);e.push(O(s.x),",",O(s.y),",",O(q.x),",",O(q.y),",",O(AA.x),",",O(AA.y))}else{if(o.type=="at"||o.type=="wa"){e.push(" ",o.type," ");var AA=this.getCoords_(o.x,o.y);var k=this.getCoords_(o.xStart,o.yStart);var b=this.getCoords_(o.xEnd,o.yEnd);e.push(O(AA.x-this.arcScaleX_*o.radius),",",O(AA.y-this.arcScaleY_*o.radius)," ",O(AA.x+this.arcScaleX_*o.radius),",",O(AA.y+this.arcScaleY_*o.radius)," ",O(k.x),",",O(k.y)," ",O(b.x),",",O(b.y))}}}}}if(AA){if(t.x==null||AA.x<t.x){t.x=AA.x}if(v.x==null||AA.x>v.x){v.x=AA.x}if(t.y==null||AA.y<t.y){t.y=AA.y}if(v.y==null||AA.y>v.y){v.y=AA.y}}}e.push(' ">');if(typeof this.fillStyle=="object"){var n={x:"50%",y:"50%"};var r=(v.x-t.x);var l=(v.y-t.y);var z=(r>l)?r:l;n.x=O((this.fillStyle.focus_.x/r)*100+50)+"%";n.y=O((this.fillStyle.focus_.y/l)*100+50)+"%";var g=[];if(this.fillStyle.type_=="gradientradial"){var x=(this.fillStyle.radius1_/z*100);var m=(this.fillStyle.radius2_/z*100)-x}else{var x=0;var m=100}var V={offset:null,color:null};var Z={offset:null,color:null};this.fillStyle.colors_.sort(function(a,W){return a.offset-W.offset});for(var w=0;w<this.fillStyle.colors_.length;w++){var f=this.fillStyle.colors_[w];g.push((f.offset*m)+x,"% ",f.color,",");if(f.offset>V.offset||V.offset==null){V.offset=f.offset;V.color=f.color}if(f.offset<Z.offset||Z.offset==null){Z.offset=f.offset;Z.color=f.color}}g.pop();e.push("<g_vml_:fill",' color="',Z.color,'"',' color2="',V.color,'"',' type="',this.fillStyle.type_,'"',' focusposition="',n.x,", ",n.y,'"',' colors="',g.join(""),'"',' opacity="',Y,'" />')}else{if(y){e.push('<g_vml_:fill color="',u,'" opacity="',Y,'" />')}else{e.push("<g_vml_:stroke",' opacity="',Y,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',M(this.lineCap),'"',' weight="',this.lineWidth,'px"',' color="',u,'" />')}}e.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",e.join(""))};H.fill=function(){this.stroke(true)};H.closePath=function(){this.currentPath_.push({type:"close"})};H.getCoords_=function(W,V){return{x:A*(W*this.m_[0][0]+V*this.m_[1][0]+this.m_[2][0])-I,y:A*(W*this.m_[0][1]+V*this.m_[1][1]+this.m_[2][1])-I}};H.save=function(){var V={};P(this,V);this.aStack_.push(V);this.mStack_.push(this.m_);this.m_=E(K(),this.m_)};H.restore=function(){P(this.aStack_.pop(),this);this.m_=this.mStack_.pop()};H.translate=function(X,W){var V=[[1,0,0],[0,1,0],[X,W,1]];this.m_=E(V,this.m_)};H.rotate=function(W){var Y=U(W);var X=L(W);var V=[[Y,X,0],[-X,Y,0],[0,0,1]];this.m_=E(V,this.m_)};H.scale=function(X,W){this.arcScaleX_*=X;this.arcScaleY_*=W;var V=[[X,0,0],[0,W,0],[0,0,1]];this.m_=E(V,this.m_)};H.clip=function(){};H.arcTo=function(){};H.createPattern=function(){return new F};function S(V){this.type_=V;this.radius1_=0;this.radius2_=0;this.colors_=[];this.focus_={x:0,y:0}}S.prototype.addColorStop=function(W,V){V=C(V);this.colors_.push({offset:1-W,color:V})};function F(){}G_vmlCanvasManager=G;CanvasRenderingContext2D=J;CanvasGradient=S;CanvasPattern=F})()};
\ No newline at end of file diff --git a/tools/qtestlib/chart/3rdparty/flotr.js b/tools/qtestlib/chart/3rdparty/flotr.js new file mode 100644 index 0000000..80bb506 --- /dev/null +++ b/tools/qtestlib/chart/3rdparty/flotr.js @@ -0,0 +1,2 @@ +//Flotr 0.1.0alpha Copyright (c) 2008 Bas Wenneker, <http://solutoire.com>, MIT License. +var Flotr=(function(){var C=0;function L(M){return M.collect(function(N){return(N.data)?Object.clone(N):{data:N}})}function G(P,N){var M=N||{};for(var O in P){M[O]=(typeof (P[O])=="object"&&!(P[O].constructor==Array||P[O].constructor==RegExp))?G(P[O],N[O]):M[O]=P[O]}return M}function I(Q,P,M,N){var T=(M-P)/Q;var S=H(T);var O=T/S;var R=10;if(O<1.5){R=1}else{if(O<2.25){R=2}else{if(O<3){R=2.5}else{if(O<7.5){R=5}}}}if(R==2.5&&N==0){R=2}R*=S;return R}function E(M){return M.toString()}function F(M){return"("+M.x+", "+M.y+")"}function H(M){return Math.pow(10,Math.floor(Math.log(M)/Math.LN10))}function K(O){var M;if((M=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(O))){return new B(parseInt(M[1]),parseInt(M[2]),parseInt(M[3]))}if((M=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(O))){return new B(parseInt(M[1]),parseInt(M[2]),parseInt(M[3]),parseFloat(M[4]))}if((M=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(O))){return new B(parseFloat(M[1])*2.55,parseFloat(M[2])*2.55,parseFloat(M[3])*2.55)}if((M=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(O))){return new B(parseFloat(M[1])*2.55,parseFloat(M[2])*2.55,parseFloat(M[3])*2.55,parseFloat(M[4]))}if((M=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(O))){return new B(parseInt(M[1],16),parseInt(M[2],16),parseInt(M[3],16))}if((M=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(O))){return new B(parseInt(M[1]+M[1],16),parseInt(M[2]+M[2],16),parseInt(M[3]+M[3],16))}var N=O.strip().toLowerCase();if(N=="transparent"){return new B(255,255,255,0)}M=D[N];return new B(M[0],M[1],M[2])}function A(N){var M;do{M=N.getStyle("background-color").toLowerCase();if(M!=""&&M!="transparent"){break}N=N.up(0)}while(N.nodeName.toLowerCase()!="body");if(M=="rgba(0, 0, 0, 0)"){return"transparent"}return M}function B(S,R,N,P){var Q=["r","g","b","a"];var M=4;while(-1<--M){this[Q[M]]=arguments[M]||((M==3)?1:0)}this.toString=function(){return(this.a>=1)?"rgb("+[this.r,this.g,this.b].join(",")+")":"rgba("+[this.r,this.g,this.b,this.a].join(",")+")"};this.scale=function(V,U,W,T){M=4;while(-1<--M){if(arguments[M]!=null){this[Q[M]]*=arguments[M]}}return this.normalize()};this.adjust=function(V,U,W,T){M=4;while(-1<--M){if(arguments[M]!=null){this[Q[M]]+=arguments[M]}}return this.normalize()};this.clone=function(){return new B(this.r,this.b,this.g,this.a)};var O=function(U,T,V){return Math.max(Math.min(U,V),T)};this.normalize=function(){this.r=O(parseInt(this.r),0,255);this.g=O(parseInt(this.g),0,255);this.b=O(parseInt(this.b),0,255);this.a=O(this.a,0,1);return this};this.normalize()}var D={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};function J(y,AO,p){var o,S,AL,h,AS;var z="flotr-"+C++;var R=L(AO);var N=y;var u={},c={};var l={left:0,right:0,top:0,bottom:0};var AA=0;var d=0;var AH=0;var U=0;var P=0;var AD=0;var AC=0;var AB=0;g(p);k();AN();q();AK(u,o.xaxis);Z();AK(c,o.yaxis);m(u,o.xaxis);m(c,o.yaxis);Y();AP();AQ();this.getCanvas=function(){return S};this.getPlotOffset=function(){return l};this.clearSelection=M;this.setSelection=AF;function g(AV){o=G(AV,{colors:["#00A8F0","#C0D800","#cb4b4b","#4da74d","#9440ed"],legend:{show:true,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:0.85},xaxis:{ticks:null,noTicks:5,tickFormatter:E,tickDecimals:null,min:null,max:null,autoscaleMargin:0},yaxis:{ticks:null,noTicks:5,tickFormatter:E,tickDecimals:null,min:null,max:null,autoscaleMargin:0},points:{show:false,radius:3,lineWidth:2,fill:true,fillColor:"#ffffff"},lines:{show:false,lineWidth:2,fill:false,fillColor:null},bars:{show:false,lineWidth:2,barWidth:1,fill:true,fillColor:null},grid:{color:"#545454",backgroundColor:null,tickColor:"#dddddd",labelMargin:3},selection:{mode:null,color:"#B6D9FF",fps:10},mouse:{track:null,position:"se",trackFormatter:F,margin:3,color:"#ff3f19",trackDecimals:1,sensibility:2,radius:3},shadowSize:4});var Ah=R.length;var AT=[];var AZ=[];for(var Ac=0;Ac<R.length;++Ac){var Ag=R[Ac].color;if(Ag!=null){--Ah;if(Object.isNumber(Ag)){AZ.push(Ag)}else{AT.push(K(R[Ac].color))}}}for(var Ab=0;Ab<AZ.length;++Ab){Ah=Math.max(Ah,AZ[Ab]+1)}var AU=[];var AY=0;var Aa=0;while(AU.length<Ah){var Af=(o.colors.length==Aa)?new B(100,100,100):K(o.colors[Aa]);var AW=AY%2==1?-1:1;var Ae=1+AW*Math.ceil(AY/2)*0.2;Af.scale(Ae,Ae,Ae);AU.push(Af);if(++Aa>=o.colors.length){Aa=0;++AY}}var Ad=0;for(var AX=0,Ai;AX<R.length;++AX){Ai=R[AX];if(Ai.color==null){Ai.color=AU[Ad].toString();++Ad}else{if(Object.isNumber(Ai.color)){Ai.color=AU[Ai.color].toString()}}Ai.lines=Object.extend(Object.clone(o.lines),Ai.lines);Ai.points=Object.extend(Object.clone(o.points),Ai.points);Ai.bars=Object.extend(Object.clone(o.bars),Ai.bars);Ai.mouse=Object.extend(Object.clone(o.mouse),Ai.mouse);if(Ai.shadowSize==null){Ai.shadowSize=o.shadowSize}}}function k(){AH=N.getWidth();U=N.getHeight();N.innerHTML="";N.setStyle({position:"relative"});if(AH<=0||U<=0){throw"Invalid dimensions for plot, width = "+AH+", height = "+U}S=$(document.createElement("canvas")).writeAttribute({width:AH,height:U});N.appendChild(S);if(Prototype.Browser.IE){S=$(window.G_vmlCanvasManager.initElement(S))}h=S.getContext("2d");AL=$(document.createElement("canvas")).writeAttribute({width:AH,height:U}).setStyle({position:"absolute",left:"0px",top:"0px"});N.setStyle({cursor:"default"}).appendChild(AL);if(Prototype.Browser.IE){AL=$(window.G_vmlCanvasManager.initElement(AL))}AS=AL.getContext("2d")}function AN(){if(o.selection.mode!=null){AL.observe("mousedown",r)}AL.observe("mousemove",e);AL.observe("click",f)}function q(){c.datamin=u.datamin=0;u.datamax=c.datamax=1;if(R.length==0){return }var AY=false;for(var AV=0;AV<R.length;++AV){if(R[AV].data.length>0){u.datamin=u.datamax=R[AV].data[0][0];c.datamin=c.datamax=R[AV].data[0][1];AY=true;break}}if(!AY){return }for(var AU=0;AU<R.length;++AU){var AX=R[AU].data;for(var AW=0;AW<AX.length;++AW){var AT=AX[AW][0];var AZ=AX[AW][1];if(AT<u.datamin){u.datamin=AT}else{if(AT>u.datamax){u.datamax=AT}}if(AZ<c.datamin){c.datamin=AZ}else{if(AZ>c.datamax){c.datamax=AZ}}}}}function AK(AW,AY){var AV=AY.min!=null?AY.min:AW.datamin;var AT=AY.max!=null?AY.max:AW.datamax;if(AT-AV==0){var AU=(AT==0)?1:0.01;AV-=AU;AT+=AU}AW.tickSize=I(AY.noTicks,AV,AT,AY.tickDecimals);var AX;if(AY.min==null){AX=AY.autoscaleMargin;if(AX!=0){AV-=AW.tickSize*AX;if(AV<0&&AW.datamin>=0){AV=0}AV=AW.tickSize*Math.floor(AV/AW.tickSize)}}if(AY.max==null){AX=AY.autoscaleMargin;if(AX!=0){AT+=AW.tickSize*AX;if(AT>0&&AW.datamax<=0){AT=0}AT=AW.tickSize*Math.ceil(AT/AW.tickSize)}}AW.min=AV;AW.max=AT}function Z(){if(o.xaxis.max==null){var AU=u.max;for(var AT=0;AT<R.length;++AT){if(R[AT].bars.show&&R[AT].bars.barWidth+u.datamax>AU){AU=u.max+R[AT].bars.barWidth}}u.max=AU}}function m(AV,AW){AV.ticks=[];if(AW.ticks){var AZ=AW.ticks;if(Object.isFunction(AZ)){AZ=AZ({min:AV.min,max:AV.max})}for(var AX=0,Aa,AY;AX<AZ.length;++AX){var Ab=AZ[AX];if(typeof (Ab)=="object"){Aa=Ab[0];AY=(Ab.length>1)?Ab[1]:AW.tickFormatter(Aa)}else{Aa=Ab;AY=AW.tickFormatter(Aa)}AV.ticks[AX]={v:Aa,label:AY}}}else{var AT=AV.tickSize*Math.ceil(AV.min/AV.tickSize);for(AX=0;AT+AX*AV.tickSize<=AV.max;++AX){Aa=AT+AX*AV.tickSize;var AU=AW.tickDecimals;if(AU==null){AU=1-Math.floor(Math.log(AV.tickSize)/Math.LN10)}if(AU<0){AU=0}Aa=Aa.toFixed(AU);AV.ticks.push({v:Aa,label:AW.tickFormatter(Aa)})}}}function Y(){var AX="";for(var AW=0;AW<c.ticks.length;++AW){var AU=c.ticks[AW].label.length;if(AU>AX.length){AX=c.ticks[AW].label}}var AT=N.insert('<div style="position:absolute;top:-10000px;font-size:smaller" class="flotr-grid-label">'+AX+"</div>").down(0).next(1);AA=AT.getWidth();d=AT.getHeight();AT.remove();var AY=2;if(o.points.show){AY=Math.max(AY,o.points.radius+o.points.lineWidth/2)}for(var AV=0;AV<R.length;++AV){if(R[AV].points.show){AY=Math.max(AY,R[AV].points.radius+R[AV].points.lineWidth/2)}}l.left=l.right=l.top=l.bottom=AY;l.left+=AA+o.grid.labelMargin;l.bottom+=d+o.grid.labelMargin;P=AH-l.left-l.right;AD=U-l.bottom-l.top;AC=P/(u.max-u.min);AB=AD/(c.max-c.min)}function AP(){V();AR();for(var AT=0;AT<R.length;AT++){AI(R[AT])}}function AE(AT){return(AT-u.min)*AC}function j(AT){return AD-(AT-c.min)*AB}function V(){h.save();h.translate(l.left,l.top);if(o.grid.backgroundColor!=null){h.fillStyle=o.grid.backgroundColor;h.fillRect(0,0,P,AD)}h.lineWidth=1;h.strokeStyle=o.grid.tickColor;h.beginPath();for(var AV=0,AT=null;AV<u.ticks.length;++AV){AT=u.ticks[AV].v;if(AT==u.min||AT==u.max){continue}h.moveTo(Math.floor(AE(AT))+h.lineWidth/2,0);h.lineTo(Math.floor(AE(AT))+h.lineWidth/2,AD)}for(var AU=0,AT=null;AU<c.ticks.length;++AU){AT=c.ticks[AU].v;if(AT==c.min||AT==c.max){continue}h.moveTo(0,Math.floor(j(AT))+h.lineWidth/2);h.lineTo(P,Math.floor(j(AT))+h.lineWidth/2)}h.stroke();h.lineWidth=2;h.strokeStyle=o.grid.color;h.lineJoin="round";h.strokeRect(0,0,P,AD);h.restore()}function AR(){var AZ=0;for(var AY=0;AY<u.ticks.length;++AY){if(u.ticks[AY].label){++AZ}}var AU=P/AZ;var AX='<div style="font-size:smaller;color:'+o.grid.color+'">';for(var AV=0,AW=null;AV<u.ticks.length;++AV){AW=u.ticks[AV];if(!AW.label){continue}AX+='<div style="position:absolute;top:'+(l.top+AD+o.grid.labelMargin)+"px;left:"+(l.left+AE(AW.v)-AU/2)+"px;width:"+AU+'px;text-align:center" class="flotr-grid-label">'+AW.label+"</div>"}for(var AT=0,AW=null;AT<c.ticks.length;++AT){AW=c.ticks[AT];if(!AW.label||AW.label.length==0){continue}AX+='<div style="position:absolute;top:'+(l.top+j(AW.v)-d/2)+"px;left:0;width:"+AA+'px;text-align:right" class="flotr-grid-label">'+AW.label+"</div>"}AX+="</div>";N.insert(AX)}function AI(AT){if(AT.lines.show||(!AT.bars.show&&!AT.points.show)){i(AT)}if(AT.bars.show){v(AT)}if(AT.points.show){w(AT)}}function i(AV){function AU(Ad,Ac){if(Ad.length<2){return }var Ab=AE(Ad[0][0]),Aa=j(Ad[0][1])+Ac;h.beginPath();h.moveTo(Ab,Aa);for(var Ae=0;Ae<Ad.length-1;++Ae){var AZ=Ad[Ae][0],Ag=Ad[Ae][1],AY=Ad[Ae+1][0],Af=Ad[Ae+1][1];if(Ag<=Af&&Ag<c.min){if(Af<c.min){continue}AZ=(c.min-Ag)/(Af-Ag)*(AY-AZ)+AZ;Ag=c.min}else{if(Af<=Ag&&Af<c.min){if(Ag<c.min){continue}AY=(c.min-Ag)/(Af-Ag)*(AY-AZ)+AZ;Af=c.min}}if(Ag>=Af&&Ag>c.max){if(Af>c.max){continue}AZ=(c.max-Ag)/(Af-Ag)*(AY-AZ)+AZ;Ag=c.max}else{if(Af>=Ag&&Af>c.max){if(Ag>c.max){continue}AY=(c.max-Ag)/(Af-Ag)*(AY-AZ)+AZ;Af=c.max}}if(AZ<=AY&&AZ<u.min){if(AY<u.min){continue}Ag=(u.min-AZ)/(AY-AZ)*(Af-Ag)+Ag;AZ=u.min}else{if(AY<=AZ&&AY<u.min){if(AZ<u.min){continue}Af=(u.min-AZ)/(AY-AZ)*(Af-Ag)+Ag;AY=u.min}}if(AZ>=AY&&AZ>u.max){if(AY>u.max){continue}Ag=(u.max-AZ)/(AY-AZ)*(Af-Ag)+Ag;AZ=u.max}else{if(AY>=AZ&&AY>u.max){if(AZ>u.max){continue}Af=(u.max-AZ)/(AY-AZ)*(Af-Ag)+Ag;AY=u.max}}if(Ab!=AE(AZ)||Aa!=j(Ag)+Ac){h.moveTo(AE(AZ),j(Ag)+Ac)}Ab=AE(AY);Aa=j(Af)+Ac;h.lineTo(Ab,Aa)}h.stroke()}function AW(Ac){if(Ac.length<2){return }var AY=Math.min(Math.max(0,c.min),c.max);var Ah,Aa=0;var Ae=true;h.beginPath();for(var Ad=0;Ad<Ac.length-1;++Ad){var Ab=Ac[Ad][0],Ai=Ac[Ad][1],AZ=Ac[Ad+1][0],Ag=Ac[Ad+1][1];if(Ab<=AZ&&Ab<u.min){if(AZ<u.min){continue}Ai=(u.min-Ab)/(AZ-Ab)*(Ag-Ai)+Ai;Ab=u.min}else{if(AZ<=Ab&&AZ<u.min){if(Ab<u.min){continue}Ag=(u.min-Ab)/(AZ-Ab)*(Ag-Ai)+Ai;AZ=u.min}}if(Ab>=AZ&&Ab>u.max){if(AZ>u.max){continue}Ai=(u.max-Ab)/(AZ-Ab)*(Ag-Ai)+Ai;Ab=u.max}else{if(AZ>=Ab&&AZ>u.max){if(Ab>u.max){continue}Ag=(u.max-Ab)/(AZ-Ab)*(Ag-Ai)+Ai;AZ=u.max}}if(Ae){h.moveTo(AE(Ab),j(AY));Ae=false}if(Ai>=c.max&&Ag>=c.max){h.lineTo(AE(Ab),j(c.max));h.lineTo(AE(AZ),j(c.max));continue}else{if(Ai<=c.min&&Ag<=c.min){h.lineTo(AE(Ab),j(c.min));h.lineTo(AE(AZ),j(c.min));continue}}var Aj=Ab,Af=AZ;if(Ai<=Ag&&Ai<c.min&&Ag>=c.min){Ab=(c.min-Ai)/(Ag-Ai)*(AZ-Ab)+Ab;Ai=c.min}else{if(Ag<=Ai&&Ag<c.min&&Ai>=c.min){AZ=(c.min-Ai)/(Ag-Ai)*(AZ-Ab)+Ab;Ag=c.min}}if(Ai>=Ag&&Ai>c.max&&Ag<=c.max){Ab=(c.max-Ai)/(Ag-Ai)*(AZ-Ab)+Ab;Ai=c.max}else{if(Ag>=Ai&&Ag>c.max&&Ai<=c.max){AZ=(c.max-Ai)/(Ag-Ai)*(AZ-Ab)+Ab;Ag=c.max}}if(Ab!=Aj){Ah=(Ai<=c.min)?Ah=c.min:c.max;h.lineTo(AE(Aj),j(Ah));h.lineTo(AE(Ab),j(Ah))}h.lineTo(AE(Ab),j(Ai));h.lineTo(AE(AZ),j(Ag));if(AZ!=Af){Ah=(Ag<=c.min)?c.min:c.max;h.lineTo(AE(Af),j(Ah));h.lineTo(AE(AZ),j(Ah))}Aa=Math.max(AZ,Af)}h.lineTo(AE(Aa),j(AY));h.closePath();h.fill()}h.save();h.translate(l.left,l.top);h.lineJoin="round";var AX=AV.lines.lineWidth;var AT=AV.shadowSize;if(AT>0){h.lineWidth=AT/2;h.strokeStyle="rgba(0,0,0,0.1)";AU(AV.data,AX/2+AT/2+h.lineWidth/2);h.lineWidth=AT/2;h.strokeStyle="rgba(0,0,0,0.2)";AU(AV.data,AX/2+h.lineWidth/2)}h.lineWidth=AX;h.strokeStyle=AV.color;if(AV.lines.fill){h.fillStyle=AV.lines.fillColor!=null?AV.lines.fillColor:K(AV.color).scale(null,null,null,0.4).toString();AW(AV.data,0)}AU(AV.data,0);h.restore()}function w(AU){function AX(Ab,AZ,Ac){for(var Aa=0;Aa<Ab.length;++Aa){var AY=Ab[Aa][0],Ad=Ab[Aa][1];if(AY<u.min||AY>u.max||Ad<c.min||Ad>c.max){continue}h.beginPath();h.arc(AE(AY),j(Ad),AZ,0,2*Math.PI,true);if(Ac){h.fill()}h.stroke()}}function AW(Ab,Ac,AZ){for(var Aa=0;Aa<Ab.length;++Aa){var AY=Ab[Aa][0],Ad=Ab[Aa][1];if(AY<u.min||AY>u.max||Ad<c.min||Ad>c.max){continue}h.beginPath();h.arc(AE(AY),j(Ad)+Ac,AZ,0,Math.PI,false);h.stroke()}}h.save();h.translate(l.left,l.top);var AV=AU.lines.lineWidth;var AT=AU.shadowSize;if(AT>0){h.lineWidth=AT/2;h.strokeStyle="rgba(0,0,0,0.1)";AW(AU.data,AT/2+h.lineWidth/2,AU.points.radius);h.lineWidth=AT/2;h.strokeStyle="rgba(0,0,0,0.2)";AW(AU.data,h.lineWidth/2,AU.points.radius)}h.lineWidth=AU.points.lineWidth;h.strokeStyle=AU.color;h.fillStyle=AU.points.fillColor!=null?AU.points.fillColor:AU.color;AX(AU.data,AU.points.radius,AU.points.fill);h.restore()}function v(AU){function AT(Ab,Ak,AZ,Aj){if(Ab.length<2){return }for(var Ac=0;Ac<Ab.length;Ac++){var Ag=Ab[Ac][0],Af=Ab[Ac][1];var Ai=true,Aa=true,Ad=true;var AY=Ag,Ah=Ag+Ak,AX=0,Ae=Af;if(Ah<u.min||AY>u.max||Ae<c.min||AX>c.max){continue}if(AY<u.min){AY=u.min;Ai=false}if(Ah>u.max){Ah=u.max;Ad=false}if(AX<c.min){AX=c.min}if(Ae>c.max){Ae=c.max;Aa=false}if(Aj){h.beginPath();h.moveTo(AE(AY),j(AX)+AZ);h.lineTo(AE(AY),j(Ae)+AZ);h.lineTo(AE(Ah),j(Ae)+AZ);h.lineTo(AE(Ah),j(AX)+AZ);h.fill()}if(Ai||Ad||Aa){h.beginPath();h.moveTo(AE(AY),j(AX)+AZ);if(Ai){h.lineTo(AE(AY),j(Ae)+AZ)}else{h.moveTo(AE(AY),j(Ae)+AZ)}if(Aa){h.lineTo(AE(Ah),j(Ae)+AZ)}else{h.moveTo(AE(Ah),j(Ae)+AZ)}if(Ad){h.lineTo(AE(Ah),j(AX)+AZ)}else{h.moveTo(AE(Ah),j(AX)+AZ)}h.stroke()}}}h.save();h.translate(l.left,l.top);h.lineJoin="round";var AW=AU.bars.barWidth;var AV=Math.min(AU.bars.lineWidth,AW);h.lineWidth=AV;h.strokeStyle=AU.color;if(AU.bars.fill){h.fillStyle=AU.bars.fillColor!=null?AU.bars.fillColor:K(AU.color).scale(null,null,null,0.4).toString()}AT(AU.data,AW,0,AU.bars.fill);h.restore()}function AQ(){if(!o.legend.show){return }var Aa=[];var AY=false;for(var AX=0;AX<R.length;++AX){if(!R[AX].label){continue}if(AX%o.legend.noColumns==0){Aa.push((AY)?"</tr><tr>":"<tr>");AY=true}var Ac=R[AX].label;if(o.legend.labelFormatter!=null){Ac=o.legend.labelFormatter(Ac)}Aa.push('<td class="flotr-legend-color-box"><div style="border:1px solid '+o.legend.labelBoxBorderColor+';padding:1px"><div style="width:14px;height:10px;background-color:'+R[AX].color+'"></div></div></td><td class="flotr-legend-label">'+Ac+"</td>")}if(AY){Aa.push("</tr>")}if(Aa.length>0){var Ad='<table style="font-size:smaller;color:'+o.grid.color+'">'+Aa.join("")+"</table>";if(o.legend.container!=null){o.legend.container.append(Ad)}else{var Ab="";var AU=o.legend.position,AV=o.legend.margin;if(AU.charAt(0)=="n"){Ab+="top:"+(AV+l.top)+"px;"}else{if(AU.charAt(0)=="s"){Ab+="bottom:"+(AV+l.bottom)+"px;"}}if(AU.charAt(1)=="e"){Ab+="right:"+(AV+l.right)+"px;"}else{if(AU.charAt(1)=="w"){Ab+="left:"+(AV+l.bottom)+"px;"}}var AT=N.insert('<div class="flotr-legend" style="position:absolute;z-index:2;'+Ab+'">'+Ad+"</div>").getElementsBySelector("div.flotr-legend").first();if(o.legend.backgroundOpacity!=0){var AZ=o.legend.backgroundColor;if(AZ==null){var AW=(o.grid.backgroundColor!=null)?o.grid.backgroundColor:A(AT);AZ=K(AW).adjust(null,null,null,1).toString()}N.insert('<div class="flotr-legend-bg" style="position:absolute;width:'+AT.getWidth()+"px;height:"+AT.getHeight()+"px;"+Ab+"background-color:"+AZ+';"> </div>').select("div.flotr-legend-bg").first().setStyle({opacity:o.legend.backgroundOpacity})}}}}var AG={pageX:null,pageY:null};var b={first:{x:-1,y:-1},second:{x:-1,y:-1}};var T=null;var x=null;var t=false;var Q=null;function f(AT){if(t){t=false;return }var AU=AL.cumulativeOffset();N.fire("flotr:click",[{x:u.min+(AT.pageX-AU.left-l.left)/AC,y:c.max-(AT.pageY-AU.top-l.top)/AB}])}function e(AU){if(AU.pageX==null&&AU.clientX!=null){var AX=document.documentElement,AT=document.body;AG.pageX=AU.clientX+(AX&&AX.scrollLeft||AT.scrollLeft||0);AG.pageY=AU.clientY+(AX&&AX.scrollTop||AT.scrollTop||0)}else{AG.pageX=AU.pageX;AG.pageY=AU.pageY}var AV=AL.cumulativeOffset();var AW={x:u.min+(AU.pageX-AV.left-l.left)/AC,y:c.max-(AU.pageY-AV.top-l.top)/AB};if(o.mouse.track&&x==null){n(AW)}N.fire("flotr:mousemove",[AU,AW])}function r(AT){if(!AT.isLeftClick()){return }AM(b.first,AT);if(x!=null){clearInterval(x)}AG.pageX=null;x=setInterval(AJ,1000/o.selection.fps);$(document).observe("mouseup",O)}function a(){var AU=(b.first.x<=b.second.x)?b.first.x:b.second.x;var AT=(b.first.x<=b.second.x)?b.second.x:b.first.x;var AW=(b.first.y>=b.second.y)?b.first.y:b.second.y;var AV=(b.first.y>=b.second.y)?b.second.y:b.first.y;AU=u.min+AU/AC;AT=u.min+AT/AC;AW=c.max-AW/AB;AV=c.max-AV/AB;N.fire("flotr:select",[{x1:AU,y1:AW,x2:AT,y2:AV}])}function O(AT){$(document).stopObserving("mouseup",O);if(x!=null){clearInterval(x);x=null}AM(b.second,AT);M();if(W()||AT.isLeftClick()){X();a();t=true}Event.stop(AT)}function AM(AV,AT){var AU=$(AL).cumulativeOffset();if(o.selection.mode=="y"){AV.x=(AV==b.first)?0:P}else{AV.x=AT.pageX-AU.left-l.left;AV.x=Math.min(Math.max(0,AV.x),P)}if(o.selection.mode=="x"){AV.y=(AV==b.first)?0:AD}else{AV.y=AT.pageY-AU.top-l.top;AV.y=Math.min(Math.max(0,AV.y),AD)}}function AJ(){if(AG.pageX==null){return }AM(b.second,AG);M();if(W()){X()}}function M(){if(T==null){return }var AT=Math.min(T.first.x,T.second.x),AW=Math.min(T.first.y,T.second.y),AU=Math.abs(T.second.x-T.first.x),AV=Math.abs(T.second.y-T.first.y);AS.clearRect(AT+l.left-AS.lineWidth,AW+l.top-AS.lineWidth,AU+AS.lineWidth*2,AV+AS.lineWidth*2);T=null}function AF(AT){M();b.first.y=(o.selection.mode=="x")?0:(c.max-AT.y1)*AB;b.second.y=(o.selection.mode=="x")?AD:(c.max-AT.y2)*AB;b.first.x=(o.selection.mode=="y")?0:(AT.x1-u.min)*AC;b.second.x=(o.selection.mode=="y")?P:(AT.x2-u.min)*AC;X();a()}function X(){if(T!=null&&b.first.x==T.first.x&&b.first.y==T.first.y&&b.second.x==T.second.x&&b.second.y==T.second.y){return }AS.strokeStyle=K(o.selection.color).scale(null,null,null,0.8).toString();AS.lineWidth=1;h.lineJoin="round";AS.fillStyle=K(o.selection.color).scale(null,null,null,0.4).toString();T={first:{x:b.first.x,y:b.first.y},second:{x:b.second.x,y:b.second.y}};var AT=Math.min(b.first.x,b.second.x),AW=Math.min(b.first.y,b.second.y),AU=Math.abs(b.second.x-b.first.x),AV=Math.abs(b.second.y-b.first.y);AS.fillRect(AT+l.left,AW+l.top,AU,AV);AS.strokeRect(AT+l.left,AW+l.top,AU,AV)}function W(){var AT=5;return Math.abs(b.second.x-b.first.x)>=AT&&Math.abs(b.second.y-b.first.y)>=AT}function s(){if(Q){AS.clearRect(AE(Q.x)+l.left-o.points.radius*2,j(Q.y)+l.top-o.points.radius*2,o.points.radius*3+o.points.lineWidth*3,o.points.radius*3+o.points.lineWidth*3);Q=null}}function n(Ae){var AX={dist:Number.MAX_VALUE,x:null,y:null,mouse:null};for(var Ad=0,Ac,AZ,AV;Ad<R.length;Ad++){if(!R[Ad].mouse.track){continue}Ac=R[Ad].data;AZ=(AC*R[Ad].mouse.sensibility);AV=(AB*R[Ad].mouse.sensibility);for(var Aa=0,Af,Ab;Aa<Ac.length;Aa++){Af=AC*Math.abs(Ac[Aa][0]-Ae.x);Ab=AB*Math.abs(Ac[Aa][1]-Ae.y);if(Af<AZ&&Ab<AV&&(Af+Ab)<AX.dist){AX.dist=(Af+Ab);AX.x=Ac[Aa][0];AX.y=Ac[Aa][1];AX.mouse=R[Ad].mouse}}}if(AX.mouse&&AX.mouse.track&&!Q||(Q&&AX.x!=Q.x&&AX.y!=Q.y)){var AU=N.select(".flotr-mouse-value").first();if(!AU){var Ag="",AT=o.mouse.position,AY=o.mouse.margin;if(AT.charAt(0)=="n"){Ag+="top:"+(AY+l.top)+"px;"}else{if(AT.charAt(0)=="s"){Ag+="bottom:"+(AY+l.bottom)+"px;"}}if(AT.charAt(1)=="e"){Ag+="right:"+(AY+l.right)+"px;"}else{if(AT.charAt(1)=="w"){Ag+="left:"+(AY+l.bottom)+"px;"}}N.insert('<div class="flotr-mouse-value" style="opacity:0.7;background-color:#000;color:#fff;display:none;position:absolute;'+Ag+'"></div>');return }if(AX.x!==null&&AX.y!==null){AU.setStyle({display:"block"});s();if(AX.mouse.lineColor!=null){AS.save();AS.translate(l.left,l.top);AS.lineWidth=o.points.lineWidth;AS.strokeStyle=AX.mouse.lineColor;AS.fillStyle="#ffffff";AS.beginPath();AS.arc(AE(AX.x),j(AX.y),o.points.radius,0,2*Math.PI,true);AS.fill();AS.stroke();AS.restore()}Q=AX;var AW=AX.mouse.trackDecimals;if(AW==null||AW<0){AW=0}AU.innerHTML=AX.mouse.trackFormatter({x:AX.x.toFixed(AW),y:AX.y.toFixed(AW)});N.fire("flotr:hit",[AX])}else{if(Q){AU.setStyle({display:"none"});s()}}}}}return{clean:function(M){M.innerHTML=""},draw:function(P,N,M){var O=new J(P,N,M);return O}}})();
\ No newline at end of file diff --git a/tools/qtestlib/chart/3rdparty/prototype.js b/tools/qtestlib/chart/3rdparty/prototype.js new file mode 100644 index 0000000..e580ae5 --- /dev/null +++ b/tools/qtestlib/chart/3rdparty/prototype.js @@ -0,0 +1,8 @@ +/* Prototype JavaScript framework, version 1.6.0.2 + * (c) 2005-2008 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('G 1g={9D:\'1.6.0.2\',1W:{3X:!!(1A.7b&&!1A.9e),58:!!1A.9e,4u:5e.5d.47(\'hE/\')>-1,7H:5e.5d.47(\'7H\')>-1&&5e.5d.47(\'ch\')==-1,d5:!!5e.5d.1f(/hD.*hC.*ci/)},3U:{72:!!1b.2S,6H:!!1A.6G,7x:1b.43(\'1T\').4U&&1b.43(\'1T\').4U!==1b.43(\'1x\').4U},84:\'<4S[^>]*>([\\\\S\\\\s]*?)<\\/4S>\',cM:/^\\/\\*-hB-([\\s\\S]*)\\*\\/\\s*$/,3q:q(){},K:q(x){o x}};E(1g.1W.d5)1g.3U.7x=1r;G 2b={2p:q(){G 2T=1k,3k=$A(1p);E(M.2w(3k[0]))2T=3k.5i();q 1N(){C.2I.3R(C,1p)}M.15(1N,2b.1d);1N.9Z=2T;1N.d4=[];E(2T){G a0=q(){};a0.1l=2T.1l;1N.1l=1s a0;2T.d4.1h(1N)}17(G i=0;i<3k.O;i++)1N.6a(3k[i]);E(!1N.1l.2I)1N.1l.2I=1g.3q;1N.1l.hA=1N;o 1N}};2b.1d={6a:q(22){G 3b=C.9Z&&C.9Z.1l;G 3k=M.4b(22);E(!M.4b({2H:1u}).O)3k.1h("2H","d3");17(G i=0,O=3k.O;i<O;i++){G 1y=3k[i],I=22[1y];E(3b&&M.2w(I)&&I.d1().3K()=="$4d"){G 1F=I,I=M.15((q(m){o q(){o 3b[m].3R(C,1p)}})(1y).5g(1F),{d3:q(){o 1F},2H:q(){o 1F.2H()}})}C.1l[1y]=I}o C}};G 4Y={};M.15=q(5L,22){17(G 1y 1Q 22)5L[1y]=22[1y];o 5L};M.15(M,{2C:q(Y){2s{E(M.2D(Y))o\'4z\';E(Y===1k)o\'1k\';o Y.2C?Y.2C():24(Y)}2E(e){E(e d2 hz)o\'...\';4q e}},3D:q(Y){G 1B=3Z Y;5y(1B){2r\'4z\':2r\'q\':2r\'hy\':o;2r\'hx\':o Y.2H()}E(Y===1k)o\'1k\';E(Y.3D)o Y.3D();E(M.4j(Y))o;G V=[];17(G 1y 1Q Y){G I=M.3D(Y[1y]);E(!M.2D(I))V.1h(1y.3D()+\': \'+I)}o\'{\'+V.2o(\', \')+\'}\'},4r:q(Y){o $H(Y).4r()},4i:q(Y){o Y&&Y.4i?Y.4i():24.62(Y)},4b:q(Y){G 4b=[];17(G 1y 1Q Y)4b.1h(1y);o 4b},1S:q(Y){G 1S=[];17(G 1y 1Q Y)1S.1h(Y[1y]);o 1S},2A:q(Y){o M.15({},Y)},4j:q(Y){o Y&&Y.3r==1},4x:q(Y){o Y!=1k&&3Z Y=="Y"&&\'hw\'1Q Y&&\'2o\'1Q Y},9G:q(Y){o Y d2 3V},2w:q(Y){o 3Z Y=="q"},3f:q(Y){o 3Z Y=="3h"},53:q(Y){o 3Z Y=="4M"},2D:q(Y){o 3Z Y=="4z"}});M.15(9X.1l,{d1:q(){G 3A=C.2H().1f(/^[\\s\\(]*q[^(]*\\((.*?)\\)/)[1].49(",").7k("3T");o 3A.O==1&&!3A[0]?[]:3A},1L:q(){E(1p.O<2&&M.2D(1p[0]))o C;G 3n=C,21=$A(1p),Y=21.5i();o q(){o 3n.3R(Y,21.20($A(1p)))}},hv:q(){G 3n=C,21=$A(1p),Y=21.5i();o q(1c){o 3n.3R(Y,[1c||1A.1c].20(21))}},7T:q(){E(!1p.O)o C;G 3n=C,21=$A(1p);o q(){o 3n.3R(C,21.20($A(1p)))}},9l:q(){G 3n=C,21=$A(1p),d0=21.5i()*cY;o 1A.hu(q(){o 3n.3R(3n,21)},d0)},5g:q(1K){G 3n=C;o q(){o 1K.3R(C,[3n.1L(C)].20($A(1p)))}},4v:q(){E(C.9Y)o C.9Y;G 3n=C;o C.9Y=q(){o 3n.3R(1k,[C].20($A(1p)))}}});9X.1l.4s=9X.1l.9l.7T(0.ht);hs.1l.3D=q(){o\'"\'+C.hr()+\'-\'+(C.hq()+1).4L(2)+\'-\'+C.hp().4L(2)+\'T\'+C.ho().4L(2)+\':\'+C.hn().4L(2)+\':\'+C.hm().4L(2)+\'Z"\'};G cp={co:q(){G 7d;17(G i=0,O=1p.O;i<O;i++){G cZ=1p[i];2s{7d=cZ();2d}2E(e){}}o 7d}};4k.1l.1f=4k.1l.2L;4k.c3=q(68){o 24(68).1Y(/([.*+?^=!:${}()|[\\]\\/\\\\])/g,\'\\\\$1\')};G aB=2b.2p({2I:q(2X,4c){C.2X=2X;C.4c=4c;C.85=1r;C.6s()},6s:q(){C.3W=ae(C.6N.1L(C),C.4c*cY)},8t:q(){C.2X(C)},8p:q(){E(!C.3W)o;af(C.3W);C.3W=1k},6N:q(){E(!C.85){2s{C.85=1u;C.8t()}hl{C.85=1r}}}});M.15(24,{62:q(I){o I==1k?\'\':24(I)},cQ:{\'\\b\':\'\\\\b\',\'\\t\':\'\\\\t\',\'\\n\':\'\\\\n\',\'\\f\':\'\\\\f\',\'\\r\':\'\\\\r\',\'\\\\\':\'\\\\\\\\\'}});M.15(24.1l,{3m:q(28,3F){G 1q=\'\',22=C,1f;3F=1p.5v.9S(3F);1P(22.O>0){E(1f=22.1f(28)){1q+=22.3B(0,1f.1i);1q+=24.62(3F(1f));22=22.3B(1f.1i+1f[0].O)}1m{1q+=22,22=\'\'}}o 1q},cN:q(28,3F,3x){3F=C.3m.9S(3F);3x=M.2D(3x)?1:3x;o C.3m(28,q(1f){E(--3x<0)o 1f[0];o 3F(1f)})},aN:q(28,W){C.3m(28,W);o 24(C)},hk:q(O,69){O=O||30;69=M.2D(69)?\'...\':69;o C.O>O?C.3B(0,O-69.O)+69:24(C)},3T:q(){o C.1Y(/^\\s+/,\'\').1Y(/\\s+$/,\'\')},cS:q(){o C.1Y(/<\\/?[^>]+>/gi,\'\')},4h:q(){o C.1Y(1s 4k(1g.84,\'cX\'),\'\')},cT:q(){G cW=1s 4k(1g.84,\'cX\');G cU=1s 4k(1g.84,\'hj\');o(C.1f(cW)||[]).2M(q(cV){o(cV.1f(cU)||[\'\',\'\'])[1]})},59:q(){o C.cT().2M(q(4S){o 7u(4S)})},82:q(){G 5J=1p.5v;5J.3Y.7n=C;o 5J.1T.4C},cJ:q(){G 1T=1s J(\'1T\');1T.4C=C.cS();o 1T.3g[0]?(1T.3g.O>1?$A(1T.3g).3H(\'\',q(2O,L){o 2O+L.4f}):1T.3g[0].4f):\'\'},7g:q(cR){G 1f=C.3T().1f(/([^?#]*)(#.*)?$/);E(!1f)o{};o 1f[1].49(cR||\'&\').3H({},q(3w,1H){E((1H=1H.49(\'=\'))[0]){G 1w=9p(1H.5i());G I=1H.O>1?1H.2o(\'=\'):1H[0];E(I!=4z)I=9p(I);E(1w 1Q 3w){E(!M.4x(3w[1w]))3w[1w]=[3w[1w]];3w[1w].1h(I)}1m 3w[1w]=I}o 3w})},3E:q(){o C.49(\'\')},9I:q(){o C.3B(0,C.O-1)+24.hi(C.cP(C.O-1)+1)},7E:q(3x){o 3x<1?\'\':1s 2m(3x+1).2o(C)},95:q(){G 4N=C.49(\'-\'),9W=4N.O;E(9W==1)o 4N[0];G 9V=C.83(0)==\'-\'?4N[0].83(0).2R()+4N[0].5H(1):4N[0];17(G i=1;i<9W;i++)9V+=4N[i].83(0).2R()+4N[i].5H(1);o 9V},6F:q(){o C.83(0).2R()+C.5H(1).2e()},hh:q(){o C.3m(/::/,\'/\').3m(/([A-Z]+)([A-Z][a-z])/,\'#{1}6T#{2}\').3m(/([a-z\\d])([A-Z])/,\'#{1}6T#{2}\').3m(/-/,\'6T\').2e()},hg:q(){o C.3m(/6T/,\'-\')},2C:q(cO){G 9T=C.3m(/[\\hf-\\he\\\\]/,q(1f){G 9U=24.cQ[1f[0]];o 9U?9U:\'\\\\hd\'+1f[0].cP().4L(2,16)});E(cO)o\'"\'+9T.1Y(/"/g,\'\\\\"\')+\'"\';o"\'"+9T.1Y(/\'/g,\'\\\\\\\'\')+"\'"},3D:q(){o C.2C(1u)},9w:q(2h){o C.cN(2h||1g.cM,\'#{1}\')},cK:q(){G 68=C;E(68.4O())o 1r;68=C.1Y(/\\\\./g,\'@\').1Y(/"[^"\\\\\\n\\r]*"/g,\'\');o(/^[,:{}\\[\\]0-9.\\-+hc-u \\n\\r\\t]*$/).2L(68)},60:q(cL){G 3l=C.9w();2s{E(!cL||3l.cK())o 7u(\'(\'+3l+\')\')}2E(e){}4q 1s hb(\'ha h9 c4 3h: \'+C.2C())},1J:q(28){o C.47(28)>-1},8F:q(28){o C.47(28)===0},aO:q(28){G d=C.O-28.O;o d>=0&&C.9L(28)===d},5E:q(){o C==\'\'},4O:q(){o/^\\s*$/.2L(C)},cb:q(Y,28){o 1s 32(C,28).2S(Y)}});E(1g.1W.4u||1g.1W.3X)M.15(24.1l,{82:q(){o C.1Y(/&/g,\'&cI;\').1Y(/</g,\'&cH;\').1Y(/>/g,\'>\')},cJ:q(){o C.1Y(/&cI;/g,\'&\').1Y(/&cH;/g,\'<\').1Y(/>/g,\'>\')}});24.1l.3m.9S=q(3F){E(M.2w(3F))o 3F;G 67=1s 32(3F);o q(1f){o 67.2S(1f)}};24.1l.h8=24.1l.7g;M.15(24.1l.82,{1T:1b.43(\'1T\'),3Y:1b.bm(\'\')});b0(24.1l.82)1T.5O(3Y);G 32=2b.2p({2I:q(67,28){C.67=67.2H();C.28=28||32.cE},2S:q(Y){E(M.2w(Y.9J))Y=Y.9J();o C.67.3m(C.28,q(1f){E(Y==1k)o\'\';G 4R=1f[1]||\'\';E(4R==\'\\\\\')o 1f[2];G 6X=Y,6Y=1f[3];G 28=/^([^.[]+|\\[((?:.*?[^\\\\])?)\\])(\\.|\\[|$)/;1f=28.cF(6Y);E(1f==1k)o 4R;1P(1f!=1k){G cG=1f[1].8F(\'[\')?1f[2].3m(\'\\\\\\\\]\',\']\'):1f[1];6X=6X[cG];E(1k==6X||\'\'==1f[3])2d;6Y=6Y.5H(\'[\'==1f[3]?1f[1].O:1f[0].O);1f=28.cF(6Y)}o 4R+24.62(6X)})}});32.cE=/(^|.|\\r|\\n)(#\\{(.*?)\\})/;G $2d={};G 2G={1E:q(W,1M){G 1i=0;W=W.1L(1M);2s{C.48(q(I){W(I,1i++)})}2E(e){E(e!=$2d)4q e}o C},cD:q(4M,W,1M){W=W?W.1L(1M):1g.K;G 1i=-4M,9R=[],2F=C.3E();1P((1i+=4M)<2F.O)9R.1h(2F.3B(1i,1i+4M));o 9R.9N(W,1M)},88:q(W,1M){W=W?W.1L(1M):1g.K;G 1q=1u;C.1E(q(I,1i){1q=1q&&!!W(I,1i);E(!1q)4q $2d});o 1q},cB:q(W,1M){W=W?W.1L(1M):1g.K;G 1q=1r;C.1E(q(I,1i){E(1q=!!W(I,1i))4q $2d});o 1q},9N:q(W,1M){W=W?W.1L(1M):1g.K;G V=[];C.1E(q(I,1i){V.1h(W(I,1i))});o V},81:q(W,1M){W=W.1L(1M);G 1q;C.1E(q(I,1i){E(W(I,1i)){1q=I;4q $2d}});o 1q},5C:q(W,1M){W=W.1L(1M);G V=[];C.1E(q(I,1i){E(W(I,1i))V.1h(I)});o V},h7:q(2h,W,1M){W=W?W.1L(1M):1g.K;G V=[];E(M.3f(2h))2h=1s 4k(2h);C.1E(q(I,1i){E(2h.1f(I))V.1h(W(I,1i))});o V},1J:q(Y){E(M.2w(C.47))E(C.47(Y)!=-1)o 1u;G 9Q=1r;C.1E(q(I){E(I==Y){9Q=1u;4q $2d}});o 9Q},h6:q(4M,6W){6W=M.2D(6W)?1k:6W;o C.cD(4M,q(3B){1P(3B.O<4M)3B.1h(6W);o 3B})},3H:q(2O,W,1M){W=W.1L(1M);C.1E(q(I,1i){2O=W(2O,I,1i)});o 2O},7k:q(1F){G 21=$A(1p).3B(1);o C.2M(q(I){o I[1F].3R(I,21)})},h5:q(W,1M){W=W?W.1L(1M):1g.K;G 1q;C.1E(q(I,1i){I=W(I,1i);E(1q==1k||I>=1q)1q=I});o 1q},h4:q(W,1M){W=W?W.1L(1M):1g.K;G 1q;C.1E(q(I,1i){I=W(I,1i);E(1q==1k||I<1q)1q=I});o 1q},h3:q(W,1M){W=W?W.1L(1M):1g.K;G 9P=[],9O=[];C.1E(q(I,1i){(W(I,1i)?9P:9O).1h(I)});o[9P,9O]},5u:q(1y){G V=[];C.1E(q(I){V.1h(I[1y])});o V},h2:q(W,1M){W=W.1L(1M);G V=[];C.1E(q(I,1i){E(!W(I,1i))V.1h(I)});o V},aK:q(W,1M){W=W.1L(1M);o C.2M(q(I,1i){o{I:I,6D:W(I,1i)}}).h1(q(2x,5U){G a=2x.6D,b=5U.6D;o a<b?-1:a>b?1:0}).5u(\'I\')},3E:q(){o C.2M()},h0:q(){G W=1g.K,21=$A(1p);E(M.2w(21.2u()))W=21.gZ();G cC=[C].20(21).2M($A);o C.2M(q(I,1i){o W(cC.5u(1i))})},cw:q(){o C.3E().O},2C:q(){o\'#<2G:\'+C.3E().2C()+\'>\'}};M.15(2G,{2M:2G.9N,8l:2G.81,2z:2G.5C,2h:2G.5C,gY:2G.1J,gX:2G.3E,gW:2G.88,gV:2G.cB});q $A(3d){E(!3d)o[];E(3d.3E)o 3d.3E();G O=3d.O||0,V=1s 2m(O);1P(O--)V[O]=3d[O];o V}E(1g.1W.4u){$A=q(3d){E(!3d)o[];E(!(M.2w(3d)&&3d==\'[Y gU]\')&&3d.3E)o 3d.3E();G O=3d.O||0,V=1s 2m(O);1P(O--)V[O]=3d[O];o V}}2m.cr=$A;M.15(2m.1l,2G);E(!2m.1l.9M)2m.1l.9M=2m.1l.4e;M.15(2m.1l,{48:q(W){17(G i=0,O=C.O;i<O;i++)W(C[i])},aH:q(){C.O=0;o C},3K:q(){o C[0]},2u:q(){o C[C.O-1]},gT:q(){o C.2z(q(I){o I!=1k})},cA:q(){o C.3H([],q(2F,I){o 2F.20(M.4x(I)?I.cA():[I])})},6b:q(){G 1S=$A(1p);o C.2z(q(I){o!1S.1J(I)})},4e:q(cz){o(cz!==1r?C:C.3E()).9M()},gS:q(){o C.O>1?C:C[0]},cx:q(cy){o C.3H([],q(2F,I,1i){E(0==1i||(cy?2F.2u()!=I:!2F.1J(I)))2F.1h(I);o 2F})},gR:q(2F){o C.cx().5C(q(66){o 2F.81(q(I){o 66===I})})},2A:q(){o[].20(C)},cw:q(){o C.O},2C:q(){o\'[\'+C.2M(M.2C).2o(\', \')+\']\'},3D:q(){G V=[];C.1E(q(Y){G I=M.3D(Y);E(!M.2D(I))V.1h(I)});o\'[\'+V.2o(\', \')+\']\'}});E(M.2w(2m.1l.cv))2m.1l.48=2m.1l.cv;E(!2m.1l.47)2m.1l.47=q(66,i){i||(i=0);G O=C.O;E(i<0)i=O+i;17(;i<O;i++)E(C[i]===66)o i;o-1};E(!2m.1l.9L)2m.1l.9L=q(66,i){i=gQ(i)?C.O:(i<0?C.O+i:i)+1;G n=C.3B(0,i).4e().47(66);o(n<0)?n:i-n-1};2m.1l.3E=2m.1l.2A;q $w(3h){E(!M.3f(3h))o[];3h=3h.3T();o 3h?3h.49(/\\s+/):[]}E(1g.1W.58){2m.1l.20=q(){G 2F=[];17(G i=0,O=C.O;i<O;i++)2F.1h(C[i]);17(G i=0,O=1p.O;i<O;i++){E(M.4x(1p[i])){17(G j=0,cu=1p[i].O;j<cu;j++)2F.1h(1p[i][j])}1m{2F.1h(1p[i])}}o 2F}}M.15(54.1l,{gP:q(){o C.4L(2,16)},9I:q(){o C+1},7E:q(W){$R(0,C,1u).1E(W);o C},4L:q(O,ct){G 3h=C.2H(ct||10);o\'0\'.7E(O-3h.O)+3h},3D:q(){o gO(C)?C.2H():\'1k\'}});$w(\'gN gM gL gK\').1E(q(1F){54.1l[1F]=gJ[1F].4v()});q $H(Y){o 1s 3V(Y)};G 3V=2b.2p(2G,(q(){q 9K(1w,I){E(M.2D(I))o 1w;o 1w+\'=\'+cs(24.62(I))}o{2I:q(Y){C.4K=M.9G(Y)?Y.6U():M.2A(Y)},48:q(W){17(G 1w 1Q C.4K){G I=C.4K[1w],1H=[1w,I];1H.1w=1w;1H.I=I;W(1H)}},6c:q(1w,I){o C.4K[1w]=I},9F:q(1w){o C.4K[1w]},gI:q(1w){G I=C.4K[1w];8R C.4K[1w];o I},6U:q(){o M.2A(C.4K)},4b:q(){o C.5u(\'1w\')},1S:q(){o C.5u(\'I\')},1i:q(I){G 1f=C.81(q(1H){o 1H.I===I});o 1f&&1f.1w},gH:q(Y){o C.2A().5a(Y)},5a:q(Y){o 1s 3V(Y).3H(C,q(1q,1H){1q.6c(1H.1w,1H.I);o 1q})},4r:q(){o C.2M(q(1H){G 1w=cs(1H.1w),1S=1H.I;E(1S&&3Z 1S==\'Y\'){E(M.4x(1S))o 1S.2M(9K.7T(1w)).2o(\'&\')}o 9K(1w,1S)}).2o(\'&\')},2C:q(){o\'#<3V:{\'+C.2M(q(1H){o 1H.2M(M.2C).2o(\': \')}).2o(\', \')+\'}>\'},3D:q(){o M.3D(C.6U())},2A:q(){o 1s 3V(C)}}})());3V.1l.9J=3V.1l.6U;3V.cr=$H;G cq=2b.2p(2G,{2I:q(4l,5o,65){C.4l=4l;C.5o=5o;C.65=65},48:q(W){G I=C.4l;1P(C.1J(I)){W(I);I=I.9I()}},1J:q(I){E(I<C.4l)o 1r;E(C.65)o I<C.5o;o I<=C.5o}});G $R=q(4l,5o,65){o 1s cq(4l,5o,65)};G 1R={cj:q(){o cp.co(q(){o 1s cf()},q(){o 1s cm(\'gG.cl\')},q(){o 1s cm(\'gF.cl\')})||1r},9H:0};1R.63={6V:[],48:q(W){C.6V.48(W)},ck:q(4m){E(!C.1J(4m))C.6V.1h(4m)},gE:q(4m){C.6V=C.6V.6b(4m)},7X:q(2X,2Q,1Z,3l){C.1E(q(4m){E(M.2w(4m[2X])){2s{4m[2X].3R(4m,[2Q,1Z,3l])}2E(e){}}})}};M.15(1R.63,2G);1R.63.ck({80:q(){1R.9H++},3S:q(){1R.9H--}});1R.9m=2b.2p({2I:q(U){C.U={1F:\'6S\',7Z:1u,6R:\'7V/x-gD-1x-gC\',9C:\'gB-8\',3v:\'\',60:1u,9z:1u};M.15(C.U,U||{});C.U.1F=C.U.1F.2e();E(M.3f(C.U.3v))C.U.3v=C.U.3v.7g();1m E(M.9G(C.U.3v))C.U.3v=C.U.3v.6U()}});1R.50=2b.2p(1R.9m,{9A:1r,2I:q($4d,2U,U){$4d(U);C.1Z=1R.cj();C.2Q(2U)},2Q:q(2U){C.2U=2U;C.1F=C.U.1F;G 2Y=M.2A(C.U.3v);E(![\'9F\',\'6S\'].1J(C.1F)){2Y[\'gA\']=C.1F;C.1F=\'6S\'}C.3v=2Y;E(2Y=M.4r(2Y)){E(C.1F==\'9F\')C.2U+=(C.2U.1J(\'?\')?\'&\':\'?\')+2Y;1m E(/gz|ci|ch/.2L(5e.5d))2Y+=\'&6T=\'}2s{G 2y=1s 1R.9t(C);E(C.U.80)C.U.80(2y);1R.63.7X(\'80\',C,2y);C.1Z.gy(C.1F.2R(),C.2U,C.U.7Z);E(C.U.7Z)C.9B.1L(C).4s(1);C.1Z.77=C.9E.1L(C);C.cg();C.2q=C.1F==\'6S\'?(C.U.gx||2Y):1k;C.1Z.gw(C.2q);E(!C.U.7Z&&C.1Z.ce)C.9E()}2E(e){C.5m(e)}},9E:q(){G 2N=C.1Z.2N;E(2N>1&&!((2N==4)&&C.9A))C.9B(C.1Z.2N)},cg:q(){G 5n={\'X-gv-gu\':\'cf\',\'X-1g-9D\':1g.9D,\'gs\':\'3Y/gr, 3Y/7D, 7V/6P, 3Y/6P, */*\'};E(C.1F==\'6S\'){5n[\'9o-1B\']=C.U.6R+(C.U.9C?\'; gq=\'+C.U.9C:\'\');E(C.1Z.ce&&(5e.5d.1f(/7H\\/(\\d{4})/)||[0,cd])[1]<cd)5n[\'gp\']=\'go\'}E(3Z C.U.cc==\'Y\'){G 64=C.U.cc;E(M.2w(64.1h))17(G i=0,O=64.O;i<O;i+=2)5n[64[i]]=64[i+1];1m $H(64).1E(q(1H){5n[1H.1w]=1H.I})}17(G 1e 1Q 5n)C.1Z.gn(1e,5n[1e])},5l:q(){G 4J=C.6O();o!4J||(4J>=gm&&4J<gl)},6O:q(){2s{o C.1Z.4J||0}2E(e){o 0}},9B:q(2N){G 6Q=1R.50.c8[2N],2y=1s 1R.9t(C);E(6Q==\'9u\'){2s{C.9A=1u;(C.U[\'5t\'+2y.4J]||C.U[\'5t\'+(C.5l()?\'gk\':\'gj\')]||1g.3q)(2y,2y.7W)}2E(e){C.5m(e)}G 6R=2y.61(\'9o-1B\');E(C.U.9z==\'c1\'||(C.U.9z&&C.7U()&&6R&&6R.1f(/^\\s*(3Y|7V)\\/(x-)?(gh|gg)4S(;.*)?\\s*$/i)))C.ca()}2s{(C.U[\'5t\'+6Q]||1g.3q)(2y,2y.7W);1R.63.7X(\'5t\'+6Q,C,2y,2y.7W)}2E(e){C.5m(e)}E(6Q==\'9u\'){C.1Z.77=1g.3q}},7U:q(){G m=C.2U.1f(/^\\s*gf?:\\/\\/[^\\/]*/);o!m||(m[0]==\'#{9y}//#{9x}#{7Y}\'.cb({9y:7h.9y,9x:1b.9x,7Y:7h.7Y?\':\'+7h.7Y:\'\'}))},61:q(1e){2s{o C.1Z.9r(1e)||1k}2E(e){o 1k}},ca:q(){2s{o 7u((C.1Z.3c||\'\').9w())}2E(e){C.5m(e)}},5m:q(9v){(C.U.c9||1g.3q)(C,9v);1R.63.7X(\'c9\',C,9v)}});1R.50.c8=[\'ge\',\'gd\',\'gc\',\'gb\',\'9u\'];1R.9t=2b.2p({2I:q(2Q){C.2Q=2Q;G 1Z=C.1Z=2Q.1Z,2N=C.2N=1Z.2N;E((2N>2&&!1g.1W.3X)||2N==4){C.4J=C.6O();C.9s=C.c6();C.3c=24.62(1Z.3c);C.7W=C.c5()}E(2N==4){G 6P=1Z.c7;C.c7=M.2D(6P)?1k:6P;C.ga=C.c2()}},4J:0,9s:\'\',6O:1R.50.1l.6O,c6:q(){2s{o C.1Z.9s||\'\'}2E(e){o\'\'}},61:1R.50.1l.61,g9:q(){2s{o C.9q()}2E(e){o 1k}},9r:q(1e){o C.1Z.9r(1e)},9q:q(){o C.1Z.9q()},c5:q(){G 3l=C.61(\'X-c4\');E(!3l)o 1k;3l=9p(c3(3l));2s{o 3l.60(C.2Q.U.c0||!C.2Q.7U())}2E(e){C.2Q.5m(e)}},c2:q(){G U=C.2Q.U;E(!U.60||(U.60!=\'c1\'&&!(C.61(\'9o-1B\')||\'\').1J(\'7V/3l\'))||C.3c.4O())o 1k;2s{o C.3c.60(U.c0||!C.2Q.7U())}2E(e){C.2Q.5m(e)}}});1R.bW=2b.2p(1R.50,{2I:q($4d,3C,2U,U){C.3C={5l:(3C.5l||3C),9n:(3C.9n||(3C.5l?1k:3C))};U=M.2A(U);G 3S=U.3S;U.3S=(q(2y,3l){C.bZ(2y.3c);E(M.2w(3S))3S(2y,3l)}).1L(C);$4d(2U,U)},bZ:q(3c){G 5Z=C.3C[C.5l()?\'5l\':\'9n\'],U=C.U;E(!U.59)3c=3c.4h();E(5Z=$(5Z)){E(U.5k){E(M.3f(U.5k)){G 5k={};5k[U.5k]=3c;5Z.3o(5k)}1m U.5k(5Z,3c)}1m 5Z.5a(3c)}}});1R.g8=2b.2p(1R.9m,{2I:q($4d,3C,2U,U){$4d(U);C.3S=C.U.3S;C.4c=(C.U.4c||2);C.5j=(C.U.5j||1);C.9k={};C.3C=3C;C.2U=2U;C.4l()},4l:q(){C.U.3S=C.bY.1L(C);C.6N()},8p:q(){C.9k.U.3S=4z;g7(C.3W);(C.3S||1g.3q).3R(C,1p)},bY:q(2y){E(C.U.5j){C.5j=(2y.3c==C.bX?C.5j*C.U.5j:1);C.bX=2y.3c}C.3W=C.6N.1L(C).9l(C.5j*C.4c)},6N:q(){C.9k=1s 1R.bW(C.3C,C.2U,C.U)}});q $(k){E(1p.O>1){17(G i=0,1V=[],O=1p.O;i<O;i++)1V.1h($(1p[i]));o 1V}E(M.3f(k))k=1b.g6(k);o J.15(k)}E(1g.3U.72){1b.8a=q(1t,71){G V=[];G 9j=1b.2S(1t,$(71)||1b,1k,g5.g4,1k);17(G i=0,O=9j.g3;i<O;i++)V.1h(J.15(9j.g2(i)));o V}}E(!1A.6o)G 6o={};E(!6o.bV){M.15(6o,{bV:1,g1:2,au:3,g0:4,fZ:5,fY:6,fX:7,fW:8,fV:9,fU:10,fT:11,fS:12})}(q(){G k=C.J;C.J=q(1a,2l){2l=2l||{};1a=1a.2e();G 2P=J.2P;E(1g.1W.3X&&2l.1e){1a=\'<\'+1a+\' 1e="\'+2l.1e+\'">\';8R 2l.1e;o J.6M(1b.43(1a),2l)}E(!2P[1a])2P[1a]=J.15(1b.43(1a));o J.6M(2P[1a].fR(1r),2l)};M.15(C.J,k||{})}).8m(1A);J.2P={};J.1d={99:q(k){o $(k).14.3p!=\'7L\'},aa:q(k){k=$(k);J[J.99(k)?\'bU\':\'bT\'](k);o k},bU:q(k){$(k).14.3p=\'7L\';o k},bT:q(k){$(k).14.3p=\'\';o k},a1:q(k){k=$(k);k.1O.6I(k);o k},5a:q(k,18){k=$(k);E(18&&18.3s)18=18.3s();E(M.4j(18))o k.5a().3o(18);18=M.4i(18);k.4C=18.4h();18.59.1L(18).4s();o k},1Y:q(k,18){k=$(k);E(18&&18.3s)18=18.3s();1m E(!M.4j(18)){18=M.4i(18);G 9i=k.fQ.fP();9i.fO(k);18.59.1L(18).4s();18=9i.fN(18.4h())}k.1O.8Z(18,k);o k},3o:q(k,3Q){k=$(k);E(M.3f(3Q)||M.53(3Q)||M.4j(3Q)||(3Q&&(3Q.3s||3Q.4i)))3Q={4Q:3Q};G 18,3o,1a,3g;17(G 1v 1Q 3Q){18=3Q[1v];1v=1v.2e();3o=J.5M[1v];E(18&&18.3s)18=18.3s();E(M.4j(18)){3o(k,18);3G}18=M.4i(18);1a=((1v==\'4R\'||1v==\'75\')?k.1O:k).1a.2R();3g=J.7F(1a,18.4h());E(1v==\'2i\'||1v==\'75\')3g.4e();3g.1E(3o.7T(k));18.59.1L(18).4s()}o k},5g:q(k,1K,2l){k=$(k);E(M.4j(1K))$(1K).6M(2l||{});1m E(M.3f(1K))1K=1s J(1K,2l);1m 1K=1s J(\'1T\',1K);E(k.1O)k.1O.8Z(1K,k);1K.5O(k);o 1K},2C:q(k){k=$(k);G 1q=\'<\'+k.1a.2e();$H({\'1o\':\'1o\',\'1j\':\'6e\'}).1E(q(1H){G 1y=1H.3K(),1U=1H.2u();G I=(k[1y]||\'\').2H();E(I)1q+=\' \'+1U+\'=\'+I.2C(1u)});o 1q+\'>\'},7S:q(k,1y){k=$(k);G 1V=[];1P(k=k[1y])E(k.3r==1)1V.1h(J.15(k));o 1V},5x:q(k){o $(k).7S(\'1O\')},bR:q(k){o $(k).2z("*")},bS:q(k){k=$(k).5D;1P(k&&k.3r!=1)k=k.3M;o $(k)},br:q(k){E(!(k=$(k).5D))o[];1P(k&&k.3r!=1)k=k.3M;E(k)o[k].20($(k).4E());o[]},5Y:q(k){o $(k).7S(\'aY\')},4E:q(k){o $(k).7S(\'3M\')},fM:q(k){k=$(k);o k.5Y().4e().20(k.4E())},1f:q(k,41){E(M.3f(41))41=1s 19(41);o 41.1f($(k))},fL:q(k,1t,1i){k=$(k);E(1p.O==1)o $(k.1O);G 5x=k.5x();o M.53(1t)?5x[1t]:19.5w(5x,1t,1i)},fK:q(k,1t,1i){k=$(k);E(1p.O==1)o k.bS();o M.53(1t)?k.bR()[1t]:k.2z(1t)[1i||0]},fJ:q(k,1t,1i){k=$(k);E(1p.O==1)o $(19.25.6x(k));G 5Y=k.5Y();o M.53(1t)?5Y[1t]:19.5w(5Y,1t,1i)},6B:q(k,1t,1i){k=$(k);E(1p.O==1)o $(19.25.6w(k));G 4E=k.4E();o M.53(1t)?4E[1t]:19.5w(4E,1t,1i)},2z:q(){G 21=$A(1p),k=$(21.5i());o 19.7o(k,21)},55:q(){G 21=$A(1p),k=$(21.5i());o 19.7o(k.1O,21).6b(k)},bt:q(k){k=$(k);G 1o=k.51(\'1o\'),5J=1p.5v;E(1o)o 1o;do{1o=\'fI\'+5J.bs++}1P($(1o));k.6M(\'1o\',1o);o 1o},51:q(k,1e){k=$(k);E(1g.1W.3X){G t=J.3O.7I;E(t.1S[1e])o t.1S[1e](k,1e);E(t.3A[1e])1e=t.3A[1e];E(1e.1J(\':\')){o(!k.2l||!k.2l[1e])?1k:k.2l[1e].I}}o k.91(1e)},6M:q(k,1e,I){k=$(k);G 2l={},t=J.3O.6l;E(3Z 1e==\'Y\')2l=1e;1m 2l[1e]=M.2D(I)?1u:I;17(G 29 1Q 2l){1e=t.3A[29]||29;I=2l[29];E(t.1S[29])1e=t.1S[29](k,I);E(I===1r||I===1k)k.8D(1e);1m E(I===1u)k.bQ(1e,1e);1m k.bQ(1e,I)}o k},b5:q(k){o $(k).5I().3a},b6:q(k){o $(k).5I().2g},6d:q(k){o 1s J.6Z(k)},7s:q(k,1j){E(!(k=$(k)))o;G 7R=k.1j;o(7R.O>0&&(7R==1j||1s 4k("(^|\\\\s)"+1j+"(\\\\s|$)").2L(7R)))},bO:q(k,1j){E(!(k=$(k)))o;E(!k.7s(1j))k.1j+=(k.1j?\' \':\'\')+1j;o k},bP:q(k,1j){E(!(k=$(k)))o;k.1j=k.1j.1Y(1s 4k("(^|\\\\s+)"+1j+"(\\\\s+|$)"),\' \').3T();o k},fH:q(k,1j){E(!(k=$(k)))o;o k[k.7s(1j)?\'bP\':\'bO\'](1j)},fG:q(k){k=$(k);G L=k.5D;1P(L){G bN=L.3M;E(L.3r==3&&!/\\S/.2L(L.4f))k.6I(L);L=bN}o k},5E:q(k){o $(k).4C.4O()},76:q(k,3b){k=$(k),3b=$(3b);G bL=3b;E(k.bM)o(k.bM(3b)&8)===8;E(k.6L&&!1g.1W.58){G e=k.6L,a=3b.6L,5X=3b.3M;E(!5X){do{3b=3b.1O}1P(!(5X=3b.3M)&&3b.1O)}E(5X&&5X.6L)o(e>a&&e<5X.6L)}1P(k=k.1O)E(k==bL)o 1u;o 1r},bK:q(k){k=$(k);G 5W=k.4P();1A.bK(5W[0],5W[1]);o k},2a:q(k,14){k=$(k);14=14==\'97\'?\'7N\':14.95();G I=k.14[14];E(!I){G 9h=1b.fF.fE(k,1k);I=9h?9h[14]:1k}E(14==\'3P\')o I?5R(I):1.0;o I==\'7M\'?1k:I},fD:q(k){o $(k).2a(\'3P\')},5S:q(k,4I){k=$(k);G 9g=k.14,1f;E(M.3f(4I)){k.14.90+=\';\'+4I;o 4I.1J(\'3P\')?k.5Q(4I.1f(/3P:\\s*(\\d?\\.?\\d*)/)[1]):k}17(G 1y 1Q 4I)E(1y==\'3P\')k.5Q(4I[1y]);1m 9g[(1y==\'97\'||1y==\'7N\')?(M.2D(9g.96)?\'7N\':\'96\'):1y]=4I[1y];o k},5Q:q(k,I){k=$(k);k.14.3P=(I==1||I===\'\')?\'\':(I<0.7G)?0:I;o k},5I:q(k){k=$(k);G 3p=$(k).2a(\'3p\');E(3p!=\'7L\'&&3p!=1k)o{2g:k.5q,3a:k.5r};G 44=k.14;G bH=44.9f;G bI=44.1v;G bJ=44.3p;44.9f=\'7j\';44.1v=\'5P\';44.3p=\'fC\';G bG=k.bE;G bF=k.bD;44.3p=bJ;44.1v=bI;44.9f=bH;o{2g:bG,3a:bF}},fB:q(k){k=$(k);G 5W=J.2a(k,\'1v\');E(5W==\'5T\'||!5W){k.9d=1u;k.14.1v=\'6K\';E(1A.9e){k.14.2i=0;k.14.2x=0}}o k},fA:q(k){k=$(k);E(k.9d){k.9d=4z;k.14.1v=k.14.2i=k.14.2x=k.14.4Q=k.14.5U=\'\'}o k},fz:q(k){k=$(k);E(k.5h)o k;k.5h=J.2a(k,\'9c\')||\'7M\';E(k.5h!==\'7j\')k.14.9c=\'7j\';o k},fy:q(k){k=$(k);E(!k.5h)o k;k.14.9c=k.5h==\'7M\'?\'\':k.5h;k.5h=1k;o k},4P:q(k){G 2J=0,2K=0;do{2J+=k.5c||0;2K+=k.5b||0;k=k.3e}1P(k);o J.57(2K,2J)},6h:q(k){G 2J=0,2K=0;do{2J+=k.5c||0;2K+=k.5b||0;k=k.3e;E(k){E(k.1a==\'by\')2d;G p=J.2a(k,\'1v\');E(p!==\'5T\')2d}}1P(k);o J.57(2K,2J)},8g:q(k){k=$(k);E(k.2a(\'1v\')==\'5P\')o;G 9b=k.6h();G 2i=9b[1];G 2x=9b[0];G 2g=k.bE;G 3a=k.bD;k.bB=2x-5R(k.14.2x||0);k.bC=2i-5R(k.14.2i||0);k.bz=k.14.2g;k.bA=k.14.3a;k.14.1v=\'5P\';k.14.2i=2i+\'3i\';k.14.2x=2x+\'3i\';k.14.2g=2g+\'3i\';k.14.3a=3a+\'3i\';o k},8d:q(k){k=$(k);E(k.2a(\'1v\')==\'6K\')o;k.14.1v=\'6K\';G 2i=5R(k.14.2i||0)-(k.bC||0);G 2x=5R(k.14.2x||0)-(k.bB||0);k.14.2i=2i+\'3i\';k.14.2x=2x+\'3i\';k.14.3a=k.bA;k.14.2g=k.bz;o k},8c:q(k){G 2J=0,2K=0;do{2J+=k.4n||0;2K+=k.4p||0;k=k.1O}1P(k);o J.57(2K,2J)},5p:q(k){E(k.3e)o $(k.3e);E(k==1b.2q)o $(k);1P((k=k.1O)&&k!=1b.2q)E(J.2a(k,\'1v\')!=\'5T\')o $(k);o $(1b.2q)},6g:q(9a){G 2J=0,2K=0;G k=9a;do{2J+=k.5c||0;2K+=k.5b||0;E(k.3e==1b.2q&&J.2a(k,\'1v\')==\'5P\')2d}1P(k=k.3e);k=9a;do{E(!1g.1W.58||k.1a==\'by\'){2J-=k.4n||0;2K-=k.4p||0}}1P(k=k.1O);o J.57(2K,2J)},a3:q(k,22){G U=M.15({bx:1u,bw:1u,bv:1u,bu:1u,5c:0,5b:0},1p[2]||{});22=$(22);G p=22.6g();k=$(k);G 5V=[0,0];G 2T=1k;E(J.2a(k,\'1v\')==\'5P\'){2T=k.5p();5V=2T.6g()}E(2T==1b.2q){5V[0]-=1b.2q.5b;5V[1]-=1b.2q.5c}E(U.bx)k.14.2x=(p[0]-5V[0]+U.5b)+\'3i\';E(U.bw)k.14.2i=(p[1]-5V[1]+U.5c)+\'3i\';E(U.bv)k.14.2g=22.5q+\'3i\';E(U.bu)k.14.3a=22.5r+\'3i\';o k}};J.1d.bt.bs=1;M.15(J.1d,{fx:J.1d.2z,fw:J.1d.br});J.3O={6l:{3A:{1j:\'6e\',bo:\'17\'},1S:{}}};E(1g.1W.58){J.1d.2a=J.1d.2a.5g(q(3j,k,14){5y(14){2r\'2x\':2r\'2i\':2r\'5U\':2r\'4Q\':E(3j(k,\'1v\')===\'5T\')o 1k;2r\'3a\':2r\'2g\':E(!J.99(k))o 1k;G 7O=bq(3j(k,14),10);E(7O!==k[\'2V\'+14.6F()])o 7O+\'3i\';G 3k;E(14===\'3a\'){3k=[\'7P-2i-2g\',\'7Q-2i\',\'7Q-4Q\',\'7P-4Q-2g\']}1m{3k=[\'7P-2x-2g\',\'7Q-2x\',\'7Q-5U\',\'7P-5U-2g\']}o 3k.3H(7O,q(2O,1y){G 98=3j(k,1y);o 98===1k?2O:2O-bq(98,10)})+\'3i\';6p:o 3j(k,14)}});J.1d.51=J.1d.51.5g(q(3j,k,1U){E(1U===\'7K\')o k.7K;o 3j(k,1U)})}1m E(1g.1W.3X){J.1d.5p=J.1d.5p.5g(q(3j,k){k=$(k);G 1v=k.2a(\'1v\');E(1v!==\'5T\')o 3j(k);k.5S({1v:\'6K\'});G I=3j(k);k.5S({1v:1v});o I});$w(\'6h 6g\').1E(q(1F){J.1d[1F]=J.1d[1F].5g(q(3j,k){k=$(k);G 1v=k.2a(\'1v\');E(1v!==\'5T\')o 3j(k);G 3e=k.5p();E(3e&&3e.2a(\'1v\')===\'fv\')3e.5S({94:1});k.5S({1v:\'6K\'});G I=3j(k);k.5S({1v:1v});o I})});J.1d.2a=q(k,14){k=$(k);14=(14==\'97\'||14==\'7N\')?\'96\':14.95();G I=k.14[14];E(!I&&k.5f)I=k.5f[14];E(14==\'3P\'){E(I=(k.2a(\'2h\')||\'\').1f(/92\\(3P=(.*)\\)/))E(I[1])o 5R(I[1])/bp;o 1.0}E(I==\'7M\'){E((14==\'2g\'||14==\'3a\')&&(k.2a(\'3p\')!=\'7L\'))o k[\'2V\'+14.6F()]+\'3i\';o 1k}o I};J.1d.5Q=q(k,I){q 93(2h){o 2h.1Y(/92\\([^\\)]*\\)/gi,\'\')}k=$(k);G 5f=k.5f;E((5f&&!5f.fu)||(!5f&&k.14.94==\'ft\'))k.14.94=1;G 2h=k.2a(\'2h\'),14=k.14;E(I==1||I===\'\'){(2h=93(2h))?14.2h=2h:14.8D(\'2h\');o k}1m E(I<0.7G)I=0;14.2h=93(2h)+\'92(3P=\'+(I*bp)+\')\';o k};J.3O={7I:{3A:{\'6e\':\'1j\',\'17\':\'bo\'},1S:{7J:q(k,1U){o k.91(1U,2)},bn:q(k,1U){G L=k.bj(1U);o L?L.I:""},2k:q(k,1U){1U=k.91(1U);o 1U?1U.2H().3B(23,-2):1k},6J:q(k,1U){o $(k).3I(1U)?1U:1k},14:q(k){o k.14.90.2e()},7K:q(k){o k.7K}}}};J.3O.6l={3A:M.15({fs:\'fr\',fq:\'fp\'},J.3O.7I.3A),1S:{3J:q(k,I){k.3J=!!I},14:q(k,I){k.14.90=I?I:\'\'}}};J.3O.8X={};$w(\'fo fn fm fl fk 7i \'+\'fj fi fh fg\').1E(q(29){J.3O.6l.3A[29.2e()]=29;J.3O.8X[29.2e()]=29});(q(v){M.15(v,{aI:v.7J,ad:v.7J,1B:v.7J,5B:v.bn,3u:v.6J,3J:v.6J,ff:v.6J,fe:v.6J,fd:v.2k,ao:v.2k,fc:v.2k,fb:v.2k,fa:v.2k,f9:v.2k,f8:v.2k,f7:v.2k,f6:v.2k,f5:v.2k,f4:v.2k,f3:v.2k,f2:v.2k,f1:v.2k,f0:v.2k,eZ:v.2k,eY:v.2k,eX:v.2k})})(J.3O.7I.1S)}1m E(1g.1W.7H&&/eW:1\\.8\\.0/.2L(5e.5d)){J.1d.5Q=q(k,I){k=$(k);k.14.3P=(I==1)?0.eV:(I===\'\')?\'\':(I<0.7G)?0:I;o k}}1m E(1g.1W.4u){J.1d.5Q=q(k,I){k=$(k);k.14.3P=(I==1||I===\'\')?\'\':(I<0.7G)?0:I;E(I==1)E(k.1a==\'bf\'&&k.2g){k.2g++;k.2g--}1m 2s{G n=1b.bm(\' \');k.5O(n);k.6I(n)}2E(e){}o k};J.1d.4P=q(k){G 2J=0,2K=0;do{2J+=k.5c||0;2K+=k.5b||0;E(k.3e==1b.2q)E(J.2a(k,\'1v\')==\'5P\')2d;k=k.3e}1P(k);o J.57(2K,2J)}}E(1g.1W.3X||1g.1W.58){J.1d.5a=q(k,18){k=$(k);E(18&&18.3s)18=18.3s();E(M.4j(18))o k.5a().3o(18);18=M.4i(18);G 1a=k.1a.2R();E(1a 1Q J.5M.4G){$A(k.3g).1E(q(L){k.6I(L)});J.7F(1a,18.4h()).1E(q(L){k.5O(L)})}1m k.4C=18.4h();18.59.1L(18).4s();o k}}E(\'bl\'1Q 1b.43(\'1T\')){J.1d.1Y=q(k,18){k=$(k);E(18&&18.3s)18=18.3s();E(M.4j(18)){k.1O.8Z(18,k);o k}18=M.4i(18);G 2T=k.1O,1a=2T.1a.2R();E(J.5M.4G[1a]){G 3M=k.6B();G 8Y=J.7F(1a,18.4h());2T.6I(k);E(3M)8Y.1E(q(L){2T.7C(L,3M)});1m 8Y.1E(q(L){2T.5O(L)})}1m k.bl=18.4h();18.59.1L(18).4s();o k}}J.57=q(l,t){G 1q=[l,t];1q.2x=l;1q.2i=t;o 1q};J.7F=q(1a,7D){G 1T=1s J(\'1T\'),t=J.5M.4G[1a];E(t){1T.4C=t[0]+7D+t[1];t[2].7E(q(){1T=1T.5D})}1m 1T.4C=7D;o $A(1T.3g)};J.5M={4R:q(k,L){k.1O.7C(L,k)},2i:q(k,L){k.7C(L,k.5D)},4Q:q(k,L){k.5O(L)},75:q(k,L){k.1O.7C(L,k.3M)},4G:{eU:[\'<4H>\',\'</4H>\',1],7z:[\'<4H><5N>\',\'</5N></4H>\',2],bb:[\'<4H><5N><7B>\',\'</7B></5N></4H>\',3],8V:[\'<4H><5N><7B><bk>\',\'</bk></7B></5N></4H>\',4],bi:[\'<2z>\',\'</2z>\',1]}};(q(){M.15(C.4G,{bd:C.4G.7z,bc:C.4G.7z,ba:C.4G.8V})}).8m(J.5M);J.1d.7y={3I:q(k,1U){1U=J.3O.8X[1U]||1U;G L=$(k).bj(1U);o L&&L.eT}};J.1d.3z={};M.15(J,J.1d);E(!1g.3U.6H&&1b.43(\'1T\').4U){1A.6G={};1A.6G.1l=1b.43(\'1T\').4U;1g.3U.6H=1u}J.15=(q(){E(1g.3U.7x)o 1g.K;G 1d={},3z=J.1d.3z;G 15=M.15(q(k){E(!k||k.7c||k.3r!=1||k==1A)o k;G 2B=M.2A(1d),1a=k.1a,1y,I;E(3z[1a])M.15(2B,3z[1a]);17(1y 1Q 2B){I=2B[1y];E(M.2w(I)&&!(1y 1Q k))k[1y]=I.4v()}k.7c=1g.3q;o k},{7v:q(){E(!1g.3U.6H){M.15(1d,J.1d);M.15(1d,J.1d.7y)}}});15.7v();o 15})();J.3I=q(k,1U){E(k.3I)o k.3I(1U);o J.1d.7y.3I(k,1U)};J.6a=q(2B){G F=1g.3U,T=J.1d.3z;E(!2B){M.15(1C,1C.1d);M.15(1C.J,1C.J.1d);M.15(J.1d.3z,{"eS":M.2A(1C.1d),"eR":M.2A(1C.J.1d),"bi":M.2A(1C.J.1d),"bh":M.2A(1C.J.1d)})}E(1p.O==2){G 1a=2B;2B=1p[1]}E(!1a)M.15(J.1d,2B||{});1m{E(M.4x(1a))1a.1E(15);1m 15(1a)}q 15(1a){1a=1a.2R();E(!J.1d.3z[1a])J.1d.3z[1a]={};M.15(J.1d.3z[1a],2B)}q 7w(2B,5L,7A){7A=7A||1r;17(G 1y 1Q 2B){G I=2B[1y];E(!M.2w(I))3G;E(!7A||!(1y 1Q 5L))5L[1y]=I.4v()}}q b8(1a){G 1N;G 8U={"eQ":"eP","bh":"eO","P":"eN","eM":"eL","eK":"eJ","eI":"eH","eG":"eF","eE":"eD","eC":"5K","eB":"5K","eA":"5K","ez":"5K","ey":"5K","ex":"5K","Q":"ew","ev":"bg","eu":"bg","A":"et","bf":"es","er":"eq","ep":"be","eo":"be","bd":"8W","bc":"8W","7z":"8W","bb":"em","ba":"b9","8V":"b9","el":"ek","ej":"ei"};E(8U[1a])1N=\'8T\'+8U[1a]+\'J\';E(1A[1N])o 1A[1N];1N=\'8T\'+1a+\'J\';E(1A[1N])o 1A[1N];1N=\'8T\'+1a.6F()+\'J\';E(1A[1N])o 1A[1N];1A[1N]={};1A[1N].1l=1b.43(1a).4U;o 1A[1N]}E(F.6H){7w(J.1d,6G.1l);7w(J.1d.7y,6G.1l,1u)}E(F.7x){17(G 8S 1Q J.1d.3z){G 1N=b8(8S);E(M.2D(1N))3G;7w(T[8S],1N.1l)}}M.15(J,J.1d);8R J.3z;E(J.15.7v)J.15.7v();J.2P={}};1b.eh={5I:q(){G 8Q={};G B=1g.1W;$w(\'2g 3a\').1E(q(d){G D=d.6F();8Q[d]=(B.4u&&!1b.2S)?5J[\'eg\'+D]:(B.58)?1b.2q[\'b7\'+D]:1b.4o[\'b7\'+D]});o 8Q},b6:q(){o C.5I().2g},b5:q(){o C.5I().3a},ef:q(){o J.57(1A.a9||1b.4o.4p||1b.2q.4p,1A.a8||1b.4o.4n||1b.2q.4n)}};G 19=2b.2p({2I:q(1t){C.1t=1t.3T();C.b4()},b3:q(){E(!1g.3U.72)o 1r;G e=C.1t;E(1g.1W.4u&&(e.1J("-2t-1B")||e.1J(":5E")))o 1r;E((/(\\[[\\w-]*?:|:3J)/).2L(C.1t))o 1r;o 1u},b4:q(){E(C.b3())o C.b2();G e=C.1t,4g=19.6C,h=19.25,c=19.6D,3y,p,m;E(19.56[e]){C.3N=19.56[e];o}C.3N=["C.3N = q(1n) {","G r = 1n, h = 19.25, c = 1r, n;"];1P(e&&3y!=e&&(/\\S/).2L(e)){3y=e;17(G i 1Q 4g){p=4g[i];E(m=e.1f(p)){C.3N.1h(M.2w(c[i])?c[i](m):1s 32(c[i]).2S(m));e=e.1Y(m[0],\'\');2d}}}C.3N.1h("o h.8E(n);\\n}");7u(C.3N.2o(\'\\n\'));19.56[C.1t]=C.3N},b2:q(){G e=C.1t,4g=19.6C,x=19.2v,3y,m;E(19.56[e]){C.2v=19.56[e];o}C.3N=[\'.//*\'];1P(e&&3y!=e&&(/\\S/).2L(e)){3y=e;17(G i 1Q 4g){E(m=e.1f(4g[i])){C.3N.1h(M.2w(x[i])?x[i](m):1s 32(x[i]).2S(m));e=e.1Y(m[0],\'\');2d}}}C.2v=C.3N.2o(\'\');19.56[C.1t]=C.2v},7p:q(1n){1n=1n||1b;E(C.2v)o 1b.8a(C.2v,1n);o C.3N(1n)},1f:q(k){C.8P=[];G e=C.1t,4g=19.6C,as=19.8J;G 3y,p,m;1P(e&&3y!==e&&(/\\S/).2L(e)){3y=e;17(G i 1Q 4g){p=4g[i];E(m=e.1f(p)){E(as[i]){C.8P.1h([i,M.2A(m)]);e=e.1Y(m[0],\'\')}1m{o C.7p(1b).1J(k)}}}}G 1f=1u,1e,2j;17(G i=0,7t;7t=C.8P[i];i++){1e=7t[0],2j=7t[1];E(!19.8J[1e](k,2j)){1f=1r;2d}}o 1f},2H:q(){o C.1t},2C:q(){o"#<19:"+C.1t.2C()+">"}});M.15(19,{56:{},2v:{4D:"//*",1G:"/*",55:"/6E-4F::*[1]",6A:\'/6E-4F::*\',1a:q(m){E(m[1]==\'*\')o\'\';o"[b1-1e()=\'"+m[1].2e()+"\' 8O b1-1e()=\'"+m[1].2R()+"\']"},1j:"[6f(20(\' \', @6e, \' \'), \' #{1} \')]",1o:"[@1o=\'#{1}\']",5F:q(m){m[1]=m[1].2e();o 1s 32("[@#{1}]").2S(m)},29:q(m){m[1]=m[1].2e();m[3]=m[5]||m[6];o 1s 32(19.2v.6t[m[2]]).2S(m)},6y:q(m){G h=19.2v.2f[m[1]];E(!h)o\'\';E(M.2w(h))o h(m);o 1s 32(19.2v.2f[m[1]]).2S(m)},6t:{\'=\':"[@#{1}=\'#{3}\']",\'!=\':"[@#{1}!=\'#{3}\']",\'^=\':"[ee-b0(@#{1}, \'#{3}\')]",\'$=\':"[5H(@#{1}, (3h-O(@#{1}) - 3h-O(\'#{3}\') + 1))=\'#{3}\']",\'*=\':"[6f(@#{1}, \'#{3}\')]",\'~=\':"[6f(20(\' \', @#{1}, \' \'), \' #{3} \')]",\'|=\':"[6f(20(\'-\', @#{1}, \'-\'), \'-#{3}-\')]"},2f:{\'3K-1G\':\'[4B(8M-4F::*)]\',\'2u-1G\':\'[4B(6E-4F::*)]\',\'6v-1G\':\'[4B(8M-4F::* 8O 6E-4F::*)]\',\'5E\':"[3x(*) = 0 8L (3x(3Y()) = 0 8O ed(3Y(), \' \\t\\r\\n\', \'\') = \'\')]",\'3J\':"[@3J]",\'3u\':"[@3u]",\'aP\':"[4B(@3u)]",\'4B\':q(m){G e=m[6],p=19.6C,x=19.2v,3y,v;G 8N=[];1P(e&&3y!=e&&(/\\S/).2L(e)){3y=e;17(G i 1Q p){E(m=e.1f(p[i])){v=M.2w(x[i])?x[i](m):1s 32(x[i]).2S(m);8N.1h("("+v.5H(1,v.O-1)+")");e=e.1Y(m[0],\'\');2d}}}o"[4B("+8N.2o(" 8L ")+")]"},\'1X-1G\':q(m){o 19.2v.2f.1X("(3x(./8M-4F::*) + 1) ",m)},\'1X-2u-1G\':q(m){o 19.2v.2f.1X("(3x(./6E-4F::*) + 1) ",m)},\'1X-2t-1B\':q(m){o 19.2v.2f.1X("1v() ",m)},\'1X-2u-2t-1B\':q(m){o 19.2v.2f.1X("(2u() + 1 - 1v()) ",m)},\'3K-2t-1B\':q(m){m[6]="1";o 19.2v.2f[\'1X-2t-1B\'](m)},\'2u-2t-1B\':q(m){m[6]="1";o 19.2v.2f[\'1X-2u-2t-1B\'](m)},\'6v-2t-1B\':q(m){G p=19.2v.2f;o p[\'3K-2t-1B\'](m)+p[\'2u-2t-1B\'](m)},1X:q(5G,m){G 42,1I=m[6],8K;E(1I==\'aS\')1I=\'2n+0\';E(1I==\'aR\')1I=\'2n+1\';E(42=1I.1f(/^(\\d+)$/))o\'[\'+5G+"= "+42[1]+\']\';E(42=1I.1f(/^(-?\\d*)?n(([+-])(\\d+))?/)){E(42[1]=="-")42[1]=-1;G a=42[1]?54(42[1]):1;G b=42[2]?54(42[2]):0;8K="[((#{5G} - #{b}) ec #{a} = 0) 8L "+"((#{5G} - #{b}) 1T #{a} >= 0)]";o 1s 32(8K).2S({5G:5G,a:a,b:b})}}}},6D:{1a:\'n = h.1a(n, r, "#{1}", c); c = 1r;\',1j:\'n = h.1j(n, r, "#{1}", c); c = 1r;\',1o:\'n = h.1o(n, r, "#{1}", c); c = 1r;\',5F:\'n = h.5F(n, r, "#{1}", c); c = 1r;\',29:q(m){m[3]=(m[5]||m[6]);o 1s 32(\'n = h.29(n, r, "#{1}", "#{3}", "#{2}", c); c = 1r;\').2S(m)},6y:q(m){E(m[6])m[6]=m[6].1Y(/"/g,\'\\\\"\');o 1s 32(\'n = h.6y(n, "#{1}", "#{6}", r, c); c = 1r;\').2S(m)},4D:\'c = "4D";\',1G:\'c = "1G";\',55:\'c = "55";\',6A:\'c = "6A";\'},6C:{6A:/^\\s*~\\s*/,1G:/^\\s*>\\s*/,55:/^\\s*\\+\\s*/,4D:/^\\s/,1a:/^\\s*(\\*|[\\w\\-]+)(\\b|$)?/,1o:/^#([\\w\\-\\*]+)(\\b|$)/,1j:/^\\.([\\w\\-\\*]+)(\\b|$)/,6y:/^:((3K|2u|1X|1X-2u|6v)(-1G|-2t-1B)|5E|3J|(en|eb)ea|4B)(\\((.*?)\\))?(\\b|$|(?=\\s|[:+~>]))/,5F:/^\\[([\\w]+)\\]/,29:/\\[((?:[\\w-]*:)?[\\w-]+)\\s*(?:([!^$*~|]?=)\\s*(([\'"])([^\\4]*?)\\4|([^\'"][^\\]]*?)))?\\]/},8J:{1a:q(k,2j){o 2j[1].2R()==k.1a.2R()},1j:q(k,2j){o J.7s(k,2j[1])},1o:q(k,2j){o k.1o===2j[1]},5F:q(k,2j){o J.3I(k,2j[1])},29:q(k,2j){G 4f=J.51(k,2j[1]);o 4f&&19.6t[2j[2]](4f,2j[5]||2j[6])}},25:{20:q(a,b){17(G i=0,L;L=b[i];i++)a.1h(L);o a},7q:q(N){G aZ=1g.3q;17(G i=0,L;L=N[i];i++)L.3L=aZ;o N},52:q(N){17(G i=0,L;L=N[i];i++)L.3L=4z;o N},1i:q(1O,4e,6u){1O.3L=1g.3q;E(4e){17(G N=1O.3g,i=N.O-1,j=1;i>=0;i--){G L=N[i];E(L.3r==1&&(!6u||L.3L))L.7r=j++}}1m{17(G i=0,j=1,N=1O.3g;L=N[i];i++)E(L.3r==1&&(!6u||L.3L))L.7r=j++}},8E:q(N){E(N.O==0)o N;G V=[],n;17(G i=0,l=N.O;i<l;i++)E(!(n=N[i]).3L){n.3L=1g.3q;V.1h(J.15(n))}o 19.25.52(V)},4D:q(N){G h=19.25;17(G i=0,V=[],L;L=N[i];i++)h.20(V,L.4a(\'*\'));o V},1G:q(N){G h=19.25;17(G i=0,V=[],L;L=N[i];i++){17(G j=0,1G;1G=L.3g[j];j++)E(1G.3r==1&&1G.1a!=\'!\')V.1h(1G)}o V},55:q(N){17(G i=0,V=[],L;L=N[i];i++){G 6B=C.6w(L);E(6B)V.1h(6B)}o V},6A:q(N){G h=19.25;17(G i=0,V=[],L;L=N[i];i++)h.20(V,J.4E(L));o V},6w:q(L){1P(L=L.3M)E(L.3r==1)o L;o 1k},6x:q(L){1P(L=L.aY)E(L.3r==1)o L;o 1k},1a:q(N,1n,1a,26){G aX=1a.2R();G V=[],h=19.25;E(N){E(26){E(26=="4D"){17(G i=0,L;L=N[i];i++)h.20(V,L.4a(1a));o V}1m N=C[26](N);E(1a=="*")o N}17(G i=0,L;L=N[i];i++)E(L.1a.2R()===aX)V.1h(L);o V}1m o 1n.4a(1a)},1o:q(N,1n,1o,26){G 31=$(1o),h=19.25;E(!31)o[];E(!N&&1n==1b)o[31];E(N){E(26){E(26==\'1G\'){17(G i=0,L;L=N[i];i++)E(31.1O==L)o[31]}1m E(26==\'4D\'){17(G i=0,L;L=N[i];i++)E(J.76(31,L))o[31]}1m E(26==\'55\'){17(G i=0,L;L=N[i];i++)E(19.25.6x(31)==L)o[31]}1m N=h[26](N)}17(G i=0,L;L=N[i];i++)E(L==31)o[31];o[]}o(31&&J.76(31,1n))?[31]:[]},1j:q(N,1n,1j,26){E(N&&26)N=C[26](N);o 19.25.aW(N,1n,1j)},aW:q(N,1n,1j){E(!N)N=19.25.4D([1n]);G aV=\' \'+1j+\' \';17(G i=0,V=[],L,6z;L=N[i];i++){6z=L.1j;E(6z.O==0)3G;E(6z==1j||(\' \'+6z+\' \').1J(aV))V.1h(L)}o V},5F:q(N,1n,29,26){E(!N)N=1n.4a("*");E(N&&26)N=C[26](N);G V=[];17(G i=0,L;L=N[i];i++)E(J.3I(L,29))V.1h(L);o V},29:q(N,1n,29,I,aU,26){E(!N)N=1n.4a("*");E(N&&26)N=C[26](N);G 2c=19.6t[aU],V=[];17(G i=0,L;L=N[i];i++){G 4f=J.51(L,29);E(4f===1k)3G;E(2c(4f,I))V.1h(L)}o V},6y:q(N,1e,I,1n,26){E(N&&26)N=C[26](N);E(!N)N=1n.4a("*");o 19.2f[1e](N,I,1n)}},2f:{\'3K-1G\':q(N,I,1n){17(G i=0,V=[],L;L=N[i];i++){E(19.25.6x(L))3G;V.1h(L)}o V},\'2u-1G\':q(N,I,1n){17(G i=0,V=[],L;L=N[i];i++){E(19.25.6w(L))3G;V.1h(L)}o V},\'6v-1G\':q(N,I,1n){G h=19.25;17(G i=0,V=[],L;L=N[i];i++)E(!h.6x(L)&&!h.6w(L))V.1h(L);o V},\'1X-1G\':q(N,1I,1n){o 19.2f.1X(N,1I,1n)},\'1X-2u-1G\':q(N,1I,1n){o 19.2f.1X(N,1I,1n,1u)},\'1X-2t-1B\':q(N,1I,1n){o 19.2f.1X(N,1I,1n,1r,1u)},\'1X-2u-2t-1B\':q(N,1I,1n){o 19.2f.1X(N,1I,1n,1u,1u)},\'3K-2t-1B\':q(N,1I,1n){o 19.2f.1X(N,"1",1n,1r,1u)},\'2u-2t-1B\':q(N,1I,1n){o 19.2f.1X(N,"1",1n,1u,1u)},\'6v-2t-1B\':q(N,1I,1n){G p=19.2f;o p[\'2u-2t-1B\'](p[\'3K-2t-1B\'](N,1I,1n),1I,1n)},aQ:q(a,b,aT){E(a==0)o b>0?[b]:[];o $R(1,aT).3H([],q(2O,i){E(0==(i-b)%a&&(i-b)/a>=0)2O.1h(i);o 2O})},1X:q(N,1I,1n,4e,6u){E(N.O==0)o[];E(1I==\'aS\')1I=\'2n+0\';E(1I==\'aR\')1I=\'2n+1\';G h=19.25,V=[],8H=[],m;h.7q(N);17(G i=0,L;L=N[i];i++){E(!L.1O.3L){h.1i(L.1O,4e,6u);8H.1h(L.1O)}}E(1I.1f(/^\\d+$/)){1I=54(1I);17(G i=0,L;L=N[i];i++)E(L.7r==1I)V.1h(L)}1m E(m=1I.1f(/^(-?\\d*)?n(([+-])(\\d+))?/)){E(m[1]=="-")m[1]=-1;G a=m[1]?54(m[1]):1;G b=m[2]?54(m[2]):0;G 8I=19.2f.aQ(a,b,N.O);17(G i=0,L,l=8I.O;L=N[i];i++){17(G j=0;j<l;j++)E(L.7r==8I[j])V.1h(L)}}h.52(N);h.52(8H);o V},\'5E\':q(N,I,1n){17(G i=0,V=[],L;L=N[i];i++){E(L.1a==\'!\'||(L.5D&&!L.4C.1f(/^\\s*$/)))3G;V.1h(L)}o V},\'4B\':q(N,41,1n){G h=19.25,e9,m;G 8G=1s 19(41).7p(1n);h.7q(8G);17(G i=0,V=[],L;L=N[i];i++)E(!L.3L)V.1h(L);h.52(8G);o V},\'aP\':q(N,I,1n){17(G i=0,V=[],L;L=N[i];i++)E(!L.3u)V.1h(L);o V},\'3u\':q(N,I,1n){17(G i=0,V=[],L;L=N[i];i++)E(L.3u)V.1h(L);o V},\'3J\':q(N,I,1n){17(G i=0,V=[],L;L=N[i];i++)E(L.3J)V.1h(L);o V}},6t:{\'=\':q(2Z,v){o 2Z==v},\'!=\':q(2Z,v){o 2Z!=v},\'^=\':q(2Z,v){o 2Z.8F(v)},\'$=\':q(2Z,v){o 2Z.aO(v)},\'*=\':q(2Z,v){o 2Z.1J(v)},\'~=\':q(2Z,v){o(\' \'+2Z+\' \').1J(\' \'+v+\' \')},\'|=\':q(2Z,v){o(\'-\'+2Z.2R()+\'-\').1J(\'-\'+v.2R()+\'-\')}},49:q(1t){G 4A=[];1t.aN(/(([\\w#:.~>+()\\s-]+|\\*|\\[.*?\\])+)\\s*(,|$)/,q(m){4A.1h(m[1].3T())});o 4A},aM:q(1V,1t){G 2j=$$(1t),h=19.25;h.7q(2j);17(G i=0,V=[],k;k=1V[i];i++)E(k.3L)V.1h(k);h.52(2j);o V},5w:q(1V,1t,1i){E(M.53(1t)){1i=1t;1t=1r}o 19.aM(1V,1t||\'*\')[1i||0]},7o:q(k,4A){4A=19.49(4A.2o(\',\'));G V=[],h=19.25;17(G i=0,l=4A.O,41;i<l;i++){41=1s 19(4A[i].3T());h.20(V,41.7p(k))}o(l>1)?h.8E(V):V}});E(1g.1W.3X){M.15(19.25,{20:q(a,b){17(G i=0,L;L=b[i];i++)E(L.1a!=="!")a.1h(L);o a},52:q(N){17(G i=0,L;L=N[i];i++)L.8D(\'3L\');o N}})}q $$(){o 19.7o(1b,$A(1p))}G 1C={8y:q(1x){$(1x).8y();o 1x},aL:q(1V,U){E(3Z U!=\'Y\')U={3w:!!U};1m E(M.2D(U.3w))U.3w=1u;G 1w,I,8C=1r,4Z=U.4Z;G 7n=1V.3H({},q(1q,k){E(!k.3u&&k.1e){1w=k.1e;I=$(k).2W();E(I!=1k&&(k.1B!=\'4Z\'||(!8C&&4Z!==1r&&(!4Z||1w==4Z)&&(8C=1u)))){E(1w 1Q 1q){E(!M.4x(1q[1w]))1q[1w]=[1q[1w]];1q[1w].1h(I)}1m 1q[1w]=I}}o 1q});o U.3w?7n:M.4r(7n)}};1C.1d={6q:q(1x,U){o 1C.aL(1C.5z(1x),U)},5z:q(1x){o $A($(1x).4a(\'*\')).3H([],q(1V,1G){E(1C.J.5A[1G.1a.2e()])1V.1h(J.15(1G));o 1V})},e8:q(1x,7l,1e){1x=$(1x);G 7m=1x.4a(\'4y\');E(!7l&&!1e)o $A(7m).2M(J.15);17(G i=0,8B=[],O=7m.O;i<O;i++){G 4y=7m[i];E((7l&&4y.1B!=7l)||(1e&&4y.1e!=1e))3G;8B.1h(J.15(4y))}o 8B},8x:q(1x){1x=$(1x);1C.5z(1x).7k(\'8x\');o 1x},8w:q(1x){1x=$(1x);1C.5z(1x).7k(\'8w\');o 1x},aJ:q(1x){G 1V=$(1x).5z().5C(q(k){o\'7j\'!=k.1B&&!k.3u});G 8A=1V.5C(q(k){o k.3I(\'7i\')&&k.7i>=0}).aK(q(k){o k.7i}).3K();o 8A?8A:1V.8l(q(k){o[\'4y\',\'2z\',\'8v\'].1J(k.1a.2e())})},e7:q(1x){1x=$(1x);1x.aJ().aG();o 1x},2Q:q(1x,U){1x=$(1x),U=M.2A(U||{});G 2Y=U.3v,5B=1x.51(\'5B\')||\'\';E(5B.4O())5B=1A.7h.aI;U.3v=1x.6q(1u);E(2Y){E(M.3f(2Y))2Y=2Y.7g();M.15(U.3v,2Y)}E(1x.3I(\'1F\')&&!U.1F)U.1F=1x.1F;o 1s 1R.50(5B,U)}};1C.J={8z:q(k){$(k).8z();o k},2z:q(k){$(k).2z();o k}};1C.J.1d={6q:q(k){k=$(k);E(!k.3u&&k.1e){G I=k.2W();E(I!=4z){G 1H={};1H[k.1e]=I;o M.4r(1H)}}o\'\'},2W:q(k){k=$(k);G 1F=k.1a.2e();o 1C.J.5A[1F](k)},e6:q(k,I){k=$(k);G 1F=k.1a.2e();1C.J.5A[1F](k,I);o k},aH:q(k){$(k).I=\'\';o k},e5:q(k){o $(k).I!=\'\'},aG:q(k){k=$(k);2s{k.8z();E(k.2z&&(k.1a.2e()!=\'4y\'||![\'8q\',\'8y\',\'4Z\'].1J(k.1B)))k.2z()}2E(e){}o k},8x:q(k){k=$(k);k.e4();k.3u=1u;o k},8w:q(k){k=$(k);k.3u=1r;o k}};G e3=1C.J;G $F=1C.J.1d.2W;1C.J.5A={4y:q(k,I){5y(k.1B.2e()){2r\'ay\':2r\'ax\':o 1C.J.5A.aF(k,I);6p:o 1C.J.5A.8v(k,I)}},aF:q(k,I){E(M.2D(I))o k.3J?k.I:1k;1m k.3J=!!I},8v:q(k,I){E(M.2D(I))o k.I;1m k.I=I},2z:q(k,1i){E(M.2D(1i))o C[k.1B==\'2z-e2\'?\'aD\':\'aC\'](k);1m{G 3t,I,aE=!M.4x(1i);17(G i=0,O=k.O;i<O;i++){3t=k.U[i];I=C.7f(3t);E(aE){E(I==1i){3t.8u=1u;o}}1m 3t.8u=1i.1J(I)}}},aD:q(k){G 1i=k.e1;o 1i>=0?C.7f(k.U[1i]):1k},aC:q(k){G 1S,O=k.O;E(!O)o 1k;17(G i=0,1S=[];i<O;i++){G 3t=k.U[i];E(3t.8u)1S.1h(C.7f(3t))}o 1S},7f:q(3t){o J.15(3t).3I(\'I\')?3t.I:3t.3Y}};4Y.8s=2b.2p(aB,{2I:q($4d,k,4c,2X){$4d(2X,4c);C.k=$(k);C.4w=C.2W()},8t:q(){G I=C.2W();E(M.3f(C.4w)&&M.3f(I)?C.4w!=I:24(C.4w)!=24(I)){C.2X(C.k,I);C.4w=I}}});1C.J.aA=2b.2p(4Y.8s,{2W:q(){o 1C.J.2W(C.k)}});1C.aA=2b.2p(4Y.8s,{2W:q(){o 1C.6q(C.k)}});4Y.6r=2b.2p({2I:q(k,2X){C.k=$(k);C.2X=2X;C.4w=C.2W();E(C.k.1a.2e()==\'1x\')C.az();1m C.6s(C.k)},8r:q(){G I=C.2W();E(C.4w!=I){C.2X(C.k,I);C.4w=I}},az:q(){1C.5z(C.k).1E(C.6s,C)},6s:q(k){E(k.1B){5y(k.1B.2e()){2r\'ay\':2r\'ax\':1D.4t(k,\'e0\',C.8r.1L(C));2d;6p:1D.4t(k,\'dZ\',C.8r.1L(C));2d}}}});1C.J.6r=2b.2p(4Y.6r,{2W:q(){o 1C.J.2W(C.k)}});1C.6r=2b.2p(4Y.6r,{2W:q(){o 1C.6q(C.k)}});E(!1A.1D)G 1D={};M.15(1D,{dY:8,dX:9,dW:13,dV:27,dU:37,dT:38,dS:39,dR:40,dQ:46,dP:36,dO:35,dN:33,dM:34,dL:45,2P:{},8o:q(1c){G k;5y(1c.1B){2r\'dK\':k=1c.dJ;2d;2r\'dI\':k=1c.3s;2d;6p:o 1k}o J.15(k)}});1D.1d=(q(){G 4W;E(1g.1W.3X){G aw={0:1,1:4,2:2};4W=q(1c,4X){o 1c.8q==aw[4X]}}1m E(1g.1W.4u){4W=q(1c,4X){5y(4X){2r 0:o 1c.7e==1&&!1c.av;2r 1:o 1c.7e==1&&1c.av;6p:o 1r}}}1m{4W=q(1c,4X){o 1c.7e?(1c.7e===4X+1):(1c.8q===4X)}}o{dH:q(1c){o 4W(1c,0)},dG:q(1c){o 4W(1c,1)},dF:q(1c){o 4W(1c,2)},k:q(1c){G L=1D.15(1c).73;o J.15(L.3r==6o.au?L.1O:L)},5w:q(1c,1t){G k=1D.k(1c);E(!1t)o k;G 1V=[k].20(k.5x());o 19.5w(1V,1t,0)},4V:q(1c){o{x:1c.aq||(1c.dE+(1b.4o.4p||1b.2q.4p)),y:1c.ap||(1c.dD+(1b.4o.4n||1b.2q.4n))}},dC:q(1c){o 1D.4V(1c).x},dB:q(1c){o 1D.4V(1c).y},8p:q(1c){1D.15(1c);1c.ar();1c.at();1c.dA=1u}}})();1D.15=(q(){G 2B=M.4b(1D.1d).3H({},q(m,1e){m[1e]=1D.1d[1e].4v();o m});E(1g.1W.3X){M.15(2B,{at:q(){C.dz=1u},ar:q(){C.7d=1r},2C:q(){o"[Y 1D]"}});o q(1c){E(!1c)o 1r;E(1c.7c)o 1c;1c.7c=1g.3q;G 4V=1D.4V(1c);M.15(1c,{73:1c.dy,8o:1D.8o(1c),aq:4V.x,ap:4V.y});o M.15(1c,2B)}}1m{1D.1l=1D.1l||1b.6n("aj").4U;M.15(1D.1l,2B);o 1g.K}})();M.15(1D,(q(){G 2P=1D.2P;q 8k(k){E(k.8n)o k.8n[0];1p.5v.1o=1p.5v.1o||1;o k.8n=[++1p.5v.1o]}q 8j(1z){E(1z&&1z.1J(\':\'))o"ai";o 1z}q 79(1o){o 2P[1o]=2P[1o]||{}}q 7a(1o,1z){G c=79(1o);o c[1z]=c[1z]||[]}q am(k,1z,2c){G 1o=8k(k);G c=7a(1o,1z);E(c.5u("2c").1J(2c))o 1r;G 1K=q(1c){E(!1D||!1D.15||(1c.1z&&1c.1z!=1z))o 1r;1D.15(1c);2c.8m(k,1c)};1K.2c=2c;c.1h(1K);o 1K}q 8i(1o,1z,2c){G c=7a(1o,1z);o c.8l(q(1K){o 1K.2c==2c})}q ak(1o,1z,2c){G c=79(1o);E(!c[1z])o 1r;c[1z]=c[1z].6b(8i(1o,1z,2c))}q an(){17(G 1o 1Q 2P)17(G 1z 1Q 2P[1o])2P[1o][1z]=1k}E(1A.7b){1A.7b("ao",an)}o{4t:q(k,1z,2c){k=$(k);G 1e=8j(1z);G 1K=am(k,1z,2c);E(!1K)o k;E(k.78){k.78(1e,1K,1r)}1m{k.7b("5t"+1e,1K)}o k},4T:q(k,1z,2c){k=$(k);G 1o=8k(k),1e=8j(1z);E(!2c&&1z){7a(1o,1z).1E(q(1K){k.4T(1z,1K.2c)});o k}1m E(!1z){M.4b(79(1o)).1E(q(1z){k.4T(1z)});o k}G 1K=8i(1o,1z,2c);E(!1K)o k;E(k.al){k.al(1e,1K,1r)}1m{k.dx("5t"+1e,1K)}ak(1o,1z,2c);o k},5s:q(k,1z,2O){k=$(k);E(k==1b&&1b.6n&&!k.ah)k=1b.4o;G 1c;E(1b.6n){1c=1b.6n("aj");1c.dw("ai",1u,1u)}1m{1c=1b.dv();1c.ag="du"}1c.1z=1z;1c.2O=2O||{};E(1b.6n){k.ah(1c)}1m{k.dt(1c.ag,1c)}o 1D.15(1c)}}})());M.15(1D,1D.1d);J.6a({5s:1D.5s,4t:1D.4t,4T:1D.4T});M.15(1b,{5s:J.1d.5s.4v(),4t:J.1d.4t.4v(),4T:J.1d.4T.4v(),6m:1r});(q(){G 3W;q 6k(){E(1b.6m)o;E(3W)1A.af(3W);1b.5s("ds:6m");1b.6m=1u}E(1b.78){E(1g.1W.4u){3W=1A.ae(q(){E(/6m|ab/.2L(1b.2N))6k()},0);1D.4t(1A,"dr",6k)}1m{1b.78("dq",6k,1r)}}1m{1b.6l("<4S 1o=ac 4s ad=//:><\\/4S>");$("ac").77=q(){E(C.2N=="ab"){C.77=1k;6k()}}}})();3V.4r=M.4r;G dp={3p:J.aa};J.1d.dn=J.1d.76;G dm={dl:q(k,18){o J.3o(k,{4R:18})},dk:q(k,18){o J.3o(k,{2i:18})},dj:q(k,18){o J.3o(k,{4Q:18})},di:q(k,18){o J.3o(k,{75:18})}};G $3G=1s dh(\'"4q $3G" dg df, de "o" dd\');G 8f={a7:1r,8e:q(){C.a5=1A.a9||1b.4o.4p||1b.2q.4p||0;C.a4=1A.a8||1b.4o.4n||1b.2q.4n||0},dc:q(k,x,y){E(C.a7)o C.a6(k,x,y);C.6i=x;C.6j=y;C.2V=J.4P(k);o(y>=C.2V[1]&&y<C.2V[1]+k.5r&&x>=C.2V[0]&&x<C.2V[0]+k.5q)},a6:q(k,x,y){G 8h=J.8c(k);C.6i=x+8h[0]-C.a5;C.6j=y+8h[1]-C.a4;C.2V=J.4P(k);o(C.6j>=C.2V[1]&&C.6j<C.2V[1]+k.5r&&C.6i>=C.2V[0]&&C.6i<C.2V[0]+k.5q)},db:q(74,k){E(!74)o 0;E(74==\'da\')o((C.2V[1]+k.5r)-C.6j)/k.5r;E(74==\'d9\')o((C.2V[0]+k.5q)-C.6i)/k.5q},4P:J.1d.4P,6h:J.1d.6h,8g:q(k){8f.8e();o J.8g(k)},8d:q(k){8f.8e();o J.8d(k)},d8:J.1d.8c,3e:J.1d.5p,d7:J.1d.6g,2A:q(22,73,U){U=U||{};o J.a3(73,22,U)}};E(!1b.70)1b.70=q(a2){q 8b(1e){o 1e.4O()?1k:"[6f(20(\' \', @6e, \' \'), \' "+1e+" \')]"}a2.70=1g.3U.72?q(k,1j){1j=1j.2H().3T();G 89=/\\s/.2L(1j)?$w(1j).2M(8b).2o(\'\'):8b(1j);o 89?1b.8a(\'.//*\'+89,k):[]}:q(k,1j){1j=1j.2H().3T();G 1V=[],6d=(/\\s/.2L(1j)?$w(1j):1k);E(!6d&&!1j)o 1V;G N=$(k).4a(\'*\');1j=\' \'+1j+\' \';17(G i=0,1G,cn;1G=N[i];i++){E(1G.1j&&(cn=\' \'+1G.1j+\' \')&&(cn.1J(1j)||(6d&&6d.88(q(1e){o!1e.2H().4O()&&cn.1J(\' \'+1e+\' \')}))))1V.1h(J.15(1G))}o 1V};o q(1j,71){o $(71||1b.2q).70(1j)}}(J.1d);J.6Z=2b.2p();J.6Z.1l={2I:q(k){C.k=$(k)},48:q(W){C.k.1j.49(/\\s+/).2z(q(1e){o 1e.O>0}).48(W)},6c:q(1j){C.k.1j=1j},d6:q(87){E(C.1J(87))o;C.6c($A(C).20(87).2o(\' \'))},a1:q(86){E(!C.1J(86))o;C.6c($A(C).6b(86).2o(\' \'))},2H:q(){o $A(C).2o(\' \')}};M.15(J.6Z.1l,2G);J.6a();',62,1095,'||||||||||||||||||||element||||return||function||||||||||||this||if||var||value|Element||node|Object|nodes|length||||||options|results|iterator||object||||||style|extend||for|content|Selector|tagName|document|event|Methods|name|match|Prototype|push|index|className|null|prototype|else|root|id|arguments|result|false|new|expression|true|position|key|form|property|eventName|window|type|Form|Event|each|method|child|pair|formula|include|wrapper|bind|context|klass|parentNode|while|in|Ajax|values|div|attribute|elements|Browser|nth|replace|transport|concat|args|source||String|handlers|combinator||pattern|attr|getStyle|Class|handler|break|toLowerCase|pseudos|width|filter|top|matches|_getEv|attributes|Array||join|create|body|case|try|of|last|xpath|isFunction|left|response|select|clone|methods|inspect|isUndefined|catch|array|Enumerable|toString|initialize|valueT|valueL|test|map|readyState|memo|cache|request|toUpperCase|evaluate|parent|url|offset|getValue|callback|params|nv||targetNode|Template||||||||height|ancestor|responseText|iterable|offsetParent|isString|childNodes|string|px|proceed|properties|json|gsub|__method|insert|display|emptyFunction|nodeType|toElement|opt|disabled|parameters|hash|count|le|ByTag|names|slice|container|toJSON|toArray|replacement|continue|inject|hasAttribute|checked|first|_countedByPrototype|nextSibling|matcher|_attributeTranslations|opacity|insertions|apply|onComplete|strip|BrowserFeatures|Hash|timer|IE|text|typeof||selector|mm|createElement|els|||indexOf|_each|split|getElementsByTagName|keys|frequency|super|reverse|nodeValue|ps|stripScripts|toHTML|isElement|RegExp|start|responder|scrollTop|documentElement|scrollLeft|throw|toQueryString|defer|observe|WebKit|methodize|lastValue|isArray|input|undefined|expressions|not|innerHTML|descendant|nextSiblings|sibling|tags|table|styles|status|_object|toPaddedString|number|parts|blank|cumulativeOffset|bottom|before|script|stopObserving|__proto__|pointer|isButton|code|Abstract|submit|Request|readAttribute|unmark|isNumber|Number|adjacent|_cache|_returnOffset|Opera|evalScripts|update|offsetLeft|offsetTop|userAgent|navigator|currentStyle|wrap|_overflow|shift|decay|insertion|success|dispatchException|headers|end|getOffsetParent|offsetWidth|offsetHeight|fire|on|pluck|callee|findElement|ancestors|switch|getElements|Serializers|action|findAll|firstChild|empty|attrPresence|fragment|substring|getDimensions|self|Heading|destination|_insertionTranslations|tbody|appendChild|absolute|setOpacity|parseFloat|setStyle|static|right|delta|pos|nextAncestor|previousSiblings|receiver|evalJSON|getHeader|interpret|Responders|extras|exclusive|item|template|str|truncation|addMethods|without|set|classNames|class|contains|viewportOffset|positionedOffset|xcomp|ycomp|fireContentLoadedEvent|write|loaded|createEvent|Node|default|serialize|EventObserver|registerCallback|operators|ofType|only|nextElementSibling|previousElementSibling|pseudo|nodeClassName|laterSibling|next|patterns|criteria|following|capitalize|HTMLElement|ElementExtensions|removeChild|_flag|relative|sourceIndex|writeAttribute|onTimerEvent|getStatus|xml|state|contentType|post|_|toObject|responders|fillWith|ctx|expr|ClassNames|getElementsByClassName|parentElement|XPath|target|mode|after|descendantOf|onreadystatechange|addEventListener|getCacheForID|getWrappersForEventName|attachEvent|_extendedByPrototype|returnValue|which|optionValue|toQueryParams|location|tabIndex|hidden|invoke|typeName|inputs|data|findChildElements|findElements|mark|nodeIndex|hasClassName|token|eval|refresh|copy|SpecificElementExtensions|Simulated|TBODY|onlyIfAbsent|tr|insertBefore|html|times|_getContentFromAnonymousElement|00001|Gecko|read|_getAttr|title|none|auto|cssFloat|dim|border|padding|elementClassName|recursivelyCollect|curry|isSameOrigin|application|headerJSON|dispatch|port|asynchronous|onCreate|detect|escapeHTML|charAt|ScriptFragment|currentlyExecuting|classNameToRemove|classNameToAdd|all|cond|_getElementsByXPath|iter|cumulativeScrollOffset|relativize|prepare|Position|absolutize|offsetcache|findWrapper|getDOMEventName|getEventID|find|call|_prototypeEventID|relatedTarget|stop|button|onElementEvent|TimedObserver|execute|selected|textarea|enable|disable|reset|focus|firstByIndex|matchingInputs|submitted|removeAttribute|unique|startsWith|exclusions|indexed|indices|assertions|predicate|and|preceding|exclusion|or|tokens|dimensions|delete|tag|HTML|trans|TD|TableSection|has|fragments|replaceChild|cssText|getAttribute|alpha|stripAlpha|zoom|camelize|styleFloat|float|val|visible|forElement|offsets|overflow|_madePositioned|opera|visibility|elementStyle|css|range|query|updater|delay|Base|failure|Content|decodeURIComponent|getAllResponseHeaders|getResponseHeader|statusText|Response|Complete|exception|unfilterJSON|domain|protocol|evalJS|_complete|respondToReadyState|encoding|Version|onStateChange|get|isHash|activeRequestCount|succ|toTemplateReplacements|toQueryPair|lastIndexOf|_reverse|collect|falses|trues|found|slices|prepareReplacement|escapedString|character|camelized|len|Function|_methodized|superclass|subclass|remove|instanceMethods|clonePosition|deltaY|deltaX|withinIncludingScrolloffsets|includeScrollOffsets|pageYOffset|pageXOffset|toggle|complete|__onDOMContentLoaded|src|setInterval|clearInterval|eventType|dispatchEvent|dataavailable|HTMLEvents|destroyWrapper|removeEventListener|createWrapper|destroyCache|onunload|pageY|pageX|preventDefault||stopPropagation|TEXT_NODE|metaKey|buttonMap|radio|checkbox|registerFormCallbacks|Observer|PeriodicalExecuter|selectMany|selectOne|single|inputSelector|activate|clear|href|findFirstElement|sortBy|serializeElements|matchElements|scan|endsWith|enabled|getIndices|odd|even|total|operator|needle|byClassName|uTagName|previousSibling|_true|with|local|compileXPathMatcher|shouldUseXPath|compileMatcher|getHeight|getWidth|client|findDOMClass|TableCell|TH|TR|TFOOT|THEAD|TableCol|IMG|Mod|TEXTAREA|SELECT|getAttributeNode|td|outerHTML|createTextNode|_getAttrNode|htmlFor|100|parseInt|immediateDescendants|counter|identify|setHeight|setWidth|setTop|setLeft|BODY|_originalWidth|_originalHeight|_originalLeft|_originalTop|clientHeight|clientWidth|originalHeight|originalWidth|originalVisibility|originalPosition|originalDisplay|scrollTo|originalAncestor|compareDocumentPosition|nextNode|addClassName|removeClassName|setAttribute|descendants|firstDescendant|show|hide|ELEMENT_NODE|Updater|lastText|updateComplete|updateContent|sanitizeJSON|force|_getResponseJSON|escape|JSON|_getHeaderJSON|getStatusText|responseXML|Events|onException|evalResponse|interpolate|requestHeaders|2005|overrideMimeType|XMLHttpRequest|setRequestHeaders|KHTML|Safari|getTransport|register|XMLHTTP|ActiveXObject||these|Try|ObjectRange|from|encodeURIComponent|radix|arrayLength|forEach|size|uniq|sorted|inline|flatten|any|collections|eachSlice|Pattern|exec|comp|lt|amp|unescapeHTML|isJSON|sanitize|JSONFilter|sub|useDoubleQuotes|charCodeAt|specialChar|separator|stripTags|extractScripts|matchOne|scriptTag|matchAll|img|1000|lambda|timeout|argumentNames|instanceof|valueOf|subclasses|MobileSafari|add|page|realOffset|horizontal|vertical|overlap|within|instead|use|deprecated|is|Error|After|Bottom|Top|Before|Insertion|childOf||Toggle|DOMContentLoaded|load|dom|fireEvent|ondataavailable|createEventObject|initEvent|detachEvent|srcElement|cancelBubble|stopped|pointerY|pointerX|clientY|clientX|isRightClick|isMiddleClick|isLeftClick|mouseout|fromElement|mouseover|KEY_INSERT|KEY_PAGEDOWN|KEY_PAGEUP|KEY_END|KEY_HOME|KEY_DELETE|KEY_DOWN|KEY_RIGHT|KEY_UP|KEY_LEFT|KEY_ESC|KEY_RETURN|KEY_TAB|KEY_BACKSPACE|change|click|selectedIndex|one|Field|blur|present|setValue|focusFirstElement|getInputs|selectorType|abled|dis|mod|translate|starts|getScrollOffsets|inner|viewport|IFrame|IFRAME|FrameSet|FRAMESET|TableRow||COLGROUP|COL|TableCaption|CAPTION|Image|Anchor|DEL|INS|Quote|H6|H5|H4|H3|H2|H1|Directory|DIR|DList|DL|OList|OL|UList|UL|FieldSet|FIELDSET|Paragraph|TextArea|OptGroup|OPTGROUP|INPUT|FORM|specified|TABLE|999999|rv|onchange|onselect|onreset|onsubmit|onkeyup|onkeydown|onkeypress|onblur|onfocus|onmouseout|onmousemove|onmouseover|onmouseup|onmousedown|ondblclick|onclick|onload|multiple|readonly|longDesc|readOnly|maxLength|encType|accessKey|dateTime|vAlign|rowSpan|colSpan|cellSpacing|cellspacing|cellPadding|cellpadding|normal|hasLayout|fixed|childElements|getElementsBySelector|undoClipping|makeClipping|undoPositioned|makePositioned|block|getOpacity|getComputedStyle|defaultView|cleanWhitespace|toggleClassName|anonymous_element_|previous|down|up|siblings|createContextualFragment|selectNode|createRange|ownerDocument|cloneNode|NOTATION_NODE|DOCUMENT_FRAGMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_NODE|COMMENT_NODE|PROCESSING_INSTRUCTION_NODE|ENTITY_NODE|ENTITY_REFERENCE_NODE|CDATA_SECTION_NODE|ATTRIBUTE_NODE|snapshotItem|snapshotLength|ORDERED_NODE_SNAPSHOT_TYPE|XPathResult|getElementById|clearTimeout|PeriodicalUpdater|getAllHeaders|responseJSON|Interactive|Loaded|Loading|Uninitialized|https|ecma|java||Failure|Success|300|200|setRequestHeader|close|Connection|charset|javascript|Accept||With|Requested|send|postBody|open|Konqueror|_method|UTF|urlencoded|www|unregister|Microsoft|Msxml2|merge|unset|Math|floor|ceil|round|abs|isFinite|toColorPart|isNaN|intersect|reduce|compact|NodeList|some|every|entries|member|pop|zip|sort|reject|partition|min|max|inGroupsOf|grep|parseQuery|formed|Badly|SyntaxError|Eaeflnr|u00|x1f|x00|dasherize|underscore|fromCharCode|im|truncate|finally|getUTCSeconds|getUTCMinutes|getUTCHours|getUTCDate|getUTCMonth|getUTCFullYear|Date|01|setTimeout|bindAsEventListener|splice|boolean|unknown|RangeError|constructor|secure|Mobile|Apple|AppleWebKit'.split('|'),0,{}))
\ No newline at end of file diff --git a/tools/qtestlib/chart/benchmark_template.html b/tools/qtestlib/chart/benchmark_template.html new file mode 100644 index 0000000..11efd92 --- /dev/null +++ b/tools/qtestlib/chart/benchmark_template.html @@ -0,0 +1,192 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <title>Title</title> + <! Javascript Here> + + <script type="text/javascript"> + +function offsetLabels(labels, offset) +{ + var copy = new Array(); + for (key in labels) { + copy[key] = new Array(labels[key][0] + 0.25, labels[key][1]); + } + return copy; +} + +function createLogDataSet(inDataSet) +{ + var logDataSet = {}; + logDataSet.label = inDataSet.label; + logDataSet.data = []; + + if (!inDataSet.data) + return logDataSet; + + var length = inDataSet.data.length; + + for (var i = 0; i < length; i++) { + logDataSet.data[i] = []; + logDataSet.data[i][0] = inDataSet.data[i][0]; + logDataSet.data[i][1] = Math.log(inDataSet.data[i][1]); + } + return logDataSet; +} + + +function createLogData(inData) +{ + var logData = []; + + // foreach data set; + var length = inData.length; + for (var i = 0; i < length; ++i) { + logData[i] = createLogDataSet(inData[i]); + } + return logData; +} + +function createChart() { +// alert("create chart" + this.chartId) + + var dataSet; + + if (this.useLinearScale) + dataSet = this.selectedDataset; + else + dataSet = createLogData(this.selectedDataset); + + if (this.useLineChart) { + var f = Flotr.draw($(this.chartId), + dataSet, + { legend:{ backgroundColor: '#D2E8FF' } + , xaxis: { ticks: this.labels, noTicks : 10 } + , mouse: { + track: true, + lineColor: 'purple', + sensibility: 1, + trackDecimals: 2, + trackFormatter: function(obj){ return 'x = ' + obj.x +', y = ' + obj.y; } + } + }); + + } else { + var f = Flotr.draw($(this.chartId), + dataSet, + { legend:{ backgroundColor: '#D2E8FF'} + , bars: { show: true, lineWidth: 1, barWidth: this.barWidth } + , xaxis: { ticks: offsetLabels(this.labels, chartOptions.tickOffset), noTicks : 10 } + }); + } +} + +function checkform() +{ +// alert("check form " + this.form.id + " " + this.chartId); + var field = this.form.list + + // Apparently list of lenght one is not a list... + // Display the entire chart if there is only one data series. + if (!field.length) { + this.createChart(); + return; + } + + this.selectedDataset = []; + var data = []; + var index = 0; + + for (i = 0; i < field.length; i++) { + if (field[i].checked == true) { + this.selectedDataset[index++] = this.dataset[i]; + } else { + this.selectedDataset[index++] = []; + } + } + this.createChart(); +} + +function createFormSelector(form, value, text, type) +{ + var selector = document.createElement('input'); + form.appendChild(selector); + selector.type = type; + selector.name = 'list'; + selector.defaultChecked = true; + selector.value = value; + + form.appendChild(document.createTextNode(text)); + form.appendChild(document.createElement("BR")); +} + +function createCheckBox(form, value, text) +{ + createFormSelector(form, value, text, "checkbox"); +} + +function createRadioButton(form, value, text) +{ + createFormSelector(form, value, text, "radio"); +} + +function buildSeriesSelector(form, chartOptions) +{ +// alert("form" + form.id + " " + chartOptions.chartId); + var series = chartOptions.seriesLabels; + form.onclick = function() { /*alert("fn " + chartOptions.chartId);*/ chartOptions.checkform() }; + for (s = 0; s < series.length; ++s) { + createCheckBox(form, s, series[s]); + } +} + +function buildChartTypeSelector() +{ + createRadioButton(this.chartTypeForm, 0, "Bar Chart"); + createRadioButton(this.chartTypeForm, 1, "Line Chart"); + + var field = this.chartTypeForm.list; + if (this.useLineChart) + field[1].checked = true; + else + field[0].checked = true; + + var chartOptions = this; + this.chartTypeForm.onclick = function() { + var field = chartOptions.chartTypeForm.list; + + chartOptions.useLineChart = (field[1].checked == true); + chartOptions.checkform(); + }; +} + +function buildScaleSelector() +{ + createRadioButton(this.scaleForm, 0, "Linear Scale"); + createRadioButton(this.scaleForm, 1, "Logarithmic Scale"); + + var field = this.scaleForm.list; + field[0].checked = true; + field[1].checked = false; + + var chartOptions = this; + this.scaleForm.onclick = function() { + var field = chartOptions.scaleForm.list; + + chartOptions.useLinearScale = (field[0].checked == true); + chartOptions.checkform(); + }; +} + + + </script> + </head> + <body> + <h2> + <! Title Here> + </h2> + <! Description Here> + <! Chart Here> + </body> +</html> diff --git a/tools/qtestlib/chart/chart.pro b/tools/qtestlib/chart/chart.pro new file mode 100644 index 0000000..7328e5d --- /dev/null +++ b/tools/qtestlib/chart/chart.pro @@ -0,0 +1,16 @@ +HEADERS += $$PWD/database.h $$PWD/reportgenerator.h +SOURCES += $$PWD/database.cpp $$PWD/reportgenerator.cpp +SOURCES += main.cpp +RESOURCES = $$PWD/chart.qrc + +QT += sql xml +CONFIG += console +CONFIG -= app_bundle + + +TEMPLATE = app +DEPENDPATH += . +INCLUDEPATH += . +TARGET = chart + + diff --git a/tools/qtestlib/chart/chart.qrc b/tools/qtestlib/chart/chart.qrc new file mode 100644 index 0000000..90f782e --- /dev/null +++ b/tools/qtestlib/chart/chart.qrc @@ -0,0 +1,9 @@ + <!DOCTYPE RCC><RCC version="1.0"> + <qresource> + <file>chart_template.html</file> + <file>benchmark_template.html</file> + <file>3rdparty/excanvas.js</file> + <file>3rdparty/flotr.js</file> + <file>3rdparty/prototype.js</file> + </qresource> + </RCC>
\ No newline at end of file diff --git a/tools/qtestlib/chart/chart_template.html b/tools/qtestlib/chart/chart_template.html new file mode 100644 index 0000000..0a4b81a --- /dev/null +++ b/tools/qtestlib/chart/chart_template.html @@ -0,0 +1,110 @@ + <div> + <h3> + <! Test Name Here> + </h3> + <div id= + <! Chart ID Here> + style="width:900px;height:350px;"></div> + + <table cellspacing = "10"><tr> + + <td valign = "top"> + <form id= + <! Form ID Here> + <b> Data series </b><br> + </form> + </td> + + <td valign = "top"> + <form id= + <! ChartTypeForm ID Here> + <b> Chart Type </b><br> + </form> + </td> + + <td valign = "top"> + <form id= + <! ScaleForm ID Here> + <b> Scale </b><br> + </form> + </td> + + </tr></table> + + </div> + <script type="text/javascript"> + var chartId = + <! Chart ID Here> + ; + + var chartType = + <! Chart Type Here> + ; + + var seriesLabels = + <! Series Labels Here> + + var dataset = []; + <! Data Goes Here> + + var labels = [ + <! Labels Go Here> + ]; + + var colors = new Hash({ + <! ColorScheme Here> + }); + + var shouldFill = + <! Fill Setting Here> + ; + + var form = document.getElementById( + <! Form ID Here> + ); + + var chartTypeForm = document.getElementById( + <! ChartTypeForm ID Here> + ); + + var scaleForm = document.getElementById( + <! ScaleForm ID Here> + ); + + + + var chartOptions = new Object(); + chartOptions.chartId = chartId; + chartOptions.chartType = chartType; + chartOptions.dataset = dataset; + chartOptions.colors = colors; + chartOptions.shouldFill = shouldFill; + chartOptions.labels = labels; + chartOptions.seriesLabels = seriesLabels; + chartOptions.useLineChart = true; + chartOptions.useLinearScale = true; + chartOptions.createChart = createChart; + + chartOptions.ticks = labels; + chartOptions.barWidth = 0.5; + chartOptions.tickOffset = 0.25; + + chartOptions.useLineChart = + <! Use Line Chart Here> + + chartOptions.chartTypeForm = chartTypeForm; + chartOptions.buildChartTypeSelector = buildChartTypeSelector; + chartOptions.buildChartTypeSelector(); + + chartOptions.scaleForm = scaleForm; + chartOptions.buildScaleSelector = buildScaleSelector; + chartOptions.buildScaleSelector(); + + chartOptions.selectedDataset = dataset; + chartOptions.checkform = checkform; + chartOptions.form = form; + chartOptions.buildSeriesSelector = buildSeriesSelector; + chartOptions.buildSeriesSelector(form, chartOptions); + chartOptions.checkform(); + </script> + diff --git a/tools/qtestlib/chart/database.cpp b/tools/qtestlib/chart/database.cpp new file mode 100644 index 0000000..5abfe50 --- /dev/null +++ b/tools/qtestlib/chart/database.cpp @@ -0,0 +1,321 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "database.h" +#include <QtGui> +#include <QtXml> + +// Database schema definition and open/create functions + +QString resultsTable = QString("(TestName varchar, TestCaseName varchar, Series varchar, Idx varchar, ") + + QString("Result varchar, ChartType varchar, Title varchar, ChartWidth varchar, ") + + QString("ChartHeight varchar, TestTitle varchar, QtVersion varchar, Iterations varchar") + + QString(")"); + +void execQuery(QSqlQuery query, bool warnOnFail) +{ + bool ok = query.exec(); + if (!ok && warnOnFail) { + qDebug() << "FAIL:" << query.lastQuery() << query.lastError().text(); + } +} + +void execQuery(const QString &spec, bool warnOnFail) +{ + QSqlQuery query; + query.prepare(spec); + execQuery(query, warnOnFail); +} + +QSqlDatabase openDataBase(const QString &databaseFile) +{ +// qDebug() << "open data base"; + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); + db.setDatabaseName(databaseFile); + bool ok = db.open(); + if (!ok) + qDebug() << "FAIL: could not open database"; + return db; +} + +QSqlDatabase createDataBase(const QString &databaseFile) +{ +// qDebug() << "create data base"; + QSqlDatabase db = openDataBase(databaseFile); + + execQuery("DROP TABLE Results", false); + execQuery("CREATE TABLE Results " + resultsTable); + + return db; +} + +struct Tag +{ + Tag(QString key, QString value) + : key(key.trimmed()), value(value.trimmed()) + { + + } + + QString key; + QString value; +}; + +QList<Tag> parseTag(const QString &tag) +{ + // Format: key1=value ; key2=value + // key1=value key2=value + // value--value + + QList<Tag> keyValues; + + QString keyValuePairSeparator(""); + if (tag.contains(";")) + keyValuePairSeparator = ';'; + if (tag.contains("--")) + keyValuePairSeparator = "--"; + + foreach (QString keyValue, tag.split(keyValuePairSeparator)) { + if (keyValue.contains("=")) { + QStringList parts = keyValue.split("="); + keyValues.append(Tag(parts.at(0), parts.at(1))); + } else { + keyValues.append(Tag(QString(), keyValue)); // no key, just a value. + } + } + + return keyValues; +} + +void loadXml(const QStringList &fileNames) +{ + foreach(const QString &fileName, fileNames) { + QFileInfo fi( fileName ); + loadXml(fileName, fi.fileName()); + } +} + +void loadXml(const QString &fileName, const QString &context) +{ + QFile f(fileName); + f.open(QIODevice::ReadOnly); + loadXml(f.readAll(), context); +} + +void loadXml(const QByteArray &xml, const QString& context) +{ + QDomDocument doc; + + int line; + int col; + QString errorMsg; + if (doc.setContent(xml, &errorMsg, &line, &col) == false) { + qDebug() << "dom setContent failed" << line << col << errorMsg; + } + + // Grab "Value" from <Environment><QtVersion>Value</QtVersion></Environment> + QString qtVersion = doc.elementsByTagName("Environment").at(0).toElement().elementsByTagName("QtVersion") + .at(0).toElement().childNodes().at(0).nodeValue(); + QString testCase = doc.elementsByTagName("TestCase").at(0).toElement().attributeNode("name").value(); + +// qDebug() << "qt version" << qtVersion; +// qDebug() << "test case" << testCase; + + DataBaseWriter writer; + writer.testName = testCase; // testCaseName and testName is mixed up in the database writer class + writer.qtVersion = qtVersion; + + QDomNodeList testFunctions = doc.elementsByTagName("TestFunction"); + for (int i = 0; i < testFunctions.count(); ++i) { + QDomElement function = testFunctions.at(i).toElement(); + QString functionName = function.attributeNode("name").value(); + writer.testCaseName = functionName; // testCaseName and testName is mixed up in the database writer class + +// qDebug() << "fn" << functionName; + + QDomNodeList results = function.elementsByTagName("BenchmarkResult"); + for (int j = 0; j < results.count(); ++j) { + QDomElement result = results.at(j).toElement(); + QString tag = result.attributeNode("tag").value(); + + Q_UNUSED(context); +// if (!context.isEmpty()) +// tag += QString(" (%1)").arg(context); + + QString series; + QString index; + + // By convention, "--" separates series and indexes in tags. + if (tag.contains("--")) { + QStringList parts = tag.split("--"); + series = parts.at(0); + index = parts.at(1); + } else { + series = tag; + } + + QString resultString = result.attributeNode("value").value(); + QString iterationCount = result.attributeNode("iterations").value(); + double resultNumber = resultString.toDouble() / iterationCount.toDouble(); + writer.addResult(series, index, QString::number(resultNumber), iterationCount); +// qDebug() << "result" << series << index << tag << resultString << iterationCount; + } + } +} + +void displayTable(const QString &table) +{ + QSqlTableModel *model = new QSqlTableModel(); + model->setTable(table); + model->select(); + QTableView *view = new QTableView(); + view->setModel(model); + view->show(); +} + +void printDataBase() +{ + QSqlQuery query; + query.prepare("SELECT TestName, TestCaseName, Result FROM Results;"); + bool ok = query.exec(); + qDebug() << "printDataBase ok?" << ok; + + query.next(); + qDebug() << ""; + qDebug() << "Benchmark" << query.value(0).toString(); + query.previous(); + + while (query.next()) { + // QString country = query.value(fieldNo).toString(); + // doSomething(country); + qDebug() << "result for" << query.value(1).toString() << query.value(2).toString(); + } +} + +// TempTable implementation + +static int tempTableIdentifier = 0; +TempTable::TempTable(const QString &spec) +{ + m_name = "TempTable" + QString::number(tempTableIdentifier++); + execQuery("CREATE TEMP TABLE " + m_name + " " + spec); +} + +TempTable::~TempTable() +{ + // ref count and drop it? +} + +QString TempTable::name() +{ + return m_name; +} + +// DataBaseWriter implementation + +DataBaseWriter::DataBaseWriter() +{ + disable = false; + chartSize = QSize(800, 400); + databaseFileName = ":memory:"; + qtVersion = QT_VERSION_STR; +} + +void DataBaseWriter::openDatabase() +{ + db = openDataBase(databaseFileName); +} + +void DataBaseWriter::createDatabase() +{ + db = createDataBase(databaseFileName); +} + +void DataBaseWriter::beginTransaction() +{ + if (db.transaction() == false) { + qDebug() << db.lastError(); + qFatal("no transaction support"); + } +} + +void DataBaseWriter::commitTransaction() +{ + db.commit(); +} + +void DataBaseWriter::rollbackTransaction() +{ + db.rollback(); +} + +void DataBaseWriter::addResult(const QString &result) +{ + return addResult(QString(), QString(), result); +} + +void DataBaseWriter::addResult(const QString &series, const QString &index, const QString &result, const QString &iterations) +{ + if (disable) + return; + + QSqlQuery query; + + query.prepare("INSERT INTO Results (TestName, TestCaseName, Series, Idx, Result, ChartWidth, ChartHeight, Title, TestTitle, ChartType, QtVersion, Iterations) " + "VALUES (:TestName, :TestCaseName, :Series, :Idx, :Result, :ChartWidth, :ChartHeight, :Title, :TestTitle, :ChartType, :QtVersion, :Iterations)"); + query.bindValue(":TestName", testName); + query.bindValue(":TestCaseName", testCaseName); + query.bindValue(":Series", series); + query.bindValue(":Idx", index); + query.bindValue(":Result", result); + query.bindValue(":ChartWidth", chartSize.width()); + query.bindValue(":ChartHeight", chartSize.height()); + query.bindValue(":Title", chartTitle); + query.bindValue(":TestTitle", testTitle); + query.bindValue(":QtVersion", qtVersion); + query.bindValue(":Iterations", iterations); + + + if (chartType == LineChart) + query.bindValue(":ChartType", "LineChart"); + else + query.bindValue(":ChartType", "BarChart"); + execQuery(query); +} diff --git a/util/install/win/globalinformation.h b/tools/qtestlib/chart/database.h index 843dac6..448a44f 100644 --- a/util/install/win/globalinformation.h +++ b/tools/qtestlib/chart/database.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,56 +38,62 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef GLOBALINFORMATION_H -#define GLOBALINFORMATION_H -#include <qstring.h> +#ifndef DATABASE_H +#define DATABASE_H -class GlobalInformation +#include <QtCore> +#include <QtSql> + +extern QString resultsTable; +QSqlDatabase openDataBase(const QString &databaseFile = "database"); +QSqlDatabase createDataBase(const QString &databaseFile = "database"); + +void loadXml(const QStringList &fileNames); +void loadXml(const QString &fileName, const QString &context=QString::null); +void loadXml(const QByteArray &xml, const QString &context=QString::null); + +void execQuery(QSqlQuery query, bool warnOnFail = true); +void execQuery(const QString &spec, bool warnOnFail = true); +void printDataBase(); +void displayTable(const QString &table); + +class TempTable { public: - GlobalInformation(); - ~GlobalInformation(); - - void setReconfig( bool ); - bool reconfig() const; - void setQtVersionStr( const QString& ); - QString qtVersionStr() const; -#if defined(QSA) - void setQsaVersionStr( const QString& ); - QString qsaVersionStr() const; -#endif + TempTable(const QString &spec); + ~TempTable(); + QString name(); +private: + QString m_name; +}; - enum SysId { - MSVCNET = 0, - MSVC = 1, - Borland = 2, - MinGW = 3, - Other = 4, - Watcom = 5, - Intel = 6, - GCC = 7, - MACX = 8 - }; - void setSysId( SysId ); - SysId sysId() const; +enum ChartType { BarChart, LineChart }; +class DataBaseWriter +{ +public: + DataBaseWriter(); + QString databaseFileName; + QString testTitle; + QString testName; + QString testCaseName; + ChartType chartType; + QSize chartSize; + QString chartTitle; + QString qtVersion; + bool disable; + + void openDatabase(); + void createDatabase(); - enum Text { - MakeTool, - IDE, - Mkspec - }; + void beginTransaction(); + void commitTransaction(); + void rollbackTransaction(); - QString text(Text t) const; + void addResult(const QString &result); + void addResult(const QString &series , const QString &index, const QString &result, const QString &iterations = QLatin1String("1")); -private: - bool _reconfig; - QString _qtVersionStr; -#if defined(QSA) - QString _qsaVersionStr; -#endif - SysId _sysId; + QSqlDatabase db; }; -extern GlobalInformation globalInformation; -#endif // GLOBALINFORMATION_H +#endif diff --git a/util/install/win/resource.h b/tools/qtestlib/chart/main.cpp index 791edfe..9bb937c 100644 --- a/util/install/win/resource.h +++ b/tools/qtestlib/chart/main.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,40 +38,45 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef RESOURCE_H -#define RESOURCE_H +#include <QtCore> +#include <QtSql> +#include <database.h> +#include <reportgenerator.h> + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); -#include <qcstring.h> -#include <qstring.h> + QSqlDatabase db = createDataBase(":memory:"); -class ResourceLoader -{ -public: - ResourceLoader( char *resourceName, int minimumSize=0 ); - ~ResourceLoader(); + if (argc < 2) { - bool isValid() const; - QByteArray data(); + // Try stdin + QFile in; + in.open(stdin, QIODevice::ReadOnly); + QByteArray xml = in.readAll(); -private: - bool valid; - int arSize; - char *arData; - QByteArray ba; -}; + if (xml.isEmpty()) { + qDebug() << "Usage: chart xml-file [xml-file2 xml-file3 ...]"; + qDebug() << "See also QTestLib's \"-chart\" option"; + return 0; + } else { + loadXml(xml, QString()); + } + } -#if defined(Q_OS_WIN32) -class ResourceSaver -{ -public: - ResourceSaver( const QString& appName ); - ~ResourceSaver(); + QStringList files; + for (int i = 1; i < argc; i++) { + QString file = QString::fromLocal8Bit(argv[i]); + files += file; + } + + if (files.isEmpty() == false) + loadXml(files); - bool setData( char *resourceName, const QByteArray &data, QString *errorMessage=0 ); + ReportGenerator reportGenerator; + reportGenerator.writeReports(); -private: - QString applicationName; -}; -#endif + db.close(); +} -#endif // RESOURCE_H diff --git a/tools/qtestlib/chart/reportgenerator.cpp b/tools/qtestlib/chart/reportgenerator.cpp new file mode 100644 index 0000000..bf5bf94 --- /dev/null +++ b/tools/qtestlib/chart/reportgenerator.cpp @@ -0,0 +1,562 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "reportgenerator.h" + +// Report generator file utility functions + +QList<QByteArray> readLines(const QString &fileName) +{ + QList<QByteArray> lines; + QFile f(fileName); + f.open(QIODevice::ReadOnly | QIODevice::Text); + while(!f.atEnd()) + lines.append(f.readLine()); + return lines; +} + +void writeLines(const QString &fileName, const QList<QByteArray> &lines) +{ + QFile f(fileName); + f.open(QIODevice::WriteOnly | QIODevice::Text); + foreach(const QByteArray line, lines) + f.write(line); +} + +void writeFile(const QString &fileName, const QByteArray &contents) +{ + QFile f(fileName); + f.open(QIODevice::WriteOnly | QIODevice::Append); + f.write(contents); +} + +// Report generator database utility functions + +QStringList select(const QString &field, const QString &tableName) +{ + QSqlQuery query; + query.prepare("SELECT DISTINCT " + field +" FROM " + tableName); + bool ok = query.exec(); + Q_UNUSED(ok); +// if (!ok) +// qDebug() << "select unique ok" << ok; + + QStringList values; + while (query.next()) { + values += query.value(0).toString(); + } + return values; +} + +QStringList selectUnique(const QString &field, const QString &tableName) +{ + QSqlQuery query; + query.prepare("SELECT DISTINCT " + field +" FROM " + tableName); + bool ok = query.exec(); + Q_UNUSED(ok); +// if (!ok) +// qDebug() << "select unique ok" << ok; + + QStringList values; + while (query.next()) { + values += query.value(0).toString(); + } + return values; +} + +QSqlQuery selectFromSeries(const QString &serie, const QString &column, const QString &tableName, const QString &seriesName) +{ + QSqlQuery query; + if (serie == QString()) + query.prepare("SELECT " + column + " FROM " + tableName); + else + query.prepare("SELECT " + column + " FROM " + tableName + " WHERE " + seriesName + "='" + serie + "'"); + /*bool ok =*/ query.exec(); + + +// qDebug() << "selectDataFromSeries ok?" << ok << query.size(); + return query; +} + +int countDataFromSeries(const QString &serie, const QString &tableName, const QString &seriesName) +{ +// qDebug() << "count" << serie << "in" << tableName; + QSqlQuery query; + query.prepare("SELECT COUNT(Result) FROM " + tableName + " WHERE" + seriesName + "='" + serie + "'"); + bool ok = query.exec(); + if (!ok) { + qDebug() << "query fail" << query.lastError(); + } + + qDebug() << "countDataFromSeries ok?" << ok << query.size(); + query.next(); + return query.value(0).toInt(); +} + +// Report generator output utility functions + +QList<QByteArray> printData(const QString &tableName, const QString &seriesName, const QString &indexName) +{ + QList<QByteArray> output; + QStringList series = selectUnique(seriesName, tableName); +// qDebug() << "series" << series; + if (series.isEmpty()) + series+=QString(); + + foreach (QString serie, series) { + QSqlQuery data = selectFromSeries(serie, "Result", tableName, seriesName); + QSqlQuery labels = selectFromSeries(serie, indexName, tableName, seriesName); + + QByteArray dataLine = "dataset.push({ data: ["; + int i = 0; + while (data.next() && labels.next()) { + QString label = labels.value(0).toString(); + + QString labelString; + bool ok; + label.toInt(&ok); + if (ok) + labelString = label; + // else + labelString = QString::number(i); + + dataLine += ("[" + labelString + ", " + data.value(0).toString() + "]"); + + ++i; + if (data.next()) { + dataLine += ", "; + data.previous(); + } + } + dataLine += "], label : \"" + serie + "\" });\n"; + output.append(dataLine); + } + return output; +} + +// Determines if a line chart should be used. Returns true if the first label is numerical. +bool useLineChart(const QString &tableName, const QString &seriesName, const QString &indexName) +{ + QList<QByteArray> output; + QStringList series = selectUnique(seriesName, tableName); + if (series.isEmpty()) + return false; + + QSqlQuery data = selectFromSeries(series[0], indexName, tableName, seriesName); + + if (data.next()) { + QString label = data.value(0).toString(); + bool ok; + label.toDouble(&ok); + return ok; + } + + return false; +} + +int countLabels(const QString &tableName, const QString &seriesName, const QString &indexName) +{ + QStringList series = selectUnique(seriesName, tableName); + if (series.isEmpty()) + return 0; + QSqlQuery data = selectFromSeries(series[0], indexName, tableName, seriesName); + int count = 0; + while (data.next()) + count++; + + return count; +} + + +QList<QByteArray> printLabels(const QString &tableName, const QString &seriesName, const QString &indexName) +{ + QList<QByteArray> output; + QStringList series = selectUnique(seriesName, tableName); + if (series.isEmpty()) + return QList<QByteArray>(); + + QSqlQuery data = selectFromSeries(series[0], indexName, tableName, seriesName); + + int count = 0; + while (data.next()) + count++; + + data.first(); data.previous(); + + const int labelCount = 10; + int skip = count / labelCount; + + QByteArray dataLine; + int i = 0; + while (data.next()) { + dataLine += ("[" + QByteArray::number(i) + ",\"" + data.value(0).toString() + "\"]"); + ++i; + if (data.next()) { + dataLine += ", "; + data.previous(); + } + + // skip labels. + i += skip; + for (int j = 0; j < skip; ++j) + data.next(); + } + dataLine += "\n"; + output.append(dataLine); + return output; +} + +QByteArray printSeriesLabels(const QString &tableName, const QString &seriesColumnName) +{ + QByteArray output; + QStringList series = selectUnique(seriesColumnName, tableName); + if (series.isEmpty()) + return "[];\n"; + + output += "["; + + foreach(const QString &serie, series) { + output += "\"" + serie.toLocal8Bit() + "\", "; + } + output.chop(1); //remove last comma + output += "]\n"; + return output; +} + +void addJavascript(QList<QByteArray> *output, const QString &fileName) +{ + output->append("<script type=\"text/javascript\">\n"); + (*output) += readLines(fileName); + output->append("</script>\n"); +} + +void addJavascript(QList<QByteArray> *output) +{ + addJavascript(output, ":3rdparty/prototype.js"); + addJavascript(output, ":3rdparty/excanvas.js"); + addJavascript(output, ":3rdparty/flotr.js"); +} + +TempTable selectRows(const QString &sourceTable, const QString &column, const QString &value) +{ + TempTable tempTable(resultsTable); + + QSqlQuery query; + query.prepare("INSERT INTO " + tempTable.name() + " SELECT * FROM " + sourceTable + + " WHERE " + column + "='" + value + "'"); + execQuery(query); + +// displayTable(tempTable.name()); + + return tempTable; +} + +TempTable mergeVersions(const QString &) +{ + +// QtVersion - As series +// Result - (free) +// Idx - match +// TestName - match +// CaseName - match + +// (Series - average) +/* + TempTable tempTable(resultsTable); + QStringlist versions = selectUnique("QtVersions", sourceTable); + + QSqlQuery oneVersion = select(WHERE QtVersions = versions.at(0)) + while (oneVersion.next) { + QSqlQuery otherversions = selectMatches(QStringList() << "TestName" << "TestCaseName" << "Idx") + while (otherversions.next) { + insert(temptable + } + } +*/ + return TempTable(""); +} + +QStringList fieldPriorityList = QStringList() << "Idx" << "Series" << "QtVersion"; + +struct IndexSeriesFields +{ + QString index; + QString series; +}; + +IndexSeriesFields selectFields(const QString &table) +{ + IndexSeriesFields fields; + foreach (QString field, fieldPriorityList) { +// qDebug() << "unique" << field << selectUnique(field, table).count(); + QStringList rows = selectUnique(field, table); + + if (rows.count() <= 1 && rows.join("") == QString("")) + continue; + + if (fields.index.isEmpty()) { + fields.index = field; + continue; + } + + if (fields.series.isEmpty()) { + fields.series = field; + break; + } + } + return fields; +} + +TempTable selectTestCase(const QString &testCase, const QString &sourceTable) +{ + return selectRows(sourceTable, QLatin1String("TestCaseName"), testCase); +} + +QString field(const QSqlQuery &query, const QString &name) +{ + return query.value(query.record().indexOf(name)).toString(); +} + +QSqlQuery selectAllResults(const QString &tableName) +{ + QSqlQuery query; + query.prepare("SELECT * FROM " + tableName); + execQuery(query); + return query; +} + +void printTestCaseResults(const QString &testCaseName) +{ +// QStringList testCases = selectUnique("TestCaseName", "Results"); + qDebug() << ""; + qDebug() << "Results for benchmark" << testCaseName; + TempTable temptable = selectTestCase(testCaseName, "Results"); + QSqlQuery query = selectAllResults(temptable.name()); + if (query.isActive() == false) { + qDebug() << "No results"; + return; + } + + query.next(); + + if (field(query, "Idx") == QString()) { + do { + qDebug() << "Result:" << field(query, "result"); + } while (query.next()); + } else if (field(query, "Series") == QString()) { + do { + qDebug() << field(query, "Idx") << " : " << field(query, "result"); + } while (query.next()); + } else { + do { + qDebug() << field(query, "Series") << " - " << field(query, "Idx") << " : " << field(query, "result"); + } while (query.next()); + } + + qDebug() << ""; +} + + +// ReportGenerator implementation + +ReportGenerator::ReportGenerator() +{ + m_colorScheme = QList<QByteArray>() << "#a03b3c" << "#3ba03a" << "#3a3ba0" << "#3aa09f" << "#39a06b" << "#a09f39"; +} + + +void ReportGenerator::writeReport(const QString &tableName, const QString &fileName, bool combineQtVersions) +{ + QStringList testCases = selectUnique("TestCaseName", tableName); + QList<QByteArray> lines = readLines(":benchmark_template.html"); + QList<QByteArray> output; + + foreach(QByteArray line, lines) { + if (line.contains("<! Chart Here>")) { + foreach (const QString testCase, testCases) { + TempTable testCaseTable = selectTestCase(testCase, tableName); + output += writeChart(testCaseTable.name(), combineQtVersions); + } + } else if (line.contains("<! Title Here>")) { + QStringList name = selectUnique("TestName", tableName); + output += "Test: " + name.join("").toLocal8Bit(); + } else if (line.contains("<! Description Here>")) { + output += selectUnique("TestTitle", tableName).join("").toLocal8Bit(); + } else if (line.contains("<! Javascript Here>")){ + addJavascript(&output); + } else { + output.append(line); + } + } + + m_fileName = fileName; + + writeLines(m_fileName, output); + qDebug() << "Wrote report to" << m_fileName; +} + +void ReportGenerator::writeReports() +{ +/* + QStringList versions = selectUnique("QtVersion", "Results"); + + // qDebug() << "versions" << versions; + + foreach (QString version, versions) { + QString fileName = "results-" + version + ".html"; + TempTable versionTable = selectRows("Results", "QtVersion", version); + writeReport(versionTable.name(), fileName, false); + } +*/ + writeReport("Results", "results.html", false); + qDebug() << "Supported browsers: Firefox, Safari, Opera, Qt Demo Browser (IE and KDE 3 Konqueror are not supported)"; +} + +QString ReportGenerator::fileName() +{ + return m_fileName; +} + +QList<QByteArray> ReportGenerator::writeChart(const QString &tableName, bool combineQtVersions) +{ + QSqlQuery query; + query.prepare("SELECT TestName, Series, Idx, Result, ChartWidth, ChartHeight, Title, TestCaseName, ChartType, QtVersion FROM " + tableName); + execQuery(query); + + QString seriesName; + QString indexName; + + if (combineQtVersions) { + IndexSeriesFields fields = selectFields(tableName); + seriesName = fields.series; + indexName = fields.index; + } else { + seriesName = "Series"; + indexName = "Idx"; + } + + QList<QByteArray> data = printData(tableName, seriesName, indexName); + QList<QByteArray> labels = printLabels(tableName, seriesName, indexName); + QByteArray seriesLabels = printSeriesLabels(tableName, seriesName); + QByteArray useLineChartString = useLineChart(tableName, seriesName, indexName) ? "true" : "false" ; + + query.next(); + QString testName = query.value(0).toString(); + QSize size(query.value(4).toInt(), query.value(5).toInt()); +// QString title = "Test Function: " + query.value(7).toString() + " - " + query.value(6).toString(); + QString title = "Test Function: " + query.value(7).toString(); + QString chartId = "\"" + query.value(7).toString() + "\""; + QString formId = "\"" + query.value(7).toString() + "form\""; + QString chartTypeFormId = "\"" + query.value(7).toString() + "chartTypeform\""; + QString scaleFormId = "\"" + query.value(7).toString() + "scaleform\""; + QString type = query.value(8).toString(); + + // Skip chart generation if there isn't enough data. + if (countLabels(tableName, seriesName, indexName) < 2) { + qDebug() << title.toAscii() << "No chartable data. (See the \"series\" test function" + << "in examples/qtestlib/tutorial5 for an example.) "; + return QList<QByteArray>() << title.toAscii() << " (no chartable data)"; // TODO: genrate text table here. + } + +// QString qtVersion = query.value(9).toString(); + query.previous(); + + QString sizeString = "height=\"" + QString::number(size.height()) + "\" width=\"" + QString::number(size.width()) + "\""; + + QString fillString; + if (type == "LineChart") + fillString = "false"; + else + fillString = "true"; + + QByteArray colors = printColors(tableName, seriesName); + + QList<QByteArray> lines = readLines(":chart_template.html"); + QList<QByteArray> output; + + foreach(QByteArray line, lines) { + if (line.contains("<! Test Name Here>")) { + output.append(title.toLocal8Bit()); + } else if (line.contains("<! Chart ID Here>")) { + output += chartId.toLocal8Bit(); + } else if (line.contains("<! Form ID Here>")) { + output += formId.toLocal8Bit(); + } else if (line.contains("<! ChartTypeForm ID Here>")) { + output += chartTypeFormId.toLocal8Bit(); + } else if (line.contains("<! ScaleForm ID Here>")) { + output += scaleFormId.toLocal8Bit(); + } else if (line.contains("<! Size>")) { + output += sizeString.toLocal8Bit(); + } else if (line.contains("<! ColorScheme Here>")) { + output += colors; + } else if (line.contains("<! Data Goes Here>")) { + output += data; + } else if (line.contains("<! Labels Go Here>")) { + output += labels; + } else if (line.contains("<! Use Line Chart Here>")) { + output += useLineChartString + ";"; + } else if (line.contains("<! Chart Type Here>")) { + output += "\"" + type.toLocal8Bit() + "\""; + } else if (line.contains("<! Fill Setting Here>")) { + output += fillString.toLocal8Bit(); + } else if (line.contains("<! Series Labels Here>")) { + output += seriesLabels; + } else { + output.append(line); + } + } + + return output; +} + +QByteArray ReportGenerator::printColors(const QString &tableName, const QString &seriesName) +{ + QByteArray colors; + int i = 0; + QStringList series = selectUnique(seriesName, tableName); + foreach (const QString &serie, series) { + colors.append("'" + serie.toLocal8Bit() + "': '" + m_colorScheme.at(i % m_colorScheme.count()) + "',\n"); + ++ i; + } + colors.chop(2); // remove last comma + colors.append("\n"); + return colors; +} + diff --git a/util/install/win/dialogs/folderdlgimpl.h b/tools/qtestlib/chart/reportgenerator.h index 25e13b5..bb69d1a 100644 --- a/util/install/win/dialogs/folderdlgimpl.h +++ b/tools/qtestlib/chart/reportgenerator.h @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the utils of the Qt Toolkit. +** This file is part of the tools applications of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,28 +38,26 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef FOLDERDLGIMPL_H -#define FOLDERDLGIMPL_H +#ifndef REPORTGENERATOR_H +#define REPORTGENERATOR_H -#include "folderdlg.h" +#include "database.h" -class WinShell; - -class FolderDlgImpl : public FolderDlg +class ReportGenerator { - Q_OBJECT -public: - FolderDlgImpl( QWidget* parent = NULL, const char* name = NULL, bool modal = false, WindowFlags f = 0 ); - - void setup( QString, QString ); - - virtual void expandedDir( QListViewItem* ); - virtual void collapsedDir( QListViewItem* ); - virtual void selectedDir( QListViewItem* ); - - QString getFolderName(); +public: + ReportGenerator(); + QByteArray printColors(const QString &tableName, const QString &seriesName); + QList<QByteArray> writeChart(const QString &tableName, bool combineVersions); + void writeReport(const QString &tableName, const QString &filename, bool combineVersions = false); + void writeReports(); + QString fileName(); private: - void ScanFolder( QString folderPath, QListViewItem* parent ); + QList<QByteArray> m_colorScheme; + QString m_fileName; }; -#endif // FOLDERDLGIMPL_H +void printTestCaseResults(const QString &testCaseName); + +#endif + diff --git a/tools/qtestlib/qtestlib.pro b/tools/qtestlib/qtestlib.pro index da94e81..9ff7360 100644 --- a/tools/qtestlib/qtestlib.pro +++ b/tools/qtestlib/qtestlib.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs -!wince*: SUBDIRS += updater +!wince*: SUBDIRS += updater chart wince*: contains(QT_CONFIG, cetest): SUBDIRS += wince CONFIG += ordered diff --git a/tools/qvfb/PDAPhone.skin/pda_up.png b/tools/qvfb/PDAPhone.skin/pda_up.png Binary files differdeleted file mode 100644 index 541e3c4..0000000 --- a/tools/qvfb/PDAPhone.skin/pda_up.png +++ /dev/null diff --git a/tools/qvfb/pda.qrc b/tools/qvfb/pda.qrc deleted file mode 100644 index b14e7b3..0000000 --- a/tools/qvfb/pda.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/skins"> - <file>pda.skin</file> -</qresource> -</RCC> diff --git a/tools/qvfb/pda.skin b/tools/qvfb/pda.skin deleted file mode 100644 index 037f750..0000000 --- a/tools/qvfb/pda.skin +++ /dev/null @@ -1,14 +0,0 @@ -pda_up.png pda_down.png -57 81 -240 320 -11 -"Power" 0x0100000a 277 36 302 57 -"F1" 0x01000030 52 439 81 470 -"F2" 0x01000031 101 422 130 451 -"F3" 0x01000032 232 423 260 452 -"F4" 0x01000033 279 445 309 473 -"Left" 0x01000012 155 438 176 472 -"Down" 0x01000015 169 471 203 486 -"Right" 0x01000014 193 448 215 472 -"Up" 0x01000013 166 427 199 451 -"Enter" 0x01000005 177 448 193 468 diff --git a/tools/qvfb/pda_down.png b/tools/qvfb/pda_down.png Binary files differdeleted file mode 100644 index 0ea157d..0000000 --- a/tools/qvfb/pda_down.png +++ /dev/null diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index 8de638f..510f0eb 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -711,7 +711,16 @@ void QVFb::configure() } view->setViewFormat(displayFormat); view->setTouchscreenEmulation( config->touchScreen->isChecked() ); - view->setRgbSwapped(config->rgbSwapped->isChecked()); + if (view->rgbSwapped() != config->rgbSwapped->isChecked()) { + //### the windowTitle logic is inside init(), and init isn't always invoked + QString caption = windowTitle(); + if (!config->rgbSwapped->isChecked()) + caption.replace(QLatin1String(" BGR"), QString()); + else + caption.append(QLatin1String(" BGR")); + setWindowTitle(caption); + view->setRgbSwapped(config->rgbSwapped->isChecked()); + } bool lcdEmulation = config->lcdScreen->isChecked(); view->setLcdScreenEmulation( lcdEmulation ); if ( lcdEmulation ) diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index 85c4d96..247337a 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -60,15 +60,4 @@ unix:x11 { LIBS += -lXtst } -RESOURCES += qvfb.qrc \ - ClamshellPhone.qrc \ - PDAPhone.qrc \ - SmartPhone2.qrc \ - SmartPhone.qrc \ - SmartPhoneWithButtons.qrc \ - TouchscreenPhone.qrc \ - Trolltech-Keypad.qrc \ - Trolltech-Touchscreen.qrc \ - PortableMedia.qrc \ - S60-QVGA-Candybar.qrc \ - S60-nHD-Touchscreen.qrc +RESOURCES += qvfb.qrc diff --git a/tools/shared/deviceskin/deviceskin.pri b/tools/shared/deviceskin/deviceskin.pri index e4c9ef7..2552c92 100644 --- a/tools/shared/deviceskin/deviceskin.pri +++ b/tools/shared/deviceskin/deviceskin.pri @@ -1,3 +1,15 @@ INCLUDEPATH += $$PWD HEADERS += $$PWD/deviceskin.h SOURCES += $$PWD/deviceskin.cpp +RESOURCES += $$PWD/skins/ClamshellPhone.qrc \ + $$PWD/skins/PDAPhone.qrc \ + $$PWD/skins/SmartPhone2.qrc \ + $$PWD/skins/SmartPhone.qrc \ + $$PWD/skins/SmartPhoneWithButtons.qrc \ + $$PWD/skins/TouchscreenPhone.qrc \ + $$PWD/skins/Trolltech-Keypad.qrc \ + $$PWD/skins/Trolltech-Touchscreen.qrc \ + $$PWD/skins/PortableMedia.qrc \ + $$PWD/skins/S60-QVGA-Candybar.qrc \ + $$PWD/skins/S60-nHD-Touchscreen.qrc + diff --git a/tools/qvfb/ClamshellPhone.qrc b/tools/shared/deviceskin/skins/ClamshellPhone.qrc index 39cd422..39cd422 100644 --- a/tools/qvfb/ClamshellPhone.qrc +++ b/tools/shared/deviceskin/skins/ClamshellPhone.qrc diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin index cb24a8e..cb24a8e 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone.skin +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone.skin diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png Binary files differindex 88ba3a1..88ba3a1 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-closed.png +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-closed.png diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png Binary files differindex 971cdef..971cdef 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5-pressed.png diff --git a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png Binary files differindex f3550ee..f3550ee 100644 --- a/tools/qvfb/ClamshellPhone.skin/ClamshellPhone1-5.png +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/ClamshellPhone1-5.png diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf index e349dbc..e349dbc 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/ClamshellPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png Binary files differindex d62ef4a..d62ef4a 100644 --- a/tools/qvfb/DualScreenPhone.skin/DualScreen-pressed.png +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen-pressed.png diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreen.png b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png Binary files differindex cb3d1a7..cb3d1a7 100644 --- a/tools/qvfb/DualScreenPhone.skin/DualScreen.png +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreen.png diff --git a/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin index a82ef23..a82ef23 100644 --- a/tools/qvfb/DualScreenPhone.skin/DualScreenPhone.skin +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/DualScreenPhone.skin diff --git a/tools/qvfb/SmartPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf index 1103350..1103350 100644 --- a/tools/qvfb/SmartPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/DualScreenPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/PDAPhone.qrc b/tools/shared/deviceskin/skins/PDAPhone.qrc index 1a1c35a..1a1c35a 100644 --- a/tools/qvfb/PDAPhone.qrc +++ b/tools/shared/deviceskin/skins/PDAPhone.qrc diff --git a/tools/qvfb/PDAPhone.skin/PDAPhone.skin b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin index d6a1966..d6a1966 100644 --- a/tools/qvfb/PDAPhone.skin/PDAPhone.skin +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/PDAPhone.skin diff --git a/tools/qvfb/PDAPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf index e3ae813..e3ae813 100644 --- a/tools/qvfb/PDAPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/PDAPhone.skin/finger.png b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png Binary files differindex 24cf0cb..24cf0cb 100644 --- a/tools/qvfb/PDAPhone.skin/finger.png +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/finger.png diff --git a/tools/qvfb/PDAPhone.skin/pda_down.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png Binary files differindex f65c059..f65c059 100644 --- a/tools/qvfb/PDAPhone.skin/pda_down.png +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_down.png diff --git a/tools/qvfb/pda_up.png b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png Binary files differindex 541e3c4..541e3c4 100644 --- a/tools/qvfb/pda_up.png +++ b/tools/shared/deviceskin/skins/PDAPhone.skin/pda_up.png diff --git a/tools/qvfb/PortableMedia.qrc b/tools/shared/deviceskin/skins/PortableMedia.qrc index a902f1a..a902f1a 100644 --- a/tools/qvfb/PortableMedia.qrc +++ b/tools/shared/deviceskin/skins/PortableMedia.qrc diff --git a/tools/qvfb/PortableMedia.skin/PortableMedia.skin b/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin index b76e5cf..b76e5cf 100644 --- a/tools/qvfb/PortableMedia.skin/PortableMedia.skin +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/PortableMedia.skin diff --git a/tools/qvfb/PortableMedia.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf index 514e881..514e881 100644 --- a/tools/qvfb/PortableMedia.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/defaultbuttons.conf diff --git a/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png Binary files differindex 730e762..730e762 100644 --- a/tools/qvfb/PortableMedia.skin/portablemedia-pressed.png +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia-pressed.png diff --git a/tools/qvfb/PortableMedia.skin/portablemedia.png b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png Binary files differindex e44cbe1..e44cbe1 100644 --- a/tools/qvfb/PortableMedia.skin/portablemedia.png +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.png diff --git a/tools/qvfb/PortableMedia.skin/portablemedia.xcf b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf Binary files differindex 127e07c..127e07c 100644 --- a/tools/qvfb/PortableMedia.skin/portablemedia.xcf +++ b/tools/shared/deviceskin/skins/PortableMedia.skin/portablemedia.xcf diff --git a/tools/qvfb/S60-QVGA-Candybar.qrc b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc index 8138484..8138484 100644 --- a/tools/qvfb/S60-QVGA-Candybar.qrc +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.qrc diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png Binary files differindex 89d40cb..89d40cb 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar-down.png diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png Binary files differindex 0d0e598..0d0e598 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.png diff --git a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin index 4f8fe5d..4f8fe5d 100644 --- a/tools/qvfb/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/S60-QVGA-Candybar.skin diff --git a/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf index e349dbc..e349dbc 100644 --- a/tools/qvfb/ClamshellPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/S60-QVGA-Candybar.skin/defaultbuttons.conf diff --git a/tools/qvfb/S60-nHD-Touchscreen.qrc b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc index daf0cc3..daf0cc3 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.qrc +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.qrc diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png Binary files differindex 7253e38..7253e38 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen-down.png diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png Binary files differindex 675563e..675563e 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.png diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin index ed25d0e..ed25d0e 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/S60-nHD-Touchscreen.skin diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf index 6665125..6665125 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/S60-nHD-Touchscreen.skin/defaultbuttons.conf diff --git a/tools/qvfb/SmartPhone.qrc b/tools/shared/deviceskin/skins/SmartPhone.qrc index 8bb5325..8bb5325 100644 --- a/tools/qvfb/SmartPhone.qrc +++ b/tools/shared/deviceskin/skins/SmartPhone.qrc diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png Binary files differindex d0db2ed..d0db2ed 100644 --- a/tools/qvfb/SmartPhone.skin/SmartPhone-pressed.png +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone-pressed.png diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone.png b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png Binary files differindex e6ac5a0..e6ac5a0 100644 --- a/tools/qvfb/SmartPhone.skin/SmartPhone.png +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.png diff --git a/tools/qvfb/SmartPhone.skin/SmartPhone.skin b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin index 2f44c5a..2f44c5a 100644 --- a/tools/qvfb/SmartPhone.skin/SmartPhone.skin +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/SmartPhone.skin diff --git a/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf index 1103350..1103350 100644 --- a/tools/qvfb/DualScreenPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/SmartPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/SmartPhone2.qrc b/tools/shared/deviceskin/skins/SmartPhone2.qrc index 751e985..751e985 100644 --- a/tools/qvfb/SmartPhone2.qrc +++ b/tools/shared/deviceskin/skins/SmartPhone2.qrc diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png Binary files differindex d4eb5b0..d4eb5b0 100644 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2-pressed.png +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2-pressed.png diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2.png b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png Binary files differindex 48ccc1c..48ccc1c 100644 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2.png +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.png diff --git a/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin index 16884bf..16884bf 100644 --- a/tools/qvfb/SmartPhone2.skin/SmartPhone2.skin +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/SmartPhone2.skin diff --git a/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf index b083203..b083203 100644 --- a/tools/qvfb/SmartPhone2.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/SmartPhone2.skin/defaultbuttons.conf diff --git a/tools/qvfb/SmartPhoneWithButtons.qrc b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc index f3393ba..f3393ba 100644 --- a/tools/qvfb/SmartPhoneWithButtons.qrc +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.qrc diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png Binary files differindex 456a068..456a068 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons-pressed.png diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png Binary files differindex 5ffbd6e..5ffbd6e 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.png diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin index 9afa67f..9afa67f 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/SmartPhoneWithButtons.skin diff --git a/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf index ebd6926..ebd6926 100644 --- a/tools/qvfb/SmartPhoneWithButtons.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/SmartPhoneWithButtons.skin/defaultbuttons.conf diff --git a/tools/qvfb/TouchscreenPhone.qrc b/tools/shared/deviceskin/skins/TouchscreenPhone.qrc index 023144d..023144d 100644 --- a/tools/qvfb/TouchscreenPhone.qrc +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.qrc diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png Binary files differindex 01acb86..01acb86 100644 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone-pressed.png +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone-pressed.png diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png Binary files differindex e90de0d..e90de0d 100644 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.png +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.png diff --git a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin index 24316a1..24316a1 100644 --- a/tools/qvfb/TouchscreenPhone.skin/TouchscreenPhone.skin +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/TouchscreenPhone.skin diff --git a/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf index a13dfdc..a13dfdc 100644 --- a/tools/qvfb/TouchscreenPhone.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/TouchscreenPhone.skin/defaultbuttons.conf diff --git a/tools/qvfb/Trolltech-Keypad.qrc b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc index 4775068..4775068 100644 --- a/tools/qvfb/Trolltech-Keypad.qrc +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.qrc diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png Binary files differindex 8dd5719..8dd5719 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-closed.png diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png Binary files differindex 5e1e6be..5e1e6be 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad-down.png +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad-down.png diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png Binary files differindex fb3d549..fb3d549 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.png +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.png diff --git a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin index 4d90321..4d90321 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/Trolltech-Keypad.skin +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/Trolltech-Keypad.skin diff --git a/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf index 6a78e67..6a78e67 100644 --- a/tools/qvfb/Trolltech-Keypad.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/Trolltech-Keypad.skin/defaultbuttons.conf diff --git a/tools/qvfb/Trolltech-Touchscreen.qrc b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc index 40fafeb..40fafeb 100644 --- a/tools/qvfb/Trolltech-Touchscreen.qrc +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.qrc diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png Binary files differindex c1a422f..c1a422f 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen-down.png diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png Binary files differindex 544a425..544a425 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.png diff --git a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin index 5de882e..5de882e 100644 --- a/tools/qvfb/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/Trolltech-Touchscreen.skin diff --git a/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf index 6665125..6665125 100644 --- a/tools/qvfb/S60-nHD-Touchscreen.skin/defaultbuttons.conf +++ b/tools/shared/deviceskin/skins/Trolltech-Touchscreen.skin/defaultbuttons.conf diff --git a/util/install/archive/archive.pro b/util/install/archive/archive.pro deleted file mode 100644 index e313a4a..0000000 --- a/util/install/archive/archive.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = lib -CONFIG += staticlib -CONFIG += qt x11 -CONFIG -= dll -TARGET = arq - -SOURCES += qarchive.cpp ../keygen/keyinfo.cpp -HEADERS += qarchive.h -!zlib:unix:LIBS += -lz diff --git a/util/install/archive/qarchive.cpp b/util/install/archive/qarchive.cpp deleted file mode 100644 index dd51c65..0000000 --- a/util/install/archive/qarchive.cpp +++ /dev/null @@ -1,471 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qarchive.h" -#include <qdatastream.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qapplication.h> -#include "../../../src/3rdparty/zlib/zlib.h" -#include "../keygen/keyinfo.h" -#ifdef Q_OS_UNIX -# include <sys/stat.h> -# include <unistd.h> -# include <sys/types.h> -# include <utime.h> -#endif - -enum ChunkType { - ChunkDirectory = 0, - ChunkFile = 1, - ChunkSymlink = 2, - ChunkBeginHeader = 3, - ChunkEndHeader = 4 -}; - -static bool createDir( const QString& fullPath ) -{ - QStringList hierarchy = QStringList::split( QDir::separator(), fullPath ); - QString pathComponent, tmpPath; - QDir dirTmp; -#ifdef Q_OS_UNIX - dirTmp = "/"; -#endif - - for( QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it ) { - pathComponent = *it + QDir::separator(); - tmpPath += pathComponent; - if (!dirTmp.exists(tmpPath) && !dirTmp.mkdir(tmpPath)) - return false; - } - return true; -} - -QArchive::QArchive( const QString& archivePath ) -{ - setPath( archivePath ); - - bufferSize = 512 * 1024; -} - -QArchive::~QArchive() -{ -} - -void QArchive::setPath( const QString& archivePath ) -{ - QString fullName = archivePath; - if( fullName.right( 4 ) != ".arq" ) - fullName += ".arq"; - arcFile.setName( fullName ); -} - -bool QArchive::open( int mode ) -{ - switch( mode ) { - case IO_ReadOnly: - // Fallthrough intentional - case IO_WriteOnly: - if( arcFile.open( mode ) ) - return true; - break; - } - return false; -} - -void QArchive::close() -{ - if( arcFile.isOpen() ) - arcFile.close(); -} - -bool QArchive::writeFile( const QString& fileName, const QString& localPath ) -{ - if( arcFile.isOpen() ) { - QDataStream outStream( &arcFile ); - QFileInfo fi( fileName ); - - QFile inFile( fi.absFilePath() ); - QByteArray inBuffer; - QByteArray outBuffer( bufferSize ); - z_stream ztream; - bool continueCompressing; - - if(symbolicLinks() && fi.isSymLink()) { - outStream << (int)ChunkSymlink; - outStream << fi.fileName().latin1(); - outStream << fi.readLink().latin1(); - } else if( inFile.open( IO_ReadOnly ) ) { - if( inBuffer.resize( fi.size() ) ) { - outStream << (int)ChunkFile; - outStream << fi.fileName().latin1(); - outStream << fi.lastModified(); - { - int perm = -1; -#ifdef Q_OS_UNIX - struct stat st; - if(!::stat(fi.filePath().latin1(), &st)) - perm = (int)st.st_mode; -#endif - outStream << perm; - } - if( verbosityMode & Source ) - emit operationFeedback( "Deflating " + fi.absFilePath() + "..." ); - else if( verbosityMode & Destination ) - emit operationFeedback( "Deflating " + localPath + "/" + fi.fileName() + "..." ); - ztream.next_in = (unsigned char*)inBuffer.data(); - ztream.avail_in = inBuffer.size(); - ztream.total_in = 0; - ztream.next_out = (unsigned char*)outBuffer.data(); - ztream.avail_out = outBuffer.size(); - ztream.total_out = 0; - ztream.msg = NULL; - ztream.zalloc = (alloc_func)NULL; - ztream.zfree = (free_func)NULL; - ztream.opaque = (voidpf)NULL; - ztream.data_type = Z_BINARY; - deflateInit( &ztream, 9 ); - if ( inBuffer.data() ) - inFile.readBlock( inBuffer.data(), inBuffer.size() ); - - continueCompressing = true; - while( continueCompressing ) { - if(qApp) - qApp->processEvents(); - continueCompressing = ( deflate( &ztream, Z_FINISH ) == Z_OK ); - if( !ztream.avail_out ) { - if( !outBuffer.resize( outBuffer.size() + bufferSize ) ) - qFatal( "Could not allocate compression buffer!" ); - ztream.next_out = (unsigned char*)&outBuffer.data()[ ztream.total_out ]; - ztream.avail_out = bufferSize; - } - } - - emit operationFeedback( QString( "done. %1 => %2 (%3%)\n" ) - .arg( ztream.total_in ) - .arg( ztream.total_out ) - .arg( int( - double( ztream.total_out ) / double( ztream.total_in ) * 100 ) ) ); - deflateEnd( &ztream ); - // Now write the compressed data to the output - outStream << ztream.total_out; - outStream.writeRawBytes( outBuffer.data(), ztream.total_out ); - } - inFile.close(); - return true; - } else { - return false; - } - } - return false; -} - -bool QArchive::setDirectory( const QString& dirName ) -{ - if( arcFile.isOpen() ) { - QString fullName = dirName; - QDataStream outStream( &arcFile ); - if( fullName.right( 1 ) != "/" ) - fullName += "/"; - outStream << (int)ChunkDirectory; - outStream << fullName.latin1(); - return true; - } - return false; -} - -bool QArchive::writeHeader( const QArchiveHeader header ) -{ - if( arcFile.isOpen() ) { - QDataStream outStream( &arcFile ); - outStream << (int)ChunkBeginHeader; - outStream << header.mayorVersion(); - outStream << header.minorVersion(); - outStream << header.features(); - outStream << header.description(); - outStream << header.extraData; - outStream << (int)ChunkEndHeader; - return true; - } - return false; -} - -bool QArchive::writeDir( const QString &dirName1, bool includeLastComponent, const QString &localPath1 ) -{ - if( arcFile.isOpen() ) { - QString localPath = localPath1, dirName = dirName1; - if(localPath.right(1) == "/") - localPath.truncate(localPath.length()-1); - if(dirName.right(1) == "/") - dirName.truncate(dirName.length()-1); - - QFileInfo fi( dirName ); - - if( includeLastComponent ) - setDirectory( fi.fileName() ); - QDir dir( dirName ); - const QFileInfoList* dirEntries = dir.entryInfoList(); - QFileInfoListIterator dirIter( *dirEntries ); - QDataStream outStream( &arcFile ); - QFileInfo* pFi; - - dirIter.toLast(); - while( ( pFi = dirIter.current() ) ) { - if( pFi->fileName() != "." && pFi->fileName() != ".." ) { - if( pFi->isDir() ) - writeDir( pFi->absFilePath(), true, localPath + "/" + - pFi->fileName() ); // Subdirs should always get its name in the archive. - else - writeFile( pFi->absFilePath(), localPath ); - } - --dirIter; - } - setDirectory( ".." ); - return true; - } - return false; -} - -bool QArchive::writeFileList( const QStringList fileList ) -{ - for( QStringList::ConstIterator it = fileList.begin(); it != fileList.end(); ++it ) { - if( !writeFile( (*it) ) ) - return false; - } - return true; -} - -bool QArchive::writeDirList( const QStringList dirList, bool includeLastComponent ) -{ - for( QStringList::ConstIterator it = dirList.begin(); it != dirList.end(); ++it ) { - QString lastComponent = (*it).mid( (*it).findRev( "/" ) + 1 ); - if( !writeDir( (*it), includeLastComponent, lastComponent ) ) - return false; - } - return true; -} - -void QArchive::setVerbosity( int verbosity ) -{ - verbosityMode = verbosity; -} - -QArchiveHeader* QArchive::readArchiveHeader() -{ - QDataStream inStream( &arcFile ); - return readArchiveHeader( &inStream ); -} - -/* - Reads the archive header and returns it on success. If an error occurs, it - returns 0. The caller has to delete the object. -*/ -QArchiveHeader* QArchive::readArchiveHeader( QDataStream *inStream ) -{ - int chunktype; - QArchiveHeader *header = new QArchiveHeader; - - *inStream >> chunktype; - if( chunktype == ChunkBeginHeader ) { - *inStream >> header->_mayorVersion; - *inStream >> header->_minorVersion; - if ( header->mayorVersion()!=1 || header->minorVersion()!=0 ) { - emit operationFeedback( "Incompatible package version" ); - delete header; - return 0; - } - *inStream >> header->_features; - *inStream >> header->_description; - *inStream >> header->extraData; - *inStream >> chunktype; - if ( chunktype != ChunkEndHeader ) { - emit operationFeedback( "Invalid package header" ); - delete header; - return 0; - } - } else { - emit operationFeedback( "No package header found." ); - delete header; - return 0; - } - return header; -} - -bool QArchive::readArchive( const QString &outpath, const QString &key ) -{ - QDataStream inStream( &arcFile ); - return readArchive( &inStream, outpath, key ); -} - -bool QArchive::readArchive( QDataStream *inStream, const QString &outpath, const QString &key ) -{ - QDataStream outStream; - QFile outFile; - QDir outDir; - QByteArray inBuffer; - QByteArray outBuffer( bufferSize ); - z_stream ztream; - bool continueDeCompressing; - QString entryName, dirName, symName; - int entryLength, chunktype; - - //get the key - QArchiveHeader *header = readArchiveHeader( inStream ); - if ( header == 0 ) - return false; - uint infeatures = featuresForKey( key ); - if( (header->features() & infeatures) != header->features()) { - emit operationFeedback( "Invalid key" ); - return false; - } - - // Set up the initial directory. - // If the dir does not exist, try to create it - dirName = QDir::toNativeSeparators( outpath ); - outDir.setPath( dirName ); - if( !outDir.exists( dirName ) && !createDir( dirName ) ) - return false; - outDir.cd( dirName ); - - while( !inStream->atEnd() ) { - //get our type - *inStream >> chunktype; - if(chunktype == ChunkDirectory) { - *inStream >> entryLength; - inBuffer.resize( entryLength ); - inStream->readRawBytes( inBuffer.data(), entryLength ); - entryName = inBuffer.data(); - - if( verbosityMode & Source ) - emit operationFeedback( "Directory " + entryName + "... " ); - if( entryName == "../" ) { - outDir.cdUp(); - } else { - dirName = QDir::toNativeSeparators( outDir.absPath() + - QString( "/" ) + entryName.left( entryName.length() - 1 ) ); - if( verbosityMode & Destination ) - emit operationFeedback( "Directory " + dirName + "... " ); - - if( !outDir.exists( dirName ) && !createDir( dirName ) ) { - emit operationFeedback( "Cannot create directory: " + dirName ); - return false; - } - outDir.cd( dirName ); - } - } else if(chunktype == ChunkFile) { - *inStream >> entryLength; - inBuffer.resize( entryLength ); - inStream->readRawBytes( inBuffer.data(), entryLength ); - entryName = inBuffer.data(); - - int filePerm; - QDateTime timeStamp; - QString fileName = QDir::toNativeSeparators( outDir.absPath() + QString( "/" ) + entryName ); - outFile.setName( fileName ); - if( outFile.open( IO_WriteOnly ) ) { - *inStream >> timeStamp; // Get timestamp from the archive - *inStream >> filePerm; - outStream.setDevice( &outFile ); - *inStream >> entryLength; - if( verbosityMode & Source ) - emit operationFeedback( "Expanding " + entryName + "..." ); - else if( verbosityMode & Destination ) - emit operationFeedback( "Expanding " + fileName + "..." ); - inBuffer.resize( entryLength ); - inStream->readRawBytes( inBuffer.data(), entryLength ); - ztream.next_in = (unsigned char*)inBuffer.data(); - ztream.avail_in = entryLength; - ztream.total_in = 0; - ztream.msg = NULL; - ztream.zalloc = (alloc_func)0; - ztream.zfree = (free_func)0; - ztream.opaque = (voidpf)0; - ztream.data_type = Z_BINARY; - inflateInit( &ztream ); - continueDeCompressing = true; - while( continueDeCompressing ) { - ztream.next_out = (unsigned char*)outBuffer.data(); - ztream.avail_out = outBuffer.size(); - ztream.total_out = 0; - continueDeCompressing = ( inflate( &ztream, Z_NO_FLUSH ) == Z_OK ); - outStream.writeRawBytes( outBuffer.data(), ztream.total_out ); - } - inflateEnd( &ztream ); - outFile.close(); -#ifdef Q_OS_UNIX - QDateTime t; t.setTime_t(0); //epoch - struct utimbuf tb; - tb.actime = tb.modtime = t.secsTo(timeStamp); - utime(fileName.local8Bit(), &tb); - if(filePerm != -1) - chmod(fileName.local8Bit(), (mode_t)filePerm); -#endif - } else { - emit operationFeedback( "Cannot open: " + fileName ); - return false; - } - } else if(chunktype == ChunkSymlink) { - *inStream >> entryLength; - inBuffer.resize( entryLength ); - inStream->readRawBytes( inBuffer.data(), entryLength ); - entryName = inBuffer.data(); - QString fileName = QDir::toNativeSeparators( outDir.absPath() + QString( "/" ) + entryName ); - - *inStream >> entryLength; - inBuffer.resize( entryLength ); - inStream->readRawBytes( inBuffer.data(), entryLength ); - symName = inBuffer.data(); - if( verbosityMode & Source ) - emit operationFeedback( "Linking " + symName + "... " ); - else if( verbosityMode & Destination ) - emit operationFeedback( "Linking " + fileName + "... " ); -#ifdef Q_OS_UNIX - symlink( symName.local8Bit(), fileName.local8Bit() ); -#endif - } else { - if( verbosityMode & Source ) - emit operationFeedback( QString("Unknown chunk: %d") .arg(chunktype) ); - } - if( verbosityMode & Progress ) - emit operationFeedback( inStream->device()->at() ); - } - return true; -} - diff --git a/util/install/archive/qarchive.h b/util/install/archive/qarchive.h deleted file mode 100644 index 351a48b..0000000 --- a/util/install/archive/qarchive.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QARCHIVE_H -#define QARCHIVE_H - -#include <qstring.h> -#include <qfile.h> -#include <qstringlist.h> -#include <qobject.h> - -class QArchiveHeader -{ -public: - QArchiveHeader( uint feat, const QString& desc=QString(), uchar mayorVer = 1, uchar minorVer = 0 ) - : _features(feat), _description(desc), _mayorVersion(mayorVer), _minorVersion(minorVer) - {} - - uint features() const - { return _features; } - - QString description() const - { return _description; } - - uchar mayorVersion() const - { return _mayorVersion; } - - uchar minorVersion() const - { return _minorVersion; } - - void addExtraData( const QString& key, const QString& value ) - { extraData.insert( key, value ); } - - QString findExtraData( const QString& key ) const - { return extraData[key]; } - -private: - QArchiveHeader() - {} - - uint _features; - QString _description; - uchar _mayorVersion; - uchar _minorVersion; - QMap<QString,QString> extraData; - - friend class QArchive; -}; - -class QArchive : public QObject -{ - Q_OBJECT -public: - QArchive( const QString& archivePath = QString() ); - ~QArchive(); - - void setPath( const QString& archivePath ); - void setVerbosity( int verbosity ); - - bool symbolicLinks() const { return doSyms; } - void setSymbolicLinks(bool b) { doSyms = b; } - - bool open( int mode ); - void close(); - bool isOpen() { return arcFile.isOpen(); } - - bool writeHeader( const QArchiveHeader header ); - bool writeFile( const QString& fileName, const QString& localPath = QString() ); - bool writeFileList( const QStringList fileList ); - bool writeDir( const QString& dirName, bool includeLastComponent = false, - const QString& localPath = QString() ); - bool writeDirList( const QStringList dirList, bool includeLastComponent = true ); - - QArchiveHeader* readArchiveHeader(); - QArchiveHeader* readArchiveHeader( QDataStream *inStream ); - - bool readArchive( const QString &outpath, const QString &key = QString() ); - bool readArchive( QDataStream *inStream, const QString &outpath, const QString &key = QString() ); -private: - QFile arcFile; - - int bufferSize; - int verbosityMode; - uint doSyms : 1; - bool setDirectory( const QString& dirName ); -signals: - void operationFeedback( const QString& ); - void operationFeedback( int ); - -public: - enum { - NoFeedback = 0x00, - OnlyNames = 0x01, - Verbose = 0x02, - Source = 0x10, - Destination = 0x20, - Progress = 0x40 - }; -}; - -#endif diff --git a/util/install/configure_installer.cache b/util/install/configure_installer.cache deleted file mode 100644 index 9427b74..0000000 --- a/util/install/configure_installer.cache +++ /dev/null @@ -1,30 +0,0 @@ --disable-table --disable-iconview --disable-workspace --disable-xml --disable-network --disable-canvas --disable-opengl --disable-sql --release --static --lean --no-dsp --no-thread --no-accessibility --qt-style-windowsxp --no-style-motif --no-style-cde --no-style-sgi --no-style-motifplus --no-style-platinum --no-big-codecs --no-jpeg --no-png --spec win32-msvc --saveconfig installer --D QT_NO_COLORNAMES --D QT_NO_BEZIER --D QT_NO_EFFECTS --D QT_NO_DIRECTPAINTER --D QT_NO_SVG diff --git a/util/install/install.pro b/util/install/install.pro deleted file mode 100644 index 4106453..0000000 --- a/util/install/install.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS += archive \ - package \ - keygen - -win32:SUBDIRS += win -mac:SUBDIRS += mac diff --git a/util/install/keygen/keygen.pro b/util/install/keygen/keygen.pro deleted file mode 100644 index 59daf75..0000000 --- a/util/install/keygen/keygen.pro +++ /dev/null @@ -1,13 +0,0 @@ -CONFIG += qt console -SOURCES += keyinfo.cpp -keychk { - TEMPLATE = lib - TARGET = keychk - DESTDIR = ../../../lib/ - CONFIG -= shared dll - CONFIG += staticlib -} else { - TEMPLATE = app - TARGET = keygen - SOURCES += main.cpp -}
\ No newline at end of file diff --git a/util/install/keygen/keyinfo.cpp b/util/install/keygen/keyinfo.cpp deleted file mode 100644 index 9ad5404..0000000 --- a/util/install/keygen/keyinfo.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qregexp.h> - -#include "keyinfo.h" - -// Magic values -enum { - ProductMagic = 0xB292, - PlatformMagic = 0x5C7E, - LicenseSchemaMagic = 0xE3B, - LicenseIDMagic = 0xCE57, - FeatureMagic = 0x4D5 -}; - -static const char Xalphabet[] = "WX9MUEC7AJH3KS6DB4YFG2L5PQRT8VNZ"; -static const int XAlphabetSize = sizeof(Xalphabet) - 1; - -static QString encodeBaseX(uint k) -{ - QString str; - do { - str += QChar(Xalphabet[ k % XAlphabetSize ]); - k /= XAlphabetSize; - } while (k > 0u); - return str; -} - -static uint decodeBaseX(const QString &str) -{ - uint k = 0; - int i = str.length(); - while (i > 0) { - i--; - const char *p = strchr(Xalphabet, str[i].unicode()); - if (p == 0) { - return 0; - } else { - k = (k * XAlphabetSize) + (p - Xalphabet); - } - } - return k; -} - -static const QDate StartDate(2001, 1, 1); -static const uint MaxDays = 4000; - -static QString encodedExpiryDate(const QDate &date) -{ - uint days = StartDate.daysTo(date); - if (days >= MaxDays) - days = MaxDays - 1; - uint x = (days << 7) ^ days; - return encodeBaseX(x ^ 0x0000beef); -} - -static QDate decodedExpiryDate(const QString &encodedDate) -{ - QDate date; - uint y = decodeBaseX(encodedDate); - uint x = y ^ 0x0000beef; - uint days = ( (x >> 7) ^ x ) >> 7; - if (days >= MaxDays) - return QDate(); - date = StartDate.addDays( days ); - if (encodedExpiryDate(date) != encodedDate) - return QDate(); - return date; -} - -bool decodeLicenseKey(const QString &licenseKey, - uint *products, - uint *platforms, - uint *licenseSchema, - uint *licenseFeatures, - uint *licenseID, - QDate *expiryDate) -{ - QStringList licenseParts; - int dash = -1; - do { - int start = dash + 1; - dash = licenseKey.indexOf('-', start); - licenseParts.append(licenseKey.mid(start, dash - start)); - } while (dash != -1); - - // license keys have 7 fields - if (licenseParts.size() != 7) { - // invalid key - return false; - } - QString productPart = licenseParts.at(0); - QString platformPart = licenseParts.at(1); - QString licenseSchemaPart = licenseParts.at(2); - QString licenseFeaturesPart = licenseParts.at(3); - QString licenseIDPart = licenseParts.at(4); - QString expiryDatePart = licenseParts.at(5); - QString checksumPart = licenseParts.at(6); - QString keyPart = productPart - + '-' + platformPart - + '-' + licenseSchemaPart - + '-' + licenseFeaturesPart - + '-' + licenseIDPart - + '-' + expiryDatePart; - - // verify the crc - QByteArray ba = keyPart.toLatin1(); - int crc = qChecksum(ba.constData(), ba.size()); - QString checksumVerification = QString("%1%2") - .arg((crc & 0xff),2,16,QChar('0')) - .arg((crc >> 8 & 0xff),2,16,QChar('0')) - .toUpper(); - if (checksumPart != checksumVerification) { - // invalid checksum - return false; - } - - *products = decodeBaseX(productPart) ^ ProductMagic; - *platforms = decodeBaseX(platformPart) ^ PlatformMagic; - *licenseSchema = decodeBaseX(licenseSchemaPart) ^ LicenseSchemaMagic; - *licenseFeatures = decodeBaseX(licenseFeaturesPart) ^ FeatureMagic; - *licenseID = decodeBaseX(licenseIDPart) ^ LicenseIDMagic; - *expiryDate = decodedExpiryDate(expiryDatePart); - return true; -} diff --git a/util/install/keygen/keyinfo.h b/util/install/keygen/keyinfo.h deleted file mode 100644 index 9b3687a..0000000 --- a/util/install/keygen/keyinfo.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef KEYINFO_H -#define KEYINFO_H - -// Products -enum { - // the first 10 bits are reserved for Qt editions - QtUniversal = 0x00000001, - QtDesktop = 0x00000002, - QtDesktopLight = 0x00000004, - QtConsole = 0x00000008, - QtDesignerOnly = 0x00000010, - QtReserved1 = 0x00000020, - QtReserved2 = 0x00000040, - QtReserved3 = 0x00000080, - QtReserved4 = 0x00000100, - QtReserved5 = 0x00000200, - QtProductMask = 0x000003ff, - - // the next 10 bits are reserved for Qtopia editions - QtopiaPDA = 0x00000400, - QtopiaPhone = 0x00000800, - QtopiaRefboard = 0x00001000, - QtopiaReserved1 = 0x00002000, - QtopiaReserved2 = 0x00004000, - QtopiaReserved3 = 0x00008000, - QtopiaReserved4 = 0x00010000, - QtopiaReserved5 = 0x00020000, - QtopiaReserved6 = 0x00040000, - QtopiaReserved7 = 0x00080000, - - // other products get the upper 12 bits - Teambuilder = 0x00100000, - Solutions = 0x00200000, - QSA = 0x00400000, - OtherReserved1 = 0x00800000, - OtherReserved2 = 0x01000000, - OtherReserved3 = 0x02000000, - OtherReserved4 = 0x04000000, - OtherReserved5 = 0x08000000, - OtherReserved6 = 0x10000000, - OtherReserved7 = 0x20000000, - OtherReserved8 = 0x40000000, - OtherReserved9 = 0x80000000, -}; - -// Platforms -enum { - PlatformX11 = 0x01, - PlatformEmbedded = 0x02, - PlatformWindows = 0x04, - PlatformMac = 0x08 -}; - -// LicenseSchema -enum { - SupportedEvaluation = 0x01, - UnsupportedEvaluation = 0x02, - FullSourceEvaluation = 0x04, - FullCommercial = 0x08 -}; - -// LicenseFeatures -enum { - USCustomer = 0x01 -}; - -#include <qdatetime.h> -#include <qstring.h> - -/* - Decodes the \a licenseKey. This function returns true if 1) decoding - was successful and 2) the checksum matches, otherwise it returns false. -*/ -bool decodeLicenseKey(const QString &licenseKey, - uint *products, - uint *platforms, - uint *licenseSchema, - uint *licenseFeatures, - uint *licenseID, - QDate *expiryDate); - -#endif diff --git a/util/install/keygen/main.cpp b/util/install/keygen/main.cpp deleted file mode 100644 index b6eee41..0000000 --- a/util/install/keygen/main.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qfile.h> - -#include <stdio.h> -#include <stdlib.h> - -#include "keyinfo.h" - -static void printNewKey( uint features, const QDate& expiryDate ) -{ - QFile in; - QFile out; - QString fn; - char block[10]; - - fn.sprintf( "next.%.2x", features ); - in.setFileName( fn ); - if ( !in.open(QFile::ReadOnly) ) - return; - int ent = QString( in.readAll() ).toInt(); - in.close(); - - fn.sprintf( "table.%.2x", features ); - in.setFileName( fn ); - if ( !in.open(QFile::ReadOnly) ) - return; - in.seek( ent * 10 ); - in.read( block, 9 ); - block[9] = '\0'; - in.close(); - - ent++; - if ( ent == (1 << NumRandomBits) ) - ent = 1; // skip first entry - - fn.sprintf( "next.%.2x", features ); - out.setFileName( fn ); - if ( !out.open(QFile::WriteOnly) ) - return; - QString s = QString::number( ent ) + QChar( '\n' ); - out.write( s.toLocal8Bit(), s.length() ); - out.close(); - - if ( strlen(block) == 9 && block[4] == '-' ) - printf( "%s%s\n", block, qPrintable(encodedExpiryDate(expiryDate)) ); -} - -static QString textForFeatures( uint features ) -{ - QString text; - - if ( (features & Feature_US) != 0 ) - text += QString( " -us" ); - if ( (features & Feature_Enterprise) != 0 ) - text += QString( " -enterprise" ); - if ( (features & Feature_Unix) != 0 ) - text += QString( " -unix" ); - if ( (features & Feature_Windows) != 0 ) - text += QString( " -windows" ); - if ( (features & Feature_Mac) != 0 ) - text += QString( " -mac" ); - if ( (features & Feature_Embedded) != 0 ) - text += QString( " -embedded" ); - if ( (features & Feature_Extra1) != 0 ) - text += QString( " -extra1" ); - if ( (features & Feature_Extra2) != 0 ) - text += QString( " -extra2" ); - - text = text.trimmed(); - if ( text.isEmpty() ) - text = QString( "invalid key" ); - return text; -} - -static QString textForDate( const QDate& date ) -{ - if ( date.isValid() ) { - return date.toString( Qt::ISODate ); - } else { - return QString( "invalid date" ); - } -} - -static void reset() -{ - for ( uint features = 0; features < (1 << NumFeatures); features++ ) { - printf( "Resetting 'table.%.2x' and 'next.%.2x' (%s)\n", features, - features, qPrintable(textForFeatures(features)) ); - - QFile out; - QString fn; - - fn.sprintf( "table.%.2x", features ); - out.setFileName( fn ); - if ( !out.open(QFile::WriteOnly) ) { - fprintf( stderr, "Cannot open '%s' for writing\n", qPrintable(fn) ); - exit( EXIT_FAILURE ); - } - - for ( uint bits = 0; bits < (1 << NumRandomBits); bits++ ) { - QString k = keyForFeatures( features, bits ) + QChar( '\n' ); - out.write( k.toLatin1(), k.length() ); - - /* - We check that the generated keys give access to the - correct feature sets. This accounts for most of the - processing time of the function. - */ -#if 1 - if ( featuresForKey(k) != features ) { - fprintf( stderr, "Internal error in featuresForKey(\"%s\")\n", - qPrintable(k.trimmed()) ); - exit( EXIT_FAILURE ); - } - if ( (features & ~(Feature_US | Feature_Enterprise | - Feature_Unix)) == 0 ) { - if ( featuresForKeyOnUnix(k) != features ) { - fprintf( stderr, - "Internal error in featuresForKeyOnUnix(\"%s\")\n", - qPrintable(k.trimmed()) ); - exit( EXIT_FAILURE ); - } - } -#endif - } - out.close(); - - fn.sprintf( "next.%.2x", features ); - out.setFileName( fn ); - if ( !out.open(QFile::WriteOnly) ) { - fprintf( stderr, "Cannot open '%s' for writing\n", qPrintable(fn) ); - exit( EXIT_FAILURE ); - } - out.write( "1\n", 2 ); // skip first key - out.close(); - } -} - -int main( int argc, char **argv ) -{ - if ( argc == 1 || (strcmp(argv[1], "check") != 0 && - strcmp(argv[1], "new") != 0 && - strcmp(argv[1], "reset") != 0) ) { - fprintf( stderr, "Usage:\n" - " keygen check <key>\n" - " keygen new YYYY-MM-DD [-us] [-enterprise] [-unix]\n" - " [-windows] [-mac] [-embedded] [-extra1] [-extra2]\n" - " keygen reset\n" ); - exit( EXIT_FAILURE ); - } - - if ( strcmp(argv[1], "check") == 0 ) { - if ( argc != 3 ) { - fprintf( stderr, "Usage:\n" - " mkcode check <key>\n" ); - exit( EXIT_FAILURE ); - } - - QString key( argv[2] ); - - printf("Unix check: %s\n", - qPrintable(textForFeatures(featuresForKeyOnUnix(QString(argv[2]))))); - printf("Full check: %s\n", - qPrintable(textForFeatures(featuresForKey(QString(argv[2]))))); - if ( featuresForKey(QString(argv[2])) != 0 ) - printf("Expiry date: %s\n", - qPrintable(textForDate(decodedExpiryDate(key.mid(9))))); - } else if ( strcmp(argv[1], "new") == 0 ) { - uint features = 0; - - if ( argc < 3 ) { - fprintf( stderr, "Usage:\n" - " mkcode new YYYY-MM-DD [features]\n" ); - exit( EXIT_FAILURE ); - } - - QDate expiryDate = QDate::fromString( QString(argv[2]), Qt::ISODate ); - if ( !expiryDate.isValid() ) { - fprintf( stderr, "Date '%s' not in YYYY-MM-DD format\n", argv[2] ); - exit( EXIT_FAILURE ); - } - - for ( int i = 3; i < argc; i++ ) { - if ( strcmp(argv[i], "-us") == 0 ) { - features |= Feature_US; - } else if ( strcmp(argv[i], "-enterprise") == 0 ) { - features |= Feature_Enterprise; - } else if ( strcmp(argv[i], "-unix") == 0 ) { - features |= Feature_Unix; - } else if ( strcmp(argv[i], "-windows") == 0 ) { - features |= Feature_Windows; - } else if ( strcmp(argv[i], "-mac") == 0 ) { - features |= Feature_Mac; - } else if ( strcmp(argv[i], "-embedded") == 0 ) { - features |= Feature_Embedded; - } else if ( strcmp(argv[i], "-extra1") == 0 ) { - features |= Feature_Extra1; - } else if ( strcmp(argv[i], "-extra2") == 0 ) { - features |= Feature_Extra2; - } else { - fprintf( stderr, "Unknown flag '%s'\n", argv[i] ); - exit( EXIT_FAILURE ); - } - } - printNewKey( features, expiryDate ); - } else { - reset(); - } - return 0; -} diff --git a/util/install/mac/licensedlg.ui b/util/install/mac/licensedlg.ui deleted file mode 100644 index a20bd44..0000000 --- a/util/install/mac/licensedlg.ui +++ /dev/null @@ -1,134 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>LicenseDialog</class> -<widget class="QDialog"> - <property name="name"> - <cstring>LicenseDialog</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>582</width> - <height>531</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="caption"> - <string>License Agreement</string> - </property> - <property name="sizeGripEnabled"> - <bool>true</bool> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QTextView"> - <property name="name"> - <cstring>licenseText</cstring> - </property> - <property name="text"> - <string>License text goes here</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout1</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <spacer> - <property name="name" stdset="0"> - <cstring>Horizontal Spacing2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonReject</cstring> - </property> - <property name="text"> - <string>Reject</string> - </property> - <property name="accel"> - <number>0</number> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - <property name="default"> - <bool>true</bool> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>buttonAccept</cstring> - </property> - <property name="text"> - <string>Accept</string> - </property> - <property name="accel"> - <number>0</number> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - </widget> - </hbox> - </widget> - </vbox> -</widget> -<connections> - <connection> - <sender>buttonReject</sender> - <signal>pressed()</signal> - <receiver>LicenseDialog</receiver> - <slot>reject()</slot> - </connection> - <connection> - <sender>buttonAccept</sender> - <signal>clicked()</signal> - <receiver>LicenseDialog</receiver> - <slot>reject()</slot> - </connection> - <connection> - <sender>buttonAccept</sender> - <signal>pressed()</signal> - <receiver>LicenseDialog</receiver> - <slot>accept()</slot> - </connection> -</connections> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/mac/licensedlgimpl.cpp b/util/install/mac/licensedlgimpl.cpp deleted file mode 100644 index ed2998a..0000000 --- a/util/install/mac/licensedlgimpl.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "licensedlgimpl.h" -#include <qfile.h> -#include <qtextview.h> - -LicenseDialogImpl::LicenseDialogImpl( QWidget *parent ) - : LicenseDialog( parent ) -{ -} - -bool LicenseDialogImpl::showLicense( bool licenseUs ) -{ - QFile f; - QString path = "qt-mac-commercial-3.0.0.app/Contents/Qt/LICENSE"; - if (licenseUs) - path.append( "-US" ); - f.setName( path ); - if ( !f.open( IO_ReadOnly ) ) - return false; - - QTextStream ts( &f ); - licenseText->setText( ts.read() ); - return true; -} - - diff --git a/util/install/mac/licensedlgimpl.h b/util/install/mac/licensedlgimpl.h deleted file mode 100644 index 90f8809..0000000 --- a/util/install/mac/licensedlgimpl.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef __LICENSEDLGIMPL_H__ -#define __LICENSEDLGIMPL_H__ - -#include "licensedlg.h" - -class LicenseDialogImpl : public LicenseDialog -{ - Q_OBJECT - -public: - LicenseDialogImpl( QWidget* parent = 0 ); - bool showLicense( bool licenseUs ); -}; - -#endif /* __LICENSEDLGIMPL_H__ */ diff --git a/util/install/mac/mac.pro b/util/install/mac/mac.pro deleted file mode 100644 index ad13bea..0000000 --- a/util/install/mac/mac.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app -TARGET = unpackage -mac:TARGET = qt-mac-commercial-3.0.0 -mac:RC_FILE = unpackage.icns -HEADERS = unpackdlgimpl.h licensedlgimpl.h -SOURCES = main.cpp unpackdlgimpl.cpp licensedlgimpl.cpp -INTERFACES += unpackdlg.ui licensedlg.ui -INCLUDEPATH += ../archive ../keygen -CONFIG += qt -unix:LIBS += -L$$QT_BUILD_TREE/util/install/archive -larq - diff --git a/util/install/mac/main.cpp b/util/install/mac/main.cpp deleted file mode 100644 index ede85a6..0000000 --- a/util/install/mac/main.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "unpackdlgimpl.h" -#include "qarchive.h" -#include <qapplication.h> -#include <qdir.h> -#include <qfileinfo.h> - -class ConsoleOutput : public QObject -{ - Q_OBJECT -public: - ConsoleOutput() : QObject() { } - ~ConsoleOutput() { } -public slots: - void updateProgress( const QString& str) { qDebug("%s", str.latin1()); } -}; -#include "main.moc" - -static int usage(const char *argv0, const char *un=NULL) { - if(un) - fprintf(stderr, "Unknown command: %s\n", un); - else - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "%s [options] files...\n", argv0); - - fprintf(stderr, "\nOptions:\n"); - fprintf(stderr, " -k [k] : Use k as the key to open provided files\n"); - fprintf(stderr, " -s : Quiet mode, will not output process\n"); - fprintf(stderr, " -h : This help\n"); - return 665; -} - -int main( int argc, char** argv ) -{ - QString key; - bool output = true; - QStringList files; - QApplication app( argc, argv ); - for(int i = 1; i < argc; i++) { - //options - if(!strcmp(argv[i], "-s")) - output = false; - else if(!strcmp(argv[i], "-k")) - key = argv[++i]; - else if(!strcmp(argv[i], "-h")) - return usage(argv[0]); - //files - else if(*(argv[i]) != '-') - files.append(argv[i]); - //unknown - else - return usage(argv[0], argv[i]); - } - if(!files.isEmpty()) { - QArchive archive; - ConsoleOutput out; - QObject::connect( &archive, SIGNAL( operationFeedback( const QString& ) ), - &out, SLOT( updateProgress( const QString& ) ) ); - if(output) - archive.setVerbosity( QArchive::Destination | QArchive::Verbose ); - for(QStringList::Iterator it = files.begin(); it != files.end(); ++it) { - archive.setPath( (*it) ); - if( !archive.open( IO_ReadOnly ) ) { - qDebug("Failed to open input %s", (*it).latin1()); - continue; - } - if(!archive.readArchive( QDir::currentDirPath(), key )) - qDebug("Failed to unpack %s", (*it).latin1()); - archive.close(); - } - } else { - UnpackDlgImpl dlg(key); - dlg.exec(); - } - return 0; -} - diff --git a/util/install/mac/unpackage.icns b/util/install/mac/unpackage.icns Binary files differdeleted file mode 100644 index 20139b9..0000000 --- a/util/install/mac/unpackage.icns +++ /dev/null diff --git a/util/install/mac/unpackdlg.ui b/util/install/mac/unpackdlg.ui deleted file mode 100644 index ba4898e..0000000 --- a/util/install/mac/unpackdlg.ui +++ /dev/null @@ -1,330 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>UnpackDlg</class> -<widget class="QDialog"> - <property name="name"> - <cstring>UnpackDlg</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>678</width> - <height>337</height> - </rect> - </property> - <property name="caption"> - <string>Install unpacking tool</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout24</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>pixmapLabel</cstring> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>AlignAuto|AlignTop</set> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout23</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>headerLabel</cstring> - </property> - <property name="font"> - <font> - <bold>1</bold> - </font> - </property> - <property name="text"> - <string>Open Qt/CD Package</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout22</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout21</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout19</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>destLabel</cstring> - </property> - <property name="text"> - <string>Destination path:</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Spacer12</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Fixed</enum> - </property> - <property name="sizeHint"> - <size> - <width>1</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QLineEdit"> - <property name="name"> - <cstring>destPath</cstring> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>destButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - <property name="pixmap"> - <pixmap>image1</pixmap> - </property> - </widget> - </hbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout20</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>TextLabel1</cstring> - </property> - <property name="text"> - <string>License Key:</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Spacer13</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Fixed</enum> - </property> - <property name="sizeHint"> - <size> - <width>24</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QLineEdit"> - <property name="name"> - <cstring>srcKey</cstring> - </property> - </widget> - </hbox> - </widget> - </vbox> - </widget> - <widget class="QTextView"> - <property name="name"> - <cstring>logOutput</cstring> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout4</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <spacer> - <property name="name"> - <cstring>Spacer1</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>unpackButton</cstring> - </property> - <property name="text"> - <string>Unpack</string> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>cancelButton</cstring> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Spacer2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </vbox> - </widget> - </vbox> - </widget> - </hbox> - </widget> - </vbox> -</widget> -<images> - <image name="image0"> - <data format="XPM.GZ" length="30371">789cdd7c594f23cbb6e6fbf9155b27de8e5a716d8c01abd50f600633786286abfb105366da608cb10dc657fddf7bc51ac269a04e517b975abbbb5096fd919991b1e62122f98f7ffd71db6bfff1affff8c774666603f7872bcccb1ffff2f3d1e8fd3fffeb7ffdf73ffe59ad54fe88c7d646e58f8d7ffe8f7ffc53cdff707fa80afe43dc4f782762a30457f1bc394b18cfab19e34dbebf9730ddff2e98eeb72b4cf74f19efd0fdd6248ce77d5730df5f3076747d6811aef2fc3d3fbfcaf3b123c43b429f794a98e6f72898c7cf12a6f97519f378669430ddaf05f3fd2a61babfc398e9332661ba7f2998ef6f244cf4df0bdea0f33963a6df0e13a6f17605d378be92309ecf64fe8ec653fc3ce15fe8264ce38d198b7c5f18333de18cb1cce736e26a925fa831e6f3d95ec278de6ac134df704f58e6935f0ba6f3ee2561baff5c30d1631e18f37cf384f9fe5dc63c7f25f7f3fc4c9bf0063fdf0e180bfd743ed16b4e09cbf5ca3296eb0d63799e62ccf717680f1b69fcbc9730c9eb5630db5f83318f97df244cfab2c758e4b1245c93f9bd32e6e76533c63c9ea7f934d2f58eb15c7f9f30e9478db1e8f73963b14f7a5e6393c7731b11d7aae9fa2163996f3f611aff96b0dcaf7cc278de7519cbfc91dfb586dcef2784e5fe2c4b18cf177b8299bf0bc64caf9b264cf67c2698ae57323e3fdf2d13a6f9cbf8c28f9384c93e503f37abc25ff3cc58c6d38465bce25030db4b9b318faf2e1226fa2f05b37fb9215c677ee846c244df1be33af3eb4130dd5ff0fcea0dd63ff4a79b46e6af34639e8fa3f99a3af3d7e78cebec8f9a8c793c95254cf2ed0866fb1d11deaa32fde8bfeb1b222f7b40b8eed97eee046f3470fea784b7aa3cfebd60a66f91309d7f124cfea5088c991fe199313f2f3f466c923ce8fa447f7e4578ab5aabe2f88e318f674e12a6f17605d3f39d67ccfc513b8299bf4a305d9f3f32e6f915fb82f9fa8b84495f3a82f9fe82f036f3c7d884c9fff604d3f5d99c31cfdf22ffb622bf895f0709d3f3d279a6f79031df1f3619376a28bf7cc998e71b2e05f3f3657c4fd79b09e134df8560be7e85f1fac0e36fb33cec3861badf0a667d183166fdcd0682999f7dc1cc4f94d7569257a810deaed27cb30ee33acd27ef0a267db1778c797cbd2d98c6f7af09d3787dc1747fd64d18cfab0563d607fb9030f1775f308d1f2e12267eed08e6f15b8477449efb82597ff1feed9ae89f191016f9e81dc6cc6fffc058ec792998edf55130c7ff3bc2f2bc6012c6f9fa53c1345fb3c198e5998784897fcf82f9fa2663e66f2ef7337f3deacbb615f9e409f3f89631cfd70f09efb07db93bc1ac9f26619acf89e04d7c5ede66ccf32d0ac63c1fbbcb58f8f396305eef2682e9fa624ab8c1f2c85e04d3f5f655305d1fd0de776a22ff901396f9fbbb8489ff4782999f3b8c99ff99dccffcf655c144af4dd76f1a9caf8cc7fc0e0973be7c4138cdff50308f7fc258ec6b9f31cb571582f97c3761a207ed6fc726fadf0927fd538c79fcec5430d1137a09233de1867183ce671b09e3f9ec9c31dba7ca05337d6f82e97e759a30deef7705d7b1fecb1e090b3f4c9f31d39b6f3266fad43861d2b71661c3fc35178299bf3709d3f58e31f3a358264cfc467b83f4899f5f78c6a2af81b03ccfdf32167db109133f268299dfe709233f6c87b161792e04d3f9fc8471e0e769c1747d1809a6f1dd3161bbc1f16e2298ed7f85e9fe5dc1ccdf47c65b9ccf5e274cfe50c6dfe27c82e76f0d3f6f2b61b2df84e9fa8cf8e7c41ecc0d63d68f6c4ad8883fda13ccf6dc14ccfabe4818c7d35b82693c2798e3697ecf98f96d3a8c997f393f5ff851d88469fcba60f607b384c91f9c31667e8553c11c2f2682891e7d2198e7e304b3fd1c3166fe9aed84299f7a124ce3eb56c2943fee0be6e79d0ba6e7b903c681f3f1b784291e2e05f3f8bb09537d91eee7f8ba9d308d5f25ec581ff553c2347e5330d733370913ffe47ad647779d30c5b7b960be5f9e27fa87f1c26c8abf7433c2a23ff65930f9a3d04998ecafce98edd96f3236ac2f2f8c597fc21be1646f23c12ccf9384493f9560f687d78c591fc28660badf5f254cfe54c6dfa2fb2dcf4ff4c1e582391e68c1accf321ed3139a09533c180ae6f9ed30667df13e61f20f9960ce2f5dc224cf3bc13c9f743fe98bee09667e0f0433fd8709e3fc4c9570d2af79c2a45f23c1acbfd384e9fc9160b68f76c2c4ff743dfbf715a6f3db82997f45c2383f2df363fdd579c2f47c2598e7e712a6f30bc1ccaf9784499fdf0573bc64fe3bf617fa24611a6f28989f374998e2f9bd60ce876a8c59deea3661b2bf9660d6b746c2647f581f1927f1d1927c92ffcc170993bd9d0b26fb53ef8c99beec4a30eb7f4d305def041b8e0fb70953fc6f0b66fdae0a66fd3e4b98e27385b1c487ad84e9f9424fa0fb0be27ff267619630f1e34830e7871b09533ebf2d98e3f1306192f75830ebdb0ad37cde04d37c8ccc87f5cdbd0a6679bd254cf2ac08e67cbd9e30c5a7749ee6a7bb0953feb414ccf9c8ad609a8f67fe893eaa03c1ac8f0f09537ce909e67e712b61f217f78259bf9a09d37cae04d37cf44dc2649fc78cc57f05c1cc9fab8469be323ff657f99e60eea76c264cfac6fcf6ec8f544530c7e71bc19cdfa17ddb941f1686b0f87ff79830e97b8f31d3afb61326ff742598ef3f12ccfafe9630f9537ebef85f35104cd7ab4dc2e25fb34230fb9f61c2c41f2f98f3a5c098fda1bd4a98f44f09e67cad9630e53b5dc1dcff90e7b1feb9b9608e17fb09933dcb7cc43f1e244cf2d910ccfab897303d7f2c98fd914b98eca32598f9bdc224af07c1ccffe384e97c9db1c4d7f384c91e847fac9fc52c61ea0f3d0ae678b69130f1c70ae67a2b4f98e63f15ccfeee2c61cacf593e9ee36d3e4898e6772598e3e546c2d43f60fa3cfb138ffec27ad14f7bcd38b03e1e0bde227eed124efef34530fbc346c2144faa82d93f7704d378f96dc2e43feb8c59ffb271c294bf5c0be6783c4898fc515f30e7579782b99e3e14ccf9da5430cd47a5eb693ec51b63d657b59f30d99f16ccfdac79c2a40f35c1eccf3705b37c9b0993fe9d32967ae03561ca1f841f520fbc244ce7df05b3fe9d254cfe2017ccfeba2598f3efc38449fe5b8445df7425617a9e17ccf30909933def09e6fa649130e9df8e60f65f078c255f2b12a6e76582b9de68264cfe4b0b667f83f1c9d545dfb21bc6e2bf2f05b33e9a84c9deb61973bcb32782b93e550993bf7e12cccf3f12ccfa9f274cfa95c6a3e7bb016396afad274cf1aa10ccf1789430c59b3dc1ec5f2e1326fb9f08667b6f274cf27e15ccf9cb7dc234df343fe65743f0760dcfcf098bbeb8938469fe6782595f6cc224df8160b697a384c97fb60573fed34998ecfd5030e71bd70993bc8d60a24f6f0a66fd784f98e8ed31667d34d709d37c653cd6c7fe2c613aff2898eb519730e9d3a960b6c7b384c95ed378ec5fb384293fdf124cf4e4321efb2bdf4e98e6b32f98eda796309d7f16ccfe238dc7fd50a19ff53d7f154cf32b8e0573be72c798f5d9cc1226ff89fec3adfc4f5f30cbc3264cf181f897fc85ad264cfa9109667fdf10ccf5c4b6601e7f9830c9fb4030e973088c25ffd182b93eab08e678db4a98e623e38bfc6cc2444f2198edad9b30c9f75830cdd79f254cfe49e89778b32798ede730619acfb360b69fbb8429fff082397f6a264cf97a4d30d713070913ff7605733c95e74b3edf4f98f46d2698fb8b8d8469be3b82d9bfcaf8e2bfb612267e907ec3edecefb0bfe7933fc813a6f986bae01d9477fece98e553bc0866fa9a82595f1e0493be646dc13b16714f706313e77bcc58facb7dc12cff4230f1cfba8469bee97e7a5efe96303e4f093decfffd4c30dbc366c224cf5bc1f47c5711ccf6f64c38883fde17ccfafb2898f5f14930cf4fee97fa09f3691f84defc5270c321be232ce3db4bc17cfd91601abf3fd34a1badfeeca7b6dac1f1f1f36707dd5b3afeea3c50164afbdf7c846f1cf1ba4ce770fca6e7525cfccb3cc94b47fa3d9eb33f91e96f9249fcfc2d72c97581fc2d1ff4fbdf2def9fcae577f024c9c17c3ecae759562bbb1968f73b9eff1bede5a31df84f32fad1f5ae74cfdfc15e4abee947b2e1e3935dfdedece56b1ff599df24a7e2837dfdddec65283e0b3e1ff4236ace28da027eb7681378c4dfc3e7283e9d3f1ffe66f6e2f5931ec3cca22ce4f311a87ad613b689917e81c3027ed6d3f81da90e7ceddfc75e6630434fb3433cd673b48348e1ab7ec3dfd1aca3df5ac031d5ef48d192a9fa3bd98b476d899a3644cba6dfcd35c598b7282bd4b017bdabf79092056b6213cefd8dec05789feb7da022cefa000ecec970f616671ced66a10ff51150d142b944998cf1bee3dfe5cb7e8b5c4e60462738a338eb5398f1996eeb8eeec2ec7bbaafcfe1b8d097fa4a5feb1b7d0bbfbfd3f72897785fe577f9b2df622ffbba0a335260d51bba0633ddd475bda5b7f58e6e28ad9432cac26194535e0595a95c156aa086fa4e81f5abc7ffabf18562b7c4ef726c9798f1aa976aa4bbea498dd5b39ac0ac5fd454cdf098a979e988bf9bc2d957f5a616ea5d2dd5ae3e52d186c287677cf46f3ff577dfb11778c2091c43d564dda71c6aa4f6d5813a54477aac5aea589da85375a6da30db0ece79a6bafcd9537d38e678ac288ac7b9bad0dbea525da96b75a35fd5adbad34f30f654eda97ba0700972ab94ea2255ce2dfe84bd60ac56d5c833a1466d002535fda636e1b3aeb6d4b6da01593460f6f338b85130fb3eccba7cccf1137fe07ccf18a42ad2a38c35ce78bd3001bcb8070fff883ecf81d62a93e9efe414dfb517960b5343779a181b4c6e0a5d370333340f2403a4e4118e11ccb49b6413bfa34ccc53a4847fb4c8c88ccdb399981733057b6b452a805371c631875896e5f117ed252bd90b1d2706ee34733534afe6cd2c505f70e6c86b91c3ec8b036563de8916f8a6cdc82ccd2e52f462f64c13e4b36f0ed05bc7383506591dfe8a1ffb99bd4459c801387ad13773645ae6d89c9853a06004735ac2ff239e6dd4b4b25cc45e84a2a865ac89789c01654b944f5bef988ee9aa163c1ba85107fad1f47e947bffb9f892342b03ef5ba82373a896a6af1b668c1cc5d9e00c4dc96fad66bfb29fd5b9deca76e02752f30ebf07eb31e7e6c25c9a2b98e113cc70887941f69dbcfa3bf6122d5e6462aee1730094dc80ad47ddea1a93ac7d8e728832e927bbd125fb50289fbed9859f25caa7079f4857f4064cfdd4dc9a3b736f2a603773736daa5fd53c7fd25ec47f88dd0c74d76c40f48b966cd8024630ab51b215f155fd0f3f2b5bead12752326759aeec6c666a60399ba60e165f355b9f7a09f9a7f97d3fbe440f1933156fb6cd11c864c734924f026aac260aac688b42ea66e2bb30de4cd9cf81fb055b5fd1d7b3265d471c204fddb6d63ad5b21ef3b5396a9bd14f36fc457b89f12466816f68271bca20254bd479b48028934883cdc04769f9ad9adadc16aa61dacada0148f25c35387ac28f1db2cdf430d64ca3ada1762ae4d05439fb602eeda32ddb6d8d8ebf908f3d42461f7d4ad4ae1ba6e4294a0564429ad5b3620fa8253607ffe6ec931ddb673bb12fc6d9a99dd9b97db56f76616a4015c9a967dfc9ee8d66fbd1384e0fa95dda5d885f475cd5c5fae74162cc47dff66d7b79b37bb12eb44dbb0f163fa3d89e62f99cf88bf612e7d780391cd8437b645bf6580ded896e8307afdb537d6fcf74d7b66dc7766dcff6416630963d8f1187c763ef069862e8d05ed84ba02670f6142bba55bd937f96cbcfecc55ec108efa662afed0df033ca44a34c6e55274615e0e4083406754a4dec9dbdb7155bb51bb666376d5d3f002762351cabe8784ced9699da6d90d70ee46fe7e4b36d2346a8e401a2d67560b4a903057706a889d967ac8106a6f7b117fd4bf632b457ceea6be7209ecc536c8fb1503c30ccc216a611d7df5ce67257c08ceb7ae40668b5944f57b0ff7282f8c51cb8a17b708f6e14a36d1c0dc6eda16f331c69e7400b48d93db9b17bc67a7481f9f473c977adf5dfbe155f208b50c76e824fed925f8a76021683f6e25ee273ddd4cddcdc1e47db72affd191eb1c68cd573dea75ecd10e354cced82ba710bf76e5ba6e3966e173517e502f18af30763306b38777bfade35dd3ed4a447585d7fd187fb81bdace7a040b73b5075c82c16e82b3bc94ae66c231da4e4d01db996adb96377e20edca99ebb33d4ed68b1f3943bc4fa3e56d219c6f337d554f7ae0dd474d0766664779441a36f1c459fe8baae67725b03d9bc60b5fdb1b6ca3fdb0b1e94933eb87e9c01f8ae421dd8ba3b77179839aeb214e05ab49b2813c87227ee522df5a17b5bd365a93b629efdecae8092a1de77d7b15ae8cfb8fb3a7637a0bdb7ee2e5203f9c03bc7a6197be8c7c84177ef2a2013b07ae0d0c3daf8d917f6427ac7311ecfbee293ab1021eb6adb6dc47c9e231965f0e2c71ac6ba9adb3447d88d7883fb3efa981357d74f989d6ec0358faae5b6dcb6dbd1bbaae91afa006475e68171187d7a6b791be70bde78eb9df7baa20e809a3c1e31eeadd5a25fc9c521f67aae6a3ee8579f9942ed407d12a3631fe36017eb14f2c01d9fdba9db744db04abfaec3c9de6af0f43ec8057c982ffcc00fcdb97fd057ba03b50a7a5875e31ffdc83fb1a6f5487b25af032ddbf56337078f32f2cfd47beb539f54f2c4757b59e95d406b7d420d83ac01f85dc7a8d2659e75390644ad9efa897ff150d1629f0b3b4bcc89728f1fb20f5581dfeffa999ffb57ec059c5bebdfa0d66fd93d770df71de96bbf70cb186739cef456725133ffee97906d0e40c324beacf2c47f2317b86292f0a369f95d947e47ea77ce8b418ffd9e6ffa7d7dc8bd2eeef2f178abdc76df1d80262dfc813ff4471851a217797177eec1b7fcb1aef80079560b6473e2f7906b7db61b3c50171afed49f41b63976afe5f59b28971fd80bd1dbc4fe6306b20990ddb521a249cdd8e17ae5318e0f1ab1035eb806a3beeadcb7c1b65eb93f1c3ef4f35fc13676fd9befc48a2766291e46f43ddfd757ae0d9ca8b8aa3f572d90cd05663752ddb06ca2c7f197fe0a28bfc67cccb2adacf56b3eca85fdcb84fac2a607fa7d13bd3f669233ae4f204d8cb49885bfd5b7661be24995ebcd917e4e7139875a872263ec9dd56026775126d6f87ba0a50299c254195f051fd65637a0655011fb0d5f3398aba1ec4729e644cfd6f69ba02375b47ea2866a5e27f9d95a7c117b71c8570ffc3a055b78c6917bab5e0a771d1af6ce0d21b69ff82d8ce9867b282f3c56116b501ef35d5ff96db013a024d53694dbbfd80568da0e7021cab6114015b87f20754e4fea9a604015dd9a0ffb54bf7c8aa3312fae20ed6dbda926907529e9ad48561eadd1de071fc2aaee13df82b5fabe3e8e72018d7021b39590636cefa53c9fabaea8a9ee2e146e07e45bd10f611086e101ad739ee2ff0873804e78f4fb9019e51885b98e11b994ec25acc518879960fc7e1646d187a56cbe97783a855cb8e20ab0c44ac967d138735d094f668becc7b5c3d82ed0e2a977b694aa2cc65ea4c886e710d76580dfe1c56c3acc2ab99f26fd9b1ed6002f7aea4e308f18fd582ea2e3bcb2e0c8a785a9de420fba92c923ca680e75dfa1ad8659085fac41eeebaa6f433d089484cc8dc31c2999c6f824b5096792317e4c6d115ec31b64afc04de3752f2c4c1b3d739f7d18710146b1d16752a6bada37f0d15e42d2f1f87d17b48c74b2e3fba8bdc29f3e575c51c38eec86b6ee15f5777d0df2186af413ec06dec1ccded1a3a74a9a7361c98d63e6d50ecbb0abcf30568cc25e68725f64955bcca94b13f621c68c29bf13fb4e3d22918bec4f21dec61a215e39801c6b0746eda69e17c9e509463d0887e08d69edd1acc513f202d10b6f8571a078b2aa4b34e5c258ffe8c8f3d0b26ffa1c72805dd4fb03530fc75827cd52a48cf97f23d20279d9d0676cfdd223fa185f5672c9d15e9e5d5c8570fa309cacf5ea492e9017db853d0ea7509f288ec3ebebf96390ed9d3f349370861e76c4d9e8aada22cb9e9953bbf0037b165ef400b21cef6277af65261fe4d2a72810da6e6ce6b4729b8eec47f60287c3fa3aae750d744fe9558715e3f163d4319b878e1b834f99637d62573a8bf6f6a8a721f383701429095dee6f18d632d219ccb3cc69e8f937a89e15f790632c72c0fb138ca95ce5518f07fe9f9a5ae8bbc8ede8cbe479c32fea9750f663c09f0cb2c53e752a520f92e5a21ae1dc9eb8377706b9ebf843fc0dfa28ecf9c37011bd46e8a2adcf57f2e0efd12f15e112b470007695e926f67ab0e60cd370156351eaf3cc531c005b0ad72897951ffbaaae74124bd977cff500bed8d298e2913ba66d8e751beaf89c471baa1a64a2b462a7205778f347d89f8db5dbaa53f4245dc068296e37dc845bb0b9f8ec26e8fd84c601ca0ef59569f3733b29fb47efed2ec31dead000e79a7faa5f441ed3241bf2110b7d6907eb7acb5e32ae971c81740bc871e15a7f4ef527d62eefb692e2c988fd955af531639f42f5c37da884aaadc62e2bd635919a3713ab35d050b389b4248fac648dc0860d35c28a2ce6e68a7de75772615a396b8ffb262e14adf890a58a5c80163b05ef48757cd4f327904b0572e1a52ff455c8a91f917afd7d96498f7a9d51f7432d6c86ba83fc0ae49f61a536d1e3b015edc61c85ed923ecc1225605fe638468275b9acd98be4612297b8badd8c7a6f5fd85ee66b7201fee8d8ef7a028d8add8809d4ed077165cef8b01176205b99829dee52fe51f65da9d3ba5473b76b17a1117ca6dd75a6dcb5012b06b92cd51ef8b44b940bd9a9746823771aba0e7975e4f49473f12fea17c9a522addce574516fb10a5bb37efc3cb7737d1f7d9dd4ed99864aebc0bf6506b36a8331fec92ce3ac4526b246063876d267e6c12e329b454f53852a3aae50417e0eb1edda76504729779ba57c3946e829cbc5fec05ec4ffb8642f16f7af1c41ede2d7ec85bec7dee4ab3d83da9ef28421e8fbd4ec43a5c573b0641bd2fbef97ee979e7e0fbd024497ccab56d452b2393d527ba69285d0c23ae99db8881519dc9d65901390bda8926d7f968b4bb4e2dea1e0f4bb7b5081abafa7922f03bd8358dd056f7c021a36027e36a3efcaf2e849e37a0c75c8b9472c3e6cae646d997cfb082bbb76b8cc0a15fbc5b1eb01f9023cb7930d62af9cf3a555be305517d990fc5869cdeeabfa6525972718d9417cddd5b7d90366aca9eec6181cabbc8e6deb26f820a01c7cd93344c60baab4b86fdfe3da6396a2c3aabfd251abd5898e2dcc4656e87bf44b316f18b8b1da89fd25be66657553d7710f1c5fcaf5d65775a54d7e6c14d75c60f46ef6489911d65f31f3884f889588331dd7a44a1a34e4de0f5126ef19d5e71df263e493b15b2c729aa7be1755da5dccc8c6d91368d61862d4abe9857eacfa639f9a7433c5ff69f69c4df451796fed0fea7d5fb21792d1d29e652f54a1336f7b69d5e5458d6d136b4888d9d934c3d5225ecb33680b86b57cce1e6dc9155869ed2c5597e7d91c624aecb32ccd912a40c273a99295746566669cbd8266bfa3bdacf5f3d6e3cb87ded824f62ea1deaf676f7609baab793dbec73d32f0b9d9227b87ba33a0576e674bf0a253dff515f23d7668a81ad6e4b1c23df2b7875c794c3d96b9f428d5b9996443d0835d37771750d38c582fbbc88579b617bd58d8f04558ed39a73ecc677b29d7d04ddc21528b39ab9f664deebeaed61fe77185c2f6ed04eafddd787d063eccda2841388319b1352c8ba853e350c90e541b65d043cdfab0fe8ff9e73968da21d84303fb4a587db15ce2d51de0df5bb0196958d956febd5ce27e87107517e47397b5386b2f5113addf1676273b768bd879028a3aee363b092d8c92185da43e518dec343bcbda5927eecd40aee8b49eb9ea81c61d3f8dac9bf5b27e94a1ea82bd3c81749eb8dee982269c6717e0911e925c065ff4c7a4672972910a0b6a18d5ca2ed38a0279d7a5e4b9ea2cbb72efd8bb0fba65b7dc83b5907b507f4b6ac653d0c56b5b75adec06b2b4f65ac495b57ed65ad0a4dbec2ebb4fde4e5610694de6d4df6615b39d5591eb71be94937d5cafcccb7d798e3539d4ec55fde2c6fe926c99b30feca5609d77ee46b615ed4ac5cab565cf20d3bfc1fc784e76a26cb611c6b1fef475bb9159a4a6c375ea6a5502e41c3f2daf21dbf89dd7a171ad3a7eeff84bbb1d3b4aa02f2bb92c3ef593cbbde4d551c96a66cb5f679b5907fd8ae1ce03ae609977177d703be647591db2ca273dcbb6eca9bb858ab340df14b5700111745b2b739ded649048678d70b956a74aff6b1ebd0266d0144f9e56392073a5611739a457b1f64c75ac43b97c692f5fadd1c2f7766ec01aa7e099240e477fcbeb24666167fa1ad74162edd2f43bee36b77600740c2037b8ca1ddb2079d0fbdce741d68dd2ea395394728bd5aa2e69d83b543b4bdbd135ea11c5fe9bb9ce33ac81eda7fed8bfdb0bb3e7e6507f377005ff4cc9ea1b652173f3e03a61accf621755dd466af2dc1fe64578cd0b7de176f4301f60cd18f3ad984fdce7431b57fa67f9431c09d76ce71f7e66bc262d786a8bfc517720371ee37e67de97f355dcffc97aa5f3ad7c943fc59eb239438f3ac79c8b346266f37c6c3bfe512f6c8027eceb51fe9c4ff2977c9acf207b1fc7da249f47bd066a9af9ab6de66f26faef6959db64f6a55ee58c8fe819cff385b9d2afae1afba0e5b5b75fdc0f6383cbdff325ae26d18e84954fa3194cf35d3f024ddbc5950bf035fa31df833a6317f78a7bcc748690819e00356f20e7f7bc692631b67247efa35c5639f99cc7dfb7d15756f3038c00e26fffc4fa3e2866dd2f9d46be3d96e2367a68dcfb31ce0ffd223f522d3d7655ebb16e1f415d72e5fa9cad56f29699e1ea858218719f0d7d1fb3a325f6db3ec946aaebf89bfc383ff10d57cd4fb117baaa5dfec4fabedf32f3fc2c6fa7ae9d64f39c57c55cd316609daffadae4b8feeeb1e68c4f8b1d9f937c90774026201f57c59a27f65a1a7937ef7177f58b1fee6dcea0fe9ce833983dad1b0cd7d6773ed52f3f5bdf071b98e7fdec5aeff09a56bfbc36127d90c5d565bfe73bf979d0612fee61716fdaab235ac1cd5b489d41b9c41ed8c86ce617f9657e8571eb0b7b419b8433f9757e93df86a95404257bc97fdd5edc993b7067603377f9bda9513ce6b58719c750ac35719744ecc6297f05b54d17eabf297618e23a7e8d570e21f7d683bc12776ee5d5bccb31fe4b4b61aaa05acb376c3b4cf31aae70ad7a969fde79fae67efe870c94df17f9a69f8864d866651db3c73a1ebd9376f7793ddfb2ceb55c966fd37b30aa15ac6dbaa16965d6f4f31dbf0779d78c7a66dca3e5ff45e6c96e629c6ca865cc1fb06f67535cc9b11a34dfb7173d2d347c8ef34aa1cc5d5ce9a748873b2464ef7479271b3c5d5933b437766c0f0b53d8b8a73ff7852b7c5e140122efb9dc93fce267c994f69a9b36d4b147660a5ee309bc89f48c547acfe9dbf1450fb2a3108a4c5b0741ab2828a78abb7153964879f43b579f1df4b610e1a0fe7d80cc14324e13a93bc5a88254f07e1aea03947b2df33599509c891c3bcf16c5c0e4295f5cbdff97ff4a7cc92b51ba50cb8174a192857cd7d3feaeceaa5faf569dc08f3d97d52751bd4499aa5437764be70c57f6eb72e96176709e0db289e9adadef97d7bfbfb7df12ac1577509df9cccc8b61f1503cc60c4d7520475baed6e1d3a1a973b1c220b1f7555d2c14a34c70df56c956cc67b9c40a0f57fd4c3102aeaef6c39472c8efda4bf1640edd1ba4a5afd8d7b7c5389bd85d3354ab370f64cd57e423bb3ffac98ed6f6c2727642f5c957d1fed39e73c84741678be762f2e3f72fbe135fc02bbfe94198e18ade89aeda601f8b177b01c1f701ede691a36757a5fdc93273a89687f0437d8c1eea3ef668d25adb135fc7ab4df9f5ca76d6fa01408d392fa621d3cbd27af52fc7976266afccb68dd1ead5548b79f15abc4134bcb5b3624135e79a5c64c5a4b4237e8dc7e2f7a45b245dc0598cf1c53bbe75f2c18f41ec2fecd2765d139ebbeae5add6e3be6f2feb07af69066f5e6dc5edb92e76034b3ba4d63cacac3ab0ccb8e2ed49bdc2fe2feee19de6c77692df1605afdca4ddbfe0e121532e96c56eecfbb8abd2bcd6d6afbff9bed8873ddbd8c11ee823b793efe5c322147bf8ce08e51dbd354ad67a2ed8555a96282699a1fee4fbf9893e0bdeb66d0f3ba043eccecca21f377be602df9c1bf3be832fdf77feeefb626bc718fb9a0bc82a5aa0bfdda2e9ad1fbb0d7e07866a68b8d036e0476a51a62cfe1e7e4cb60776d3c1cca7e196c57ebeb04ddf88556f981607be1375379e233afd4d7e84fbfb2771cfc5c7daf717e2cbea28d70bf89661dc03696b7925abb87161fc6b71684eb19335fb20978fbe8adf1b330d7f691750fd76a0d28a6ba49043e73575658f7c07f7484c43cb2efd8d3e044af64a7bc6bf7a9fecdbef579679c1fb8da75071c5aea9cba02cd01093ad0bd5bcee5fc3a35de2cef0cf6fbf51be36552fa696358ba3a265b78b634dbbb6a03e811a3ed30fb666a6c5897d500a65728276f2cefb6c3cf661d6de49ff95f8f28907f8562eee9d7cc1b7d30edc89f7902bb57dcbb4f2bedfb72f763fec17a7a16d6a10552de62f0dbf9765eac27582c95ec3866b9a695681fc5bc55c1a2aad83ac1673ab980b63b5362946104fa6d177018e32996325365e9b4fbe2e979fda4be96f8cd0de08de0bfe8c3dc4d81f3bf0cff6d1d68b335ff719e408d3a8156ea896a15fb4dd65d8283af9c84ef3ad6ce81eec76dc091fee62050db1eb153e1f78a6588fe2f717bd28ba6e1fbd70c03d0443f23af4fed89fb4972ffe860856c0633d51b8a21d77a7d13a7ffc1ebd2444d4b8b30d321e9787eb70a74676c3b5ed861a853b5b8bab54402d7720788d4bdebec6bd9eb8a3788cbb8097f15335b1371af7342fb97bbfeecbbe1f5f3efcfd971ffa384b33e3fd2ab2cf6b547a3772fdefc394df975cffbdfba0176bf7fd689ebf602f3ffefb2eb8a383726afc8cbc9d970ea1eed367ead9afafa5acf759fedddfc658c3bff43ef217b259eb8508ef429a256910bdb35fbeaf1caf655fe62aa7b069afc1577f0ba8ac2b097f3bbee45fcac77f88bbab73eb7f2b21603f7efae93e1977d5835cf556567b3ecbfb6cdc9a4e7c8a31dfccc7f28fb25993cb0ffe46d257f1794d8683d55e8f8fcff918db4a357e19af8dfb4db9145ff0bf2cb3affe3eccc7fb0b5d5e4f7022aff535948fbee9836d7c96c9afd5fbf1f3447f5ea359f1245b7b3756d610e327fdd588d21bc072be7c7cf25bf4bc75b9969e9be402d7153decf7ff8abdacf3f48b7764b42af9a2c873c76fedacbfcffc950c3ffba7b2dd7c96fd4a4e701d50b22697efe6c8bf92b77dd4f9ef9effd1f3beb4a1b2effb7e7cf97fe2f84d7f7fec6ff1f9ff955cfef7fffcc7ff011f3a1368</data> - </image> - <image name="image1"> - <data format="XPM.GZ" length="1085">789c5dd0cd6ee2301000e03b4f11911b5ad1189290a8da0324a5e90f29941e2aadf6e0d84ea10d1020849ad5befb7a3cceaa29e2e06f663c33ce55cf7a9dcfacde55e758d16acd2cb6a207abc74f9b8dfcf5fbe79f4e97f896fabb8145ba3f3addbec5ac74b715704ed5d9769c01cb73e0423368f80224c190e53e70091c389e83d98366e83942679f0c43cc7e0087c4f3307b63c8b1d559337459c6810f48df137aab49436c750f748917320f78418e4cf65993fa04b33572c4313b067a039f333de80e39e238680ff4d5d2581c69d2c0c3ad8e0db1f30619127cd1dcd00c7a4452824c80a321359d73cd8c129c1b1b0acc726030a414b31299f9989d1952a4d0ccc23073819f861c973c2133d3b904aacf6ceeda9a8c12bc5b219929de21f9005900a99bf9f8e9a8a159728a5477f5d77847367719305373b1788b14668d4c9337d95b2437ef5d03b9c84df10a28fc866fc05c9522fbf0b369c6b8d0c7ffb1fc6db57effb0bfc68acd7657ee0fedba63599dea73d18a7dca525ec6ed3aa16293a81d2bf232beb1bfc578d58a416731ad641da95381b1e3f496ca939432c9f3bb7b8c450f8fb39994b18c93493a36fda2a7b9aa8ae3e4b278b69b192aa822499dc2d6cddc68b94ff697f46c7fdd255ad6f5e2dbdbfac7c3cbd8ecf7f7baf30f538f0154</data> - </image> -</images> -<connections> - <connection> - <sender>cancelButton</sender> - <signal>clicked()</signal> - <receiver>UnpackDlg</receiver> - <slot>reject()</slot> - </connection> - <connection> - <sender>destButton</sender> - <signal>clicked()</signal> - <receiver>UnpackDlg</receiver> - <slot>clickedDestButton()</slot> - </connection> - <connection> - <sender>unpackButton</sender> - <signal>clicked()</signal> - <receiver>UnpackDlg</receiver> - <slot>clickedUnpack()</slot> - </connection> -</connections> -<slots> - <slot>clickedDestButton()</slot> - <slot>clickedUnpack()</slot> - <slot>destroy()</slot> - <slot>init()</slot> -</slots> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/mac/unpackdlgimpl.cpp b/util/install/mac/unpackdlgimpl.cpp deleted file mode 100644 index 5538f4d..0000000 --- a/util/install/mac/unpackdlgimpl.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "unpackdlgimpl.h" -#include "licensedlgimpl.h" -#include "keyinfo.h" -#include <qdir.h> -#include <qfiledialog.h> -#include <qlineedit.h> -#include <qtextview.h> -#include <qpushbutton.h> -#include <qarchive.h> -#include <qmessagebox.h> -#include <qregexp.h> -#include <qapplication.h> -#include <unistd.h> -#include <stdlib.h> - -UnpackDlgImpl::UnpackDlgImpl( QString key, QWidget* pParent, const char* pName, WindowFlags f ) : - UnpackDlg( pParent, pName, f ) -{ - destPath->setText( QDir::currentDirPath() ); - if(!key.isNull()) { - srcKey->setText(key); - } else if(QFile::exists( QDir::homeDirPath() + "/.qt-license")) { - QFile lic( QDir::homeDirPath() + "/.qt-license"); - if( lic.open( IO_ReadOnly ) ) { - QString buffer; - while( lic.readLine( buffer, 1024 ) != -1 ) { - if( buffer[ 0 ] != '#' ) { - QStringList components = QStringList::split( '=', buffer ); - QStringList::Iterator it = components.begin(); - QString key = (*it++).stripWhiteSpace().replace( QRegExp( QString( "\"" ) ), QString() ); - if(key.upper() == "LICENSEKEY") { - QString value = (*it++).stripWhiteSpace().replace( QRegExp( QString( "\"" ) ), QString() ); - srcKey->setText(value); - } - } - } - lic.close(); - } - } - connect( srcKey, SIGNAL( textChanged( const QString& ) ), this, SLOT( licenseKeyChanged() ) ); - licenseKeyChanged(); - logOutput->setWordWrap( QTextView::WidgetWidth ); - logOutput->setWrapPolicy( QTextView::Anywhere ); -} - -void UnpackDlgImpl::clickedDestButton() -{ - QString dest = QFileDialog::getExistingDirectory( destPath->text(), this, NULL, "Select destination directory" ); - if (!dest.isNull()) - destPath->setText( dest ); -} - -void UnpackDlgImpl::clickedUnpack() -{ - QArchive archive; - connect( &archive, SIGNAL( operationFeedback( const QString& ) ), this, SLOT( updateProgress( const QString& ) ) ); - connect( &archive, SIGNAL( operationFeedback( int ) ), this, SLOT( updateProgress( int ) ) ); - - archive.setVerbosity( QArchive::Destination | QArchive::Verbose | QArchive::Progress ); - - QString dest = destPath->text(), src="qt-mac-commercial-3.0.0.app/Contents/Qt/qtmac.arq"; - if(!dest.isEmpty() && dest.right(1) != "/") - dest += "/"; - archive.setPath( src ); - if( !archive.open( IO_ReadOnly ) ) { - QMessageBox::critical( NULL, "Failure", "Failed to open input " + src); - return; - } else if(!QFile::exists(dest) ) { - QDir d; - if(!d.mkdir(dest)) { - QMessageBox::critical( NULL, "Failure", "Failed to open directory " + dest); - return; - } - } - unpackButton->setDisabled( true ); - srcKey->setDisabled( true ); - destPath->setDisabled( true ); - destButton->setDisabled( true ); - LicenseDialogImpl licenseDialog( this ); - if((!licenseDialog.showLicense( featuresForKeyOnUnix( srcKey->text() ) & Feature_US )) || - (!licenseDialog.exec())) { - QMessageBox::critical( NULL, "Failure", "The license agreement was rejected." ); - updateProgress( "License rejected" ); - unpackButton->setDisabled( false ); - srcKey->setDisabled( false ); - destPath->setDisabled( false ); - destButton->setDisabled( false ); - return; - } - - QString srcName = "qt-mac-commercial-3.0.0.app/Contents/Qt/LICENSE"; - QString destName = "/qt-mac-commercial-3.0.0/.LICENSE"; - QString srcName2 = srcName; - if ( featuresForKeyOnUnix( srcKey->text() ) & Feature_US ) - srcName2 = srcName2 + "-US"; - if((!archive.readArchive( dest, srcKey->text() )) || - (!copyFile( srcName, dest + destName )) || - (!copyFile( srcName + "-US", dest + destName + "-US" )) || - (!copyFile( srcName2, dest + "/qt-mac-commercial-3.0.0/LICENSE" ))) - { - QMessageBox::critical( NULL, "Failure", "Failed to unpack " + src); - archive.close(); - } - else { - QMessageBox::information( NULL, "Archive unpacked", "Qt has been " - "extracted to " + dest + "qt-mac-commerical-3.0.0\nPlease read " - "the INSTALL.macosx file for installation instructions." ); - cancelButton->setText( "Quit" ); - } -} - -bool UnpackDlgImpl::copyFile( const QString& src, const QString& dest ) -{ - int len; - const int buflen = 4096; - char buf[buflen]; - QFileInfo info( src ); - QFile srcFile( src ), destFile( dest ); - if (!srcFile.open( IO_ReadOnly )) - return false; - destFile.remove(); - if (!destFile.open( IO_WriteOnly )) { - srcFile.close(); - return false; - } - while (!srcFile.atEnd()) { - len = srcFile.readBlock( buf, buflen ); - if (len <= 0) - break; - if (destFile.writeBlock( buf, len ) != len) - return false; - } - destFile.flush(); - return true; -} - -void UnpackDlgImpl::updateProgress( const QString& message ) -{ - logOutput->append( message ); -} - -void UnpackDlgImpl::updateProgress( int ) -{ - qApp->processEvents(); -} - -void UnpackDlgImpl::licenseKeyChanged() -{ - QRegExp keyExpr("^....-....-...."); - if ((keyExpr.search( srcKey->text() ) != -1) && - (featuresForKey( srcKey->text() ) & Feature_Mac)) - unpackButton->setEnabled( true ); - else - unpackButton->setEnabled( false ); -} - -void UnpackDlgImpl::reject() -{ - exit( 0 ); -} diff --git a/util/install/mac/unpackdlgimpl.h b/util/install/mac/unpackdlgimpl.h deleted file mode 100644 index 11585d7..0000000 --- a/util/install/mac/unpackdlgimpl.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef UNPACKDLGIMPL_H -#define UNPACKDLGIMPL_H - -#include "unpackdlg.h" - -class UnpackDlgImpl : public UnpackDlg -{ - Q_OBJECT; -public: - UnpackDlgImpl( QString key = QString(), - QWidget* pParent = NULL, const char* pName = NULL, WindowFlags f = 0 ); - - virtual void clickedDestButton(); - virtual void clickedUnpack(); - virtual bool copyFile( const QString& src, const QString& dest ); -public slots: - virtual void updateProgress( const QString& ); - virtual void updateProgress( int ); - virtual void licenseKeyChanged(); - virtual void reject(); -}; - -#endif diff --git a/util/install/package/main.cpp b/util/install/package/main.cpp deleted file mode 100644 index 39c71db..0000000 --- a/util/install/package/main.cpp +++ /dev/null @@ -1,397 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qarchive.h" -#include <qapplication.h> -#include <qfileinfo.h> -#include "keyinfo.h" -#if defined(Q_OS_WIN32) -#include <windows.h> -#endif - -class ConsoleOutput : public QObject -{ - Q_OBJECT -public: - ConsoleOutput() : QObject() { } - ~ConsoleOutput() { } -public slots: - void updateProgress( const QString& str) { qDebug("%s", str.latin1()); } -}; - -static int usage(const char *argv0, const char *un=NULL) { - if(un) - fprintf(stderr, "Unknown command: %s\n", un); - else - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "%s [options] [keyinfo] files...\n", argv0); - - fprintf(stderr, "\nOptions:\n"); - fprintf(stderr, " -o file : Outputs archive to file\n"); - fprintf(stderr, " -n : Follow symbolic links, do not archive the link\n"); - fprintf(stderr, " -s : Quiet mode, will not output process\n"); - fprintf(stderr, " -desc text : Add the description text to the archive (e.g. \"Qt 3.0.0\")\n"); - fprintf(stderr, " -extra k v : Adds the extra value v with the key k to the archive\n"); - fprintf(stderr, " -h : This help\n"); - - fprintf(stderr, "\nKey Info:\n"); - fprintf(stderr, " -win : Windows Archive\n"); - fprintf(stderr, " -unix : Unix Archive\n"); - fprintf(stderr, " -mac : Mac OS X Archive\n"); - fprintf(stderr, " -embedded : Embedded Archive\n"); - - fprintf(stderr, "\nThe following options are not for packaging and can't be\n" ); - fprintf(stderr, "combined with the options above or any other option:\n\n" ); - fprintf(stderr, " -unpack file : Unpack the archive file to the current directory\n"); - fprintf(stderr, " -getdesc file : Print the description text of the archive file\n"); - fprintf(stderr, " -getextra k file : Print the extra value for the key k of the archive file\n"); -#if defined(Q_OS_WIN32) - fprintf(stderr, " -res file1 file2 : Add the archive file1 as the binary resource\n"); - fprintf(stderr, " QT_ARQ to the excutable file2\n"); - fprintf(stderr, " -getres file : Get the binary resource QT_ARQ from the executable\n" ); - fprintf(stderr, " file and store it under qt.arq\n"); - fprintf(stderr, " -namedres RES_NAME file1 file2:\n"); - fprintf(stderr, " Add the file1 as the binary resource\n"); - fprintf(stderr, " RES_NAME to the excutable file2\n"); - fprintf(stderr, " -license LICENSE file2:\n"); - fprintf(stderr, " Add the license LICENSE as the binary resource\n"); - fprintf(stderr, " LICENSE to the excutable file2\n"); - fprintf(stderr, " -license-us LICENSE-US file2:\n"); - fprintf(stderr, " Add the license LICENSE-US as the binary resource\n"); - fprintf(stderr, " LICENSE-US to the excutable file2\n"); -#endif - return 665; -} - -static int unpack( const char *filename, bool verbose ) -{ - QArchive arq( filename ); - ConsoleOutput output; - if ( verbose ) - output.connect( &arq, SIGNAL(operationFeedback(const QString&)), SLOT(updateProgress(const QString&)) ); - if ( !arq.open( IO_ReadOnly ) ) { - fprintf(stderr, "Can't open the archive %s file to unpack", filename); - return 42; - } - if ( !arq.readArchive( ".", "G87A-QJFE-DQF9" ) ) { - fprintf(stderr, "Couldn't unpack the archive %s", filename); - return 42; - } - return 0; -} - -static int getdesc( const char *filename ) -{ - QArchive arq( filename ); - ConsoleOutput output; - output.connect( &arq, SIGNAL(operationFeedback(const QString&)), SLOT(updateProgress(const QString&)) ); - if ( !arq.open( IO_ReadOnly ) ) { - fprintf(stderr, "Can't open the archive %s file to get description", filename); - return 42; - } - QArchiveHeader *header = arq.readArchiveHeader(); - if ( !header ) { - fprintf(stderr, "Can't find the header in the archive %s file", filename); - return 42; - } - if ( !header->description().isNull() ) { - fprintf(stdout, header->description().latin1() ); - } - return 0; -} - -static int getextra( const char *key, const char *filename ) -{ - QArchive arq( filename ); - ConsoleOutput output; - output.connect( &arq, SIGNAL(operationFeedback(const QString&)), SLOT(updateProgress(const QString&)) ); - if ( !arq.open( IO_ReadOnly ) ) { - fprintf(stderr, "Can't open the archive %s file to get description", filename); - return 42; - } - QArchiveHeader *header = arq.readArchiveHeader(); - if ( !header ) { - fprintf(stderr, "Can't find the header in the archive %s file", filename); - return 42; - } - QString extraData = header->findExtraData(key); - if ( !extraData.isNull() ) { - fprintf(stdout, extraData.latin1() ); - } - return 0; -} - - -int main( int argc, char** argv ) -{ - uint features = 0; - bool output = true, doSyms = true; - QString desc; - QString dest; - QMap<QString,QString> extra; -#if defined(Q_OS_WIN32) - QString arq, exe; - QString resName; - bool doRes = false; - bool doLicense = false; - bool doLicenseUs = false; - bool getRes = false; -#endif - QStringList files; - int i; - for( i = 1; i < argc; i++ ) { - //options - if(!strcmp(argv[i], "-o")) { - if ( ++i < argc ) - dest = argv[i]; - else - return usage(argv[0]); - } else if(!strcmp(argv[i], "-n")) { - doSyms = false; - } else if(!strcmp(argv[i], "-s")) { - output = false; - } else if(!strcmp(argv[i], "-desc")) { - if ( ++i < argc ) - desc = argv[i]; - else - return usage(argv[0]); - } else if(!strcmp(argv[i], "-extra")) { - QString key, value; - if ( ++i < argc ) - key = argv[i]; - else - return usage(argv[0]); - if ( ++i < argc ) - value = argv[i]; - else - return usage(argv[0]); - extra.insert( key, value ); - } else if(!strcmp(argv[i], "-h")) { - return usage(argv[0]); - //keyinfo - } else if(!strcmp(argv[i], "-unix")) { - features |= Feature_Unix; - } else if(!strcmp(argv[i], "-win")) { - features |= Feature_Windows; - } else if(!strcmp(argv[i], "-mac")) { - features |= Feature_Mac; - } else if(!strcmp(argv[i], "-embedded")) { - features |= Feature_Embedded; - //unpack - } else if(!strcmp(argv[i], "-unpack")) { - if ( ++i < argc ) - return unpack( argv[i], output ); - //getdesc - } else if(!strcmp(argv[i], "-getdesc")) { - if ( ++i < argc ) - return getdesc( argv[i] ); - //getextra - } else if(!strcmp(argv[i], "-getextra")) { - if ( ++i < argc ) { - if ( ++i < argc ) - return getextra( argv[i-1], argv[i] ); - } -#if defined(Q_OS_WIN32) - //res (Windows only) - } else if(!strcmp(argv[i], "-res")) { - doRes = true; - if ( ++i < argc ) - arq = argv[i]; - if ( ++i < argc ) - exe = argv[i]; - //getres (Windows only) - } else if(!strcmp(argv[i], "-getres")) { - getRes = true; - if ( ++i < argc ) - exe = argv[i]; - //res (Windows only) - } else if(!strcmp(argv[i], "-namedres")) { - doRes = true; - if ( ++i < argc ) - resName = argv[i]; - if ( ++i < argc ) - arq = argv[i]; - if ( ++i < argc ) - exe = argv[i]; - //license (Windows only) - } else if(!strcmp(argv[i], "-license")) { - doLicense = true; - if ( ++i < argc ) - arq = argv[i]; - if ( ++i < argc ) - exe = argv[i]; - //licenseUs (Windows only) - } else if(!strcmp(argv[i], "-license-us")) { - doLicenseUs = true; - if ( ++i < argc ) - arq = argv[i]; - if ( ++i < argc ) - exe = argv[i]; -#endif - //files - } else if(*(argv[i]) != '-') { - files.append(argv[i]); - //unknown - } else { - return usage(argv[0], argv[i]); - } - } -#if defined(Q_OS_WIN32) - if ( doRes || doLicense || doLicenseUs ) { - if ( arq.isEmpty() || exe.isEmpty() ) - return usage(argv[0], argv[i]); - QFile fArq( arq ); - if ( !fArq.open( IO_ReadOnly ) ) { - if ( doRes ) { - fprintf(stderr, "Could not open archive %s", arq.latin1() ); - } else { - fprintf(stderr, "Could not open license %s", arq.latin1() ); - } - return -1; - } - QByteArray ba = fArq.readAll(); - // ignore wide character versions (this is for internal use only) - HANDLE hExe = BeginUpdateResourceA( exe.latin1(), false ); - if ( hExe == 0 ) { - fprintf(stderr, "Could not load executable %s\n", exe.latin1() ); - qSystemWarning( "" ); - return -1; - } - if ( resName.isEmpty() ) { - if ( doRes ) { - resName = "QT_ARQ"; - } else if ( doLicense ){ - resName = "LICENSE"; - } else { - resName = "LICENSE-US"; - } - } - if ( !UpdateResourceA(hExe,RT_RCDATA,resName.latin1(),0,ba.data(),ba.count()) ) { - EndUpdateResource( hExe, true ); - fprintf(stderr, "Could not update executable %s\n", exe.latin1() ); - qSystemWarning( "" ); - return -1; - } - if ( !EndUpdateResource(hExe,false) ) { - fprintf(stderr, "Could not update executable %s\n", exe.latin1() ); - qSystemWarning( "" ); - return -1; - } - return 0; - } - if ( getRes ) { - if ( exe.isEmpty() ) - return usage(argv[0], argv[i]); - arq = "qt.arq"; - QFile fArq( arq ); - if ( !fArq.open( IO_WriteOnly ) ) { - fprintf(stderr, "Could not open archive %s\n", arq.latin1() ); - return -1; - } - // ignore wide character versions (this is for internal use only) - HMODULE hExe = LoadLibraryA( exe.latin1() ); - if ( hExe == NULL ) { - fprintf(stderr, "Could not load executable %s\n", exe.latin1() ); - qSystemWarning( "" ); - return -1; - } - HRSRC resource = FindResource( hExe, "QT_ARQ", RT_RCDATA ); - HGLOBAL hglobal = LoadResource( hExe, resource ); - int arSize = SizeofResource( hExe, resource ); - if ( arSize == 0 ) { - fprintf(stderr, "Could not get size of resource\n" ); - qSystemWarning( "" ); - return -1; - } - char *arData = (char*)LockResource( hglobal ); - if ( arData == 0 ) { - fprintf(stderr, "Could not lock resource\n" ); - qSystemWarning( "" ); - return -1; - } - fArq.writeBlock( arData, arSize ); - FreeLibrary( hExe ); - return 0; - } -#endif - if(!files.isEmpty()) { - if(dest.isEmpty()) { - qDebug("Please specify an output package"); - return 666; - } - - QArchive archive; - ConsoleOutput out; - if(output) { - QObject::connect( &archive, SIGNAL( operationFeedback( const QString& ) ), - &out, SLOT( updateProgress( const QString& ) ) ); - archive.setVerbosity( QArchive::Destination | QArchive::Verbose ); - } - archive.setSymbolicLinks(doSyms); - archive.setPath( dest ); - if( !archive.open( IO_WriteOnly ) ) { - qDebug("Failed to open output %s", dest.latin1()); - return 666; - } - QArchiveHeader header( features, desc ); - QMap<QString,QString>::Iterator exIt; - for ( exIt = extra.begin(); exIt != extra.end(); ++exIt ) { - header.addExtraData( exIt.key(), exIt.data() ); - } - archive.writeHeader( header ); - for(QStringList::Iterator it = files.begin(); it != files.end(); ++it) { - QFileInfo f((*it)); - if(!f.exists()) { - qDebug("Failed to open %s", (*it).latin1()); - continue; - } - if(f.isDir()) - archive.writeDir( (*it), true, (*it) ); - else - archive.writeFile( (*it), (*it) ); - } - archive.close(); - } else { - return usage(argv[0]); - } - return 0; -} - -#include "main.moc" diff --git a/util/install/package/package.pro b/util/install/package/package.pro deleted file mode 100644 index 4edc96e..0000000 --- a/util/install/package/package.pro +++ /dev/null @@ -1,25 +0,0 @@ -TEMPLATE = app -SOURCES = main.cpp -INCLUDEPATH += ../archive $$QT_SOURCE_TREE/include ../keygen -CONFIG += qt console -TARGET = package -win32:DESTDIR = ../../../bin -unix:LIBS += -L$$QT_BUILD_TREE/util/install/archive -larq -win32:LIBS += ../archive/arq.lib -DEFINES -= UNICODE - -win32:!shared:SOURCES += \ - ../../../src/3rdparty/zlib/adler32.c \ - ../../../src/3rdparty/zlib/compress.c \ - ../../../src/3rdparty/zlib/crc32.c \ - ../../../src/3rdparty/zlib/deflate.c \ - ../../../src/3rdparty/zlib/gzio.c \ - ../../../src/3rdparty/zlib/infblock.c \ - ../../../src/3rdparty/zlib/infcodes.c \ - ../../../src/3rdparty/zlib/inffast.c \ - ../../../src/3rdparty/zlib/inflate.c \ - ../../../src/3rdparty/zlib/inftrees.c \ - ../../../src/3rdparty/zlib/infutil.c \ - ../../../src/3rdparty/zlib/trees.c \ - ../../../src/3rdparty/zlib/uncompr.c \ - ../../../src/3rdparty/zlib/zutil.c diff --git a/util/install/win/archive.cpp b/util/install/win/archive.cpp deleted file mode 100644 index 81f8e53..0000000 --- a/util/install/win/archive.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "archive.h" -#include "resource.h" -#include <qfile.h> -#include <qmessagebox.h> -#include <windows.h> - -bool addArchive( const QString& name ) -{ - QByteArray ba ; - - // Copy the install.exe first, since we can't update our own application - char aName[512]; - if ( GetModuleFileNameA( 0, aName, 512 ) == 0 ) { // we don't need wide character versions - QMessageBox::critical( 0, - "Could not add archive", - QString( "Could not add archive %1.\n" - "Could not get the name of the application.").arg(name) - ); - return false; - } - QFile fromFile( aName ); - if ( !fromFile.open( IO_ReadOnly ) ) { - QMessageBox::critical( 0, - "Could not add archive", - QString("Could not copy executable %1.\n").arg(aName) - ); - return false; - } - QString destinationName = name; - if ( destinationName.right(4) == ".arq" ) { - destinationName =destinationName.left( destinationName.length()-4 ); - } - destinationName += ".exe"; - QFile toFile( destinationName ); - if ( !toFile.open( IO_WriteOnly ) ) { - QMessageBox::critical( 0, - "Could not add archive", - QString("Could not copy executable %1 to %2.\n").arg(aName).arg(destinationName) - ); - return false; - } - ba = fromFile.readAll(); - toFile.writeBlock( ba ); - toFile.close(); - - // load the .arq file - QFile fArq( name ); - if ( !fArq.open( IO_ReadOnly ) ) { - QMessageBox::critical( 0, - "Could not add archive", - QString("Could not open archive %1.\n").arg(name) - ); - return false; - } - ba = fArq.readAll(); - - // update the binary res - ResourceSaver res( destinationName ); - QString errorMsg; - if ( !res.setData( "QT_ARQ", ba, &errorMsg ) ) { - QMessageBox::critical( 0, - "Could not add archive", - QString("Could not add archive %1.\n").arg(name) + errorMsg - ); - return false; - } - -#if 0 - QMessageBox::information( 0, - "Archive added", - QString("Added the archive %1.\n").arg(name) + errorMsg - ); -#endif - return true; -} diff --git a/util/install/win/archive.h b/util/install/win/archive.h deleted file mode 100644 index d470a27..0000000 --- a/util/install/win/archive.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef ARCHIVE_H -#define ARCHIVE_H - -#include <qstring.h> -#include "resource.h" - -bool addArchive( const QString &name ); - -#endif diff --git a/util/install/win/dialogs/folderdlg.ui b/util/install/win/dialogs/folderdlg.ui deleted file mode 100644 index c5427e2..0000000 --- a/util/install/win/dialogs/folderdlg.ui +++ /dev/null @@ -1,184 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>FolderDlg</class> -<widget class="QDialog"> - <property name="name"> - <cstring>FolderDlg</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>323</width> - <height>369</height> - </rect> - </property> - <property name="caption"> - <string>Select installation folder</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QListView"> - <column> - <property name="text"> - <string>Start menu folder tree</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizeable"> - <bool>true</bool> - </property> - </column> - <property name="name"> - <cstring>folderTree</cstring> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout2</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>nameLabel</cstring> - </property> - <property name="text"> - <string>Folder name</string> - </property> - </widget> - <widget class="QLineEdit"> - <property name="name"> - <cstring>folderName</cstring> - </property> - </widget> - </hbox> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout1</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <spacer> - <property name="name" stdset="0"> - <cstring>Spacer1</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>okButton</cstring> - </property> - <property name="text"> - <string>Ok</string> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>cancelButton</cstring> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - <spacer> - <property name="name" stdset="0"> - <cstring>Spacer2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </vbox> -</widget> -<connections> - <connection> - <sender>okButton</sender> - <signal>clicked()</signal> - <receiver>FolderDlg</receiver> - <slot>accept()</slot> - </connection> - <connection> - <sender>cancelButton</sender> - <signal>clicked()</signal> - <receiver>FolderDlg</receiver> - <slot>reject()</slot> - </connection> - <connection> - <sender>folderTree</sender> - <signal>expanded(QListViewItem*)</signal> - <receiver>FolderDlg</receiver> - <slot>expandedDir(QListViewItem*)</slot> - </connection> - <connection> - <sender>folderTree</sender> - <signal>collapsed(QListViewItem*)</signal> - <receiver>FolderDlg</receiver> - <slot>collapsedDir(QListViewItem*)</slot> - </connection> - <connection> - <sender>folderTree</sender> - <signal>selectionChanged(QListViewItem*)</signal> - <receiver>FolderDlg</receiver> - <slot>selectedDir(QListViewItem*)</slot> - </connection> - <slot access="public" language="C++">collapsedDir( QListViewItem* )</slot> - <slot access="protected" language="C++">destroy()</slot> - <slot access="public" language="C++">expandedDir( QListViewItem* )</slot> - <slot access="public" language="C++">selectedDir( QListViewItem* )</slot> - <slot access="protected" language="C++">init()</slot> -</connections> -<tabstops> - <tabstop>folderTree</tabstop> - <tabstop>folderName</tabstop> - <tabstop>okButton</tabstop> - <tabstop>cancelButton</tabstop> -</tabstops> -</UI> diff --git a/util/install/win/dialogs/folderdlgimpl.cpp b/util/install/win/dialogs/folderdlgimpl.cpp deleted file mode 100644 index 8c3c27f..0000000 --- a/util/install/win/dialogs/folderdlgimpl.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "folderdlgimpl.h" -#include "../shell.h" -#include <qlineedit.h> -#include <qlistview.h> -#include <qpixmap.h> -#include <qdir.h> - -FolderDlgImpl::FolderDlgImpl( QWidget* parent, const char* name, bool modal, WindowFlags f ) : - FolderDlg( parent, name, modal, f ) -{ -} - -void FolderDlgImpl::setup( QString programsFolder, QString folder ) -{ - folderName->setText( folder ); - if( programsFolder.length() ) { - QString topLevel = programsFolder.mid( programsFolder.findRev( '\\' ) + 1 ); - QListViewItem* topItem = new QListViewItem( folderTree, topLevel ); - topItem->setOpen( true ); - topItem->setPixmap( 0, *WinShell::getOpenFolderImage() ); - - ScanFolder( programsFolder, topItem ); - - } -} - -void FolderDlgImpl::ScanFolder( QString folderPath, QListViewItem* parent ) -{ - QDir folderDir( folderPath ); - folderDir.setFilter( QDir::Dirs ); - folderDir.setSorting( QDir::Name | QDir::IgnoreCase ); - const QFileInfoList* fiList = folderDir.entryInfoList(); - QFileInfoListIterator it( *fiList ); - QFileInfo* fi; - - while( ( fi = it.current() ) ) { - if( fi->fileName()[0] != '.' ) { // Exclude dot-dirs - QListViewItem* item = new QListViewItem( parent, fi->fileName() ); - item->setOpen( false ); - item->setPixmap( 0, *WinShell::getClosedFolderImage() ); - ScanFolder( fi->absFilePath(), item ); - } - ++it; - } -} - -void FolderDlgImpl::expandedDir( QListViewItem* item ) -{ - item->setPixmap( 0, *WinShell::getOpenFolderImage() ); -} - -void FolderDlgImpl::collapsedDir( QListViewItem* item ) -{ - item->setPixmap( 0, *WinShell::getClosedFolderImage() ); -} - -QString FolderDlgImpl::getFolderName() -{ - return folderName->text(); -} - -/* -** This will replace the contents of the folderName lineedit widget. -** -** The algoritm will traverse the item tree until it gets to the toplevel -** item, prepending each name to the folder name as it goes -*/ -void FolderDlgImpl::selectedDir( QListViewItem* item ) -{ - QListViewItem* currentItem = item; - QString newFolder; - - while( currentItem->parent() ) { - newFolder = currentItem->text( 0 ) + QString( "\\" ) + newFolder; - currentItem = currentItem->parent(); - } - newFolder.truncate( newFolder.length() - 1 ); - folderName->setText( newFolder ); -} diff --git a/util/install/win/environment.cpp b/util/install/win/environment.cpp deleted file mode 100644 index bbf5719..0000000 --- a/util/install/win/environment.cpp +++ /dev/null @@ -1,362 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "environment.h" -#include <qnamespace.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qsettings.h> -#if defined(Q_OS_WIN32) -#include <windows.h> -#endif -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -QString QEnvironment::getEnv( const QString &varName, int envBlock ) -{ -#if defined(Q_OS_WIN32) - OSVERSIONINFOA osvi; - HKEY hkKey; - bool isWinMe = false; - - if( envBlock & GlobalEnv ) - hkKey = HKEY_LOCAL_MACHINE; - else - hkKey = HKEY_CURRENT_USER; - - osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFOA ); - GetVersionExA( &osvi ); - if( int( qWinVersion() ) & int( Qt::WV_98 ) ) { - if( osvi.dwMinorVersion == 90 ) - isWinMe = true; - } - - if( envBlock & PersistentEnv ) { - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - HKEY env; - QByteArray buffer; - DWORD size( 0 ); - QString value; - - if( RegOpenKeyExW( hkKey, L"Environment", 0, KEY_READ, &env ) == ERROR_SUCCESS ) { - RegQueryValueExW( env, (const wchar_t*) varName.ucs2(), 0, NULL, NULL, &size ); - buffer.resize( size ); - RegQueryValueExW( env, (const wchar_t*) varName.ucs2(), 0, NULL, (unsigned char*)buffer.data(), &size ); - for( int i = 0; i < ( int )buffer.size(); i += 2 ) { - QChar c( buffer[ i ], buffer[ i + 1 ] ); - if( !c.isNull() ) - value += c; - } - RegCloseKey( env ); - return value; - } - else { - return QString(); - } - } - else { // Win 9x - // Persistent environment on Windows 9x is not fully supported yet. - return QString( getenv( varName ) ); - } - } - if( envBlock & LocalEnv ) { - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - int size = GetEnvironmentVariableW( (TCHAR*)varName.ucs2(), 0, 0 ); - if ( size == 0 ) - return QString(); - TCHAR *data = new TCHAR[ size ]; - GetEnvironmentVariableW( (TCHAR*)varName.ucs2(), data, size ); - QString ret = QString::fromUcs2( data ); - delete[] data; - return ret; - } else { - QCString varNameL = varName.local8Bit(); - int size = GetEnvironmentVariableA( varNameL.data(), 0, 0 ); - if ( size == 0 ) - return QString(); - char *data = new char[ size ]; - GetEnvironmentVariableA( varNameL.data(), data, size ); - QString ret = QString::fromLocal8Bit( data ); - delete[] data; - return ret; - } - } -#elif defined(Q_OS_UNIX) -// Persistent environment on Unix is not supported yet. - if( envBlock & LocalEnv ) { - return QString( getenv( varName ) ); - } -#endif - return QString(); -} - -void QEnvironment::putEnv( const QString &varName, const QString &varValue, int envBlock ) -{ -#if defined(Q_OS_WIN32) - OSVERSIONINFOA osvi; - HKEY hkKey; - bool isWinMe = false; - - if( envBlock & GlobalEnv ) - hkKey = HKEY_LOCAL_MACHINE; - else - hkKey = HKEY_CURRENT_USER; - - osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFOA ); - GetVersionExA( &osvi ); - if( int( qWinVersion() ) & int( Qt::WV_98 ) ) { - if( osvi.dwMinorVersion == 90 ) - isWinMe = true; - } - - if( envBlock & PersistentEnv ) { - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - - HKEY env; - QByteArray buffer; - - buffer.resize( varValue.length() * 2 + 2 ); - const QChar *data = varValue.unicode(); - int i; - for ( i = 0; i < (int)varValue.length(); ++i ) { - buffer[ 2*i ] = data[ i ].cell(); - buffer[ (2*i)+1 ] = data[ i ].row(); - } - buffer[ (2*i) ] = 0; - buffer[ (2*i)+1 ] = 0; - - if( RegOpenKeyExW( hkKey, L"Environment", 0, KEY_WRITE, &env ) == ERROR_SUCCESS ) { - RegSetValueExW( env, (const wchar_t*) varName.ucs2(), 0, REG_EXPAND_SZ, (const unsigned char*)buffer.data(), buffer.size() ); - RegCloseKey( env ); - } - DWORD res; - SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, LPARAM("Environment"), SMTO_ABORTIFHUNG | SMTO_BLOCK, 1, &res); - } - else { // Win 9x - QFile autoexec( "c:\\autoexec.bat" ); - QTextStream ostream( &autoexec ); - ostream.setEncoding( QTextStream::Locale ); - - if( autoexec.open( IO_Append | IO_ReadWrite | IO_Translate ) ) { - ostream << "set " << varName << "=" << varValue << endl; - autoexec.close(); - } - } - } - if( envBlock & LocalEnv ) { - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - SetEnvironmentVariableW( (TCHAR*)varName.ucs2(), (const wchar_t*) varValue.ucs2() ); - } else { - SetEnvironmentVariableA( varName.local8Bit(), varValue.local8Bit() ); - } - } -#else - if( envBlock & LocalEnv ) - setenv( varName, varValue, 1 ); -#endif -} - -void QEnvironment::removeEnv( const QString &varName, int envBlock ) -{ -#if defined(Q_OS_WIN32) - HKEY hkKey; - if( envBlock & GlobalEnv ) - hkKey = HKEY_LOCAL_MACHINE; - else - hkKey = HKEY_CURRENT_USER; - - if( envBlock & PersistentEnv ) { - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - HKEY env; - if( RegOpenKeyExW( hkKey, L"Environment", 0, KEY_WRITE, &env ) == ERROR_SUCCESS ) { - RegDeleteValue( env, (const wchar_t*) varName.ucs2() ); - RegCloseKey( env ); - } - } - else { // Win 9x - QFile autoexec( "c:\\autoexec.bat" ); - QTextStream ostream( &autoexec ); - ostream.setEncoding( QTextStream::Locale ); - - if( autoexec.open( IO_Append | IO_ReadWrite | IO_Translate ) ) { - ostream << "set " << varName << "=" << endl; - autoexec.close(); - } - } - } - - if( envBlock & LocalEnv ) { - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - SetEnvironmentVariableW( (TCHAR*)varName.ucs2(), 0 ); - } else { - SetEnvironmentVariableA( varName.local8Bit(), 0 ); - } - } -#endif -} - -#if defined(Q_OS_WIN32) -void QEnvironment::recordUninstall( const QString &displayName, const QString &cmdString ) -{ - QSettings settings; - settings.insertSearchPath(QSettings::Windows, "/Microsoft/Windows/CurrentVersion/Uninstall"); - settings.beginGroup("/" + displayName); - settings.writeEntry("/DisplayName", displayName); - settings.writeEntry("/Publisher", "Nokia Corporation and/or its subsidiary(-ies)"); - settings.writeEntry("/URLInfoAbout", "http://qtsoftware.com"); - settings.writeEntry("/HelpLink", "http://qtsoftware.com/support"); - settings.writeEntry("/UninstallString", cmdString); - settings.endGroup(); -} - -void QEnvironment::removeUninstall( const QString &displayName ) -{ - QSettings settings; - settings.insertSearchPath(QSettings::Windows, "/Microsoft/Windows/CurrentVersion/Uninstall"); - settings.beginGroup("/" + displayName); - settings.removeEntry("/DisplayName"); - settings.removeEntry("/Publisher"); - settings.removeEntry("/URLInfoAbout"); - settings.removeEntry("/DisplayVersion"); - settings.removeEntry("/HelpLink"); - settings.removeEntry("/UninstallString"); - settings.removeEntry("/."); - settings.endGroup(); -} - -QString QEnvironment::getRegistryString( const QString &keyName, const QString &valueName, int scope ) -{ - QString value; - HKEY scopeKeys[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }; - HKEY key; - DWORD valueSize( 0 ); - QByteArray buffer, expBuffer; - - if( int( qWinVersion() ) & int(Qt::WV_NT_based) ) { - if( RegOpenKeyExW( scopeKeys[ scope ], (const wchar_t*) keyName.ucs2(), 0, KEY_READ, &key ) == ERROR_SUCCESS ) { - if( RegQueryValueExW( key, (const wchar_t*) valueName.ucs2(), NULL, NULL, NULL, &valueSize ) == ERROR_SUCCESS ) { - buffer.resize( valueSize ); - if( RegQueryValueExW( key, (const wchar_t*) valueName.ucs2(), NULL, NULL, (unsigned char*)buffer.data(), &valueSize ) == ERROR_SUCCESS ) { - valueSize = ExpandEnvironmentStringsW( (WCHAR*)buffer.data(), NULL, 0 ); - expBuffer.resize( valueSize * 2 ); - ExpandEnvironmentStringsW( (WCHAR*)buffer.data(), (WCHAR*)expBuffer.data(), valueSize ); - for( int i = 0; i < ( int )expBuffer.size(); i += 2 ) { - QChar c( expBuffer[ i ], expBuffer[ i + 1 ] ); - if ( !c.isNull() ) - value += c; - } - } - } - RegCloseKey( key ); - } - } - else { - if( RegOpenKeyExA( scopeKeys[ scope ], keyName.local8Bit(), 0, KEY_READ, &key ) == ERROR_SUCCESS ) { - if( RegQueryValueExA( key, valueName.local8Bit(), NULL, NULL, NULL, &valueSize ) == ERROR_SUCCESS ) { - buffer.resize( valueSize ); - if( RegQueryValueExA( key, valueName.local8Bit(), NULL, NULL, (unsigned char*)buffer.data(), &valueSize ) == ERROR_SUCCESS ) { - valueSize = ExpandEnvironmentStringsA( buffer.data(), NULL, 0 ); - expBuffer.resize( valueSize ); - ExpandEnvironmentStringsA( buffer.data(), expBuffer.data(), valueSize ); - value = expBuffer.data(); - } - } - RegCloseKey( key ); - } - } - return value; -} -#endif - -QString QEnvironment::getTempPath() -{ -#if defined(Q_OS_WIN32) - DWORD tmpSize; - QByteArray tmp; - QString tmpPath; - - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - tmpSize = GetTempPathW( 0, NULL ); - tmp.resize( tmpSize * 2 ); - GetTempPathW( tmpSize, (WCHAR*)tmp.data() ); - for( int i = 0; i < ( int )tmp.size(); i += 2 ) { - QChar c( tmp[ i ], tmp[ i + 1 ] ); - if( !c.isNull() ) - tmpPath += c; - } - } - else { - tmpSize = GetTempPathA( 0, NULL ); - tmp.resize( tmpSize * 2 ); - GetTempPathA( tmpSize, tmp.data() ); - tmpPath = tmp.data(); - } -#elif defined(Q_OS_UNIX) - QString tmpPath = "/tmp"; -#endif - return tmpPath; -} - -QString QEnvironment::getLastError() -{ - return strerror( errno ); -} - -QString QEnvironment::getFSFileName( const QString& fileName ) -{ -#if defined(Q_OS_WIN32) - QByteArray buffer( MAX_PATH ); - QString tmp( fileName ); - - GetVolumeInformationA( fileName.left( fileName.find( '\\' ) + 1 ).local8Bit(), NULL, NULL, NULL, NULL, NULL, buffer.data(), buffer.size() ); - if( QString( buffer.data() ) != "NTFS" ) { - DWORD dw; - dw = GetShortPathNameA( fileName.local8Bit(), (char*)buffer.data(), buffer.size() ); - if( dw > 0 ) - tmp = buffer.data(); - } -#elif defined(Q_OS_UNIX) - QString tmp( fileName ); -#endif - return tmp; -} diff --git a/util/install/win/environment.h b/util/install/win/environment.h deleted file mode 100644 index d0f45e4..0000000 --- a/util/install/win/environment.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef ENVIRONMENT_H -#define ENVIRONMENT_H - -#include <qstring.h> - -class QEnvironment -{ -public: - static QString getEnv( const QString &varName, int envBlock = LocalEnv ); - static void putEnv( const QString &varName, const QString &varValue, int envBlock = LocalEnv ); - static void removeEnv( const QString &varName, int envBlock = LocalEnv ); -#if defined(Q_OS_WIN32) - static QString getRegistryString( const QString &keyName, const QString &valueName, int scope = CurrentUser ); - static void recordUninstall( const QString &displayName, const QString &cmdString ); - static void removeUninstall( const QString &displayName ); -#endif - static QString getTempPath(); - static QString getLastError(); - static QString getFSFileName( const QString& fileName ); - - enum { - LocalEnv = 1, - PersistentEnv = 2, - GlobalEnv = 4 - }; - - enum { - CurrentUser = 0, - LocalMachine = 1 - }; -}; - -#endif diff --git a/util/install/win/globalinformation.cpp b/util/install/win/globalinformation.cpp deleted file mode 100644 index a05db1e..0000000 --- a/util/install/win/globalinformation.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "globalinformation.h" - -GlobalInformation::GlobalInformation() : - _qtVersionStr( QT_VERSION_STR ), - _reconfig( false ) -{ -#if defined(Q_OS_WIN32) - _sysId = Other; -#elif defined(Q_OS_MACX) - _sysId = MACX; -#else - _sysId = MingW32; -#endif -} - -GlobalInformation::~GlobalInformation() -{ -} - -void GlobalInformation::setReconfig( bool r ) -{ - _reconfig = r; -} - -bool GlobalInformation::reconfig() const -{ - return _reconfig; -} - -void GlobalInformation::setQtVersionStr( const QString& qvs ) -{ - _qtVersionStr = qvs; -} - -QString GlobalInformation::qtVersionStr() const -{ - return _qtVersionStr; -} - -#if defined(QSA) -void GlobalInformation::setQsaVersionStr( const QString& qvs ) -{ - _qsaVersionStr = qvs; -} - -QString GlobalInformation::qsaVersionStr() const -{ - return _qsaVersionStr; -} -#endif - -void GlobalInformation::setSysId( SysId s ) -{ - _sysId = s; -} - -GlobalInformation::SysId GlobalInformation::sysId() const -{ - return _sysId; -} - -QString GlobalInformation::text(Text t) const -{ - QString str; - - switch (_sysId) { - case MSVC: - if (t == IDE) - str = "Microsoft Visual Studio 6.0"; - else if (t == Mkspec) - str = "win32-msvc"; - else if (t == MakeTool) - str = "nmake.exe"; - break; - case MSVCNET: - if (t == IDE) - str = "Microsoft Visual Studio .NET"; - else if (t == Mkspec) - str = "win32-msvc.net"; - else if (t == MakeTool) - str = "nmake.exe"; - break; - case Watcom: - if (t == Mkspec) - str = "win32-watcom"; - else if (t == MakeTool) - str = "wmake.exe"; - break; - case Intel: - if (t == Mkspec) - str = "win32-icc"; - else if (t == MakeTool) - str = "nmake.exe"; - break; - case GCC: - if (t == Mkspec) - str = "win32-g++"; - else if (t == MakeTool) - str = "gmake.exe"; - break; - case MACX: - if (t == Mkspec) - str = "mac-g++"; - else if (t == MakeTool) - str = "make"; - break; - case MinGW: - if (t == Mkspec) - str = "win32-g++"; - else if (t == MakeTool) - str = "mingw32-make.exe"; - break; - case Borland: - if (t == Mkspec) - str = "win32-borland"; - else if (t == MakeTool) - str = "make.exe"; - break; - default: - if (t == Mkspec) - str = "Custom"; - else if (t == MakeTool) - str = "make.exe"; - break; - } - - return str; -} diff --git a/util/install/win/install-edu.rc b/util/install/win/install-edu.rc deleted file mode 100644 index 3e50c1c..0000000 --- a/util/install/win/install-edu.rc +++ /dev/null @@ -1,3 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "install.ico" -LICENSE RCDATA "../../../dist/edu/LICENSE" -QT_ARQ RCDATA "qt.arq" diff --git a/util/install/win/install-eval.rc b/util/install/win/install-eval.rc deleted file mode 100644 index 78f0477..0000000 --- a/util/install/win/install-eval.rc +++ /dev/null @@ -1,3 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "install.ico" -LICENSE RCDATA "../../../dist/trial/LICENSE" -QT_ARQ RCDATA "qt.arq" diff --git a/util/install/win/install-noncommercial.rc b/util/install/win/install-noncommercial.rc deleted file mode 100644 index b7d5b7c..0000000 --- a/util/install/win/install-noncommercial.rc +++ /dev/null @@ -1,4 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "install.ico" -LICENSE RCDATA "../../../dist/noncommercial/LICENSE" -LICENSE-US RCDATA "../../../dist/noncommercial/LICENSE-US" -QT_ARQ RCDATA "qt.arq" diff --git a/util/install/win/install-qsa.rc b/util/install/win/install-qsa.rc deleted file mode 100644 index f971c3f..0000000 --- a/util/install/win/install-qsa.rc +++ /dev/null @@ -1,5 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "install.ico" -LICENSE RCDATA "../../../dist/trial/LICENSE" -LICENSE_QSA RCDATA "../../../../qsa/dist/eval/LICENSE.EVAL" -QT_ARQ RCDATA "qt.arq" -QSA_ARQ RCDATA "qt.arq" diff --git a/util/install/win/install.ico b/util/install/win/install.ico Binary files differdeleted file mode 100644 index b996fb7..0000000 --- a/util/install/win/install.ico +++ /dev/null diff --git a/util/install/win/install.rc b/util/install/win/install.rc deleted file mode 100644 index 321c245..0000000 --- a/util/install/win/install.rc +++ /dev/null @@ -1,4 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "install.ico" -LICENSE RCDATA "../../../dist/commercial/LICENSE" -LICENSE-US RCDATA "../../../dist/commercial/LICENSE-US" -QT_ARQ RCDATA "qt.arq" diff --git a/util/install/win/main.cpp b/util/install/win/main.cpp deleted file mode 100644 index 0c21523..0000000 --- a/util/install/win/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qapplication.h> -#include <qmessagebox.h> -#include "setupwizardimpl.h" -#include "resource.h" -#include "globalinformation.h" -#include "environment.h" - -#if defined Q_OS_WIN32 -#include "archive.h" -#endif - -GlobalInformation globalInformation; -SetupWizardImpl *wizard = 0; - -int main( int argc, char** argv ) -{ - QApplication app( argc, argv ); - int res( -1 ); - - for( int i = 0; i < app.argc(); i++ ) { - if( QString( app.argv()[i] ) == "-reconfig" ) { - globalInformation.setReconfig( true ); - - QString qmakespec = QEnvironment::getEnv( "QMAKESPEC" ); - for (int mks = 0; mks <= GlobalInformation::MACX; ++mks) { - if (globalInformation.text(GlobalInformation::Mkspec) == qmakespec) { - globalInformation.setSysId((GlobalInformation::SysId)mks); - break; - } - } - - if ( ++i < app.argc() ) { - globalInformation.setQtVersionStr( app.argv()[i] ); - } - break; -#if defined(Q_OS_WIN32) - } else if ( QString( app.argv()[i] ) == "-add-archive" ) { - // -add-archive is an internal option to add the - // binary resource QT_ARQ - if ( ++i < app.argc() ) { - if ( addArchive( app.argv()[i] ) ) - return 0; - } - return res; -#endif - } - } - - wizard = new SetupWizardImpl( 0, 0, false, Qt::WStyle_NormalBorder | Qt::WStyle_Customize | Qt::WStyle_MinMax | Qt::WStyle_SysMenu | Qt::WStyle_Title ); - wizard->show(); - - app.setMainWidget( wizard ); - res = app.exec(); - - wizard->stopProcesses(); - - //### memory leak - - return res; -} diff --git a/util/install/win/pages/buildpage.ui b/util/install/win/pages/buildpage.ui deleted file mode 100644 index 0ab4965..0000000 --- a/util/install/win/pages/buildpage.ui +++ /dev/null @@ -1,92 +0,0 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>BuildPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>BuildPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>462</width> - <height>276</height> - </rect> - </property> - <property name="caption"> - <string>Form11</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout13</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QTextView"> - <property name="name"> - <cstring>outputDisplay</cstring> - </property> - <property name="font"> - <font> - <family>Courier</family> - </font> - </property> - <property name="vScrollBarMode"> - <enum>AlwaysOn</enum> - </property> - <property name="hScrollBarMode"> - <enum>AlwaysOn</enum> - </property> - <property name="textFormat"> - <enum>LogText</enum> - </property> - <property name="wordWrap"> - <enum>NoWrap</enum> - </property> - <property name="autoFormatting"> - <set>AutoNone</set> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout12</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QProgressBar"> - <property name="name"> - <cstring>compileProgress</cstring> - </property> - <property name="percentageVisible"> - <bool>false</bool> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>restartBuild</cstring> - </property> - <property name="text"> - <string><Replace></string> - </property> - </widget> - </hbox> - </widget> - </vbox> - </widget> - </hbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/configpage.ui b/util/install/win/pages/configpage.ui deleted file mode 100644 index 8223d8e..0000000 --- a/util/install/win/pages/configpage.ui +++ /dev/null @@ -1,474 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>ConfigPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>ConfigPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>460</width> - <height>284</height> - </rect> - </property> - <property name="caption"> - <string>Form9</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout3</cstring> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QCheckBox" row="1" column="3"> - <property name="name"> - <cstring>rebuildInstallation</cstring> - </property> - <property name="text"> - <string>Rebuild Qt after reconfiguration</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QTextView" row="0" column="2" rowspan="1" colspan="2"> - <property name="name"> - <cstring>explainOption</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>5</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="palette"> - <palette> - <active> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>233</red> - <green>231</green> - <blue>227</blue> - </color> - <color> - <red>106</red> - <green>104</green> - <blue>100</blue> - </color> - <color> - <red>141</red> - <green>138</green> - <blue>133</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>10</red> - <green>36</green> - <blue>106</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>255</blue> - </color> - <color> - <red>255</red> - <green>0</green> - <blue>255</blue> - </color> - </active> - <disabled> - <color> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>243</red> - <green>239</green> - <blue>230</blue> - </color> - <color> - <red>106</red> - <green>104</green> - <blue>100</blue> - </color> - <color> - <red>141</red> - <green>138</green> - <blue>133</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>10</red> - <green>36</green> - <blue>106</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>255</blue> - </color> - <color> - <red>255</red> - <green>0</green> - <blue>255</blue> - </color> - </disabled> - <inactive> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>243</red> - <green>239</green> - <blue>230</blue> - </color> - <color> - <red>106</red> - <green>104</green> - <blue>100</blue> - </color> - <color> - <red>141</red> - <green>138</green> - <blue>133</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>212</red> - <green>208</green> - <blue>200</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - <color> - <red>10</red> - <green>36</green> - <blue>106</blue> - </color> - <color> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - <color> - <red>0</red> - <green>0</green> - <blue>255</blue> - </color> - <color> - <red>255</red> - <green>0</green> - <blue>255</blue> - </color> - </inactive> - </palette> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>currentInstLabel</cstring> - </property> - <property name="text"> - <string>Active Qt installation</string> - </property> - </widget> - <widget class="QLabel" row="1" column="1" rowspan="1" colspan="2"> - <property name="name"> - <cstring>currentInstallation</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - <property name="text"> - <string></string> - </property> - </widget> - <widget class="QTabWidget" row="0" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>configTabs</cstring> - </property> - <widget class="QWidget"> - <property name="name"> - <cstring>installTab</cstring> - </property> - <attribute name="title"> - <string>Install</string> - </attribute> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QListView"> - <column> - <property name="text"> - <string>Installation options</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizeable"> - <bool>false</bool> - </property> - </column> - <property name="name"> - <cstring>installList</cstring> - </property> - </widget> - </vbox> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>generalTab</cstring> - </property> - <attribute name="title"> - <string>General</string> - </attribute> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QListView" row="0" column="0"> - <column> - <property name="text"> - <string>Qt Library configuration</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizeable"> - <bool>false</bool> - </property> - </column> - <property name="name"> - <cstring>configList</cstring> - </property> - </widget> - </grid> - </widget> - <widget class="QWidget"> - <property name="name"> - <cstring>advancedTab</cstring> - </property> - <attribute name="title"> - <string>Advanced</string> - </attribute> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QListView"> - <column> - <property name="text"> - <string>Advanced options</string> - </property> - <property name="clickable"> - <bool>true</bool> - </property> - <property name="resizeable"> - <bool>true</bool> - </property> - </column> - <property name="name"> - <cstring>advancedList</cstring> - </property> - </widget> - </hbox> - </widget> - </widget> - </grid> - </widget> - </hbox> -</widget> -<tabstops> - <tabstop>configTabs</tabstop> - <tabstop>configList</tabstop> - <tabstop>explainOption</tabstop> - <tabstop>rebuildInstallation</tabstop> - <tabstop>advancedList</tabstop> -</tabstops> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/finishpage.ui b/util/install/win/pages/finishpage.ui deleted file mode 100644 index de6b5f7..0000000 --- a/util/install/win/pages/finishpage.ui +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>FinishPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>FinishPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>444</width> - <height>284</height> - </rect> - </property> - <property name="caption"> - <string>Form12</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout1</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QTextView"> - <property name="name"> - <cstring>finishText</cstring> - </property> - </widget> - <widget class="QCheckBox"> - <property name="name"> - <cstring>showReadmeCheck</cstring> - </property> - <property name="text"> - <string>Show README file</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </vbox> - </widget> - </hbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/folderspage.ui b/util/install/win/pages/folderspage.ui deleted file mode 100644 index ada15f7..0000000 --- a/util/install/win/pages/folderspage.ui +++ /dev/null @@ -1,259 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>FoldersPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>FoldersPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>443</width> - <height>284</height> - </rect> - </property> - <property name="caption"> - <string>Form8</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout15</cstring> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QGroupBox" row="0" column="0"> - <property name="name"> - <cstring>folderBox</cstring> - </property> - <property name="title"> - <string>Folders and paths</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel" row="0" column="0"> - <property name="name"> - <cstring>folderLabel</cstring> - </property> - <property name="text"> - <string>Program &folder</string> - </property> - <property name="buddy" stdset="0"> - <cstring>folderPath</cstring> - </property> - </widget> - <widget class="QLayoutWidget" row="0" column="1" rowspan="1" colspan="2"> - <property name="name"> - <cstring>Layout2</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLineEdit"> - <property name="name"> - <cstring>folderPath</cstring> - </property> - <property name="frameShape"> - <enum>StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>folderPathButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - </widget> - </hbox> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>qtDirLabel</cstring> - </property> - <property name="text"> - <string>Set &QTDIR</string> - </property> - <property name="buddy" stdset="0"> - <cstring>qtDirCheck</cstring> - </property> - </widget> - <widget class="QLabel" row="2" column="0"> - <property name="name"> - <cstring>devSysLabel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>&Path</string> - </property> - <property name="buddy" stdset="0"> - <cstring>devSysPath</cstring> - </property> - </widget> - <widget class="QLayoutWidget" row="2" column="1" rowspan="1" colspan="2"> - <property name="name"> - <cstring>Layout3</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLineEdit"> - <property name="name"> - <cstring>devSysPath</cstring> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>devSysPathButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - </widget> - </hbox> - </widget> - <widget class="QLabel" row="3" column="0"> - <property name="name"> - <cstring>groupLabel</cstring> - </property> - <property name="text"> - <string>Folder &group</string> - </property> - <property name="buddy" stdset="0"> - <cstring>folderGroups</cstring> - </property> - </widget> - <widget class="QComboBox" row="3" column="1" rowspan="1" colspan="2"> - <property name="name"> - <cstring>folderGroups</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - <widget class="QCheckBox" row="1" column="1"> - <property name="name"> - <cstring>qtDirCheck</cstring> - </property> - <property name="text"> - <string></string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <spacer row="1" column="2"> - <property name="name" stdset="0"> - <cstring>Spacer8</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - <spacer row="1" column="0"> - <property name="name" stdset="0"> - <cstring>Spacer2</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </grid> - </widget> - </hbox> -</widget> -<images> - <image name="image0"> - <data format="XPM.GZ" length="379">789c5d8ecb0a02310c45f7fd8ad0ec069907f531207e82e252101769b5388b51d07121e2bf6b1f195b6f28cd3d24b7ad0ad86dd75054e23ed0d0193067ba41717cf4fd737f58bd846ce6d028984123274296606073bd9c5c8fdf1eeba92b678db36dddaa60c959abec2258cdd62a9fc3424477a50cfdc18cc5d9c0e20eaffbbf90260c2a390f35c54a1823fa9bc39fc63cc3429e4b51cccb5060398a6c5478f7bd141fb90a5251</data> - </image> -</images> -<tabstops> - <tabstop>folderPath</tabstop> - <tabstop>folderPathButton</tabstop> - <tabstop>qtDirCheck</tabstop> - <tabstop>devSysPath</tabstop> - <tabstop>devSysPathButton</tabstop> - <tabstop>folderGroups</tabstop> -</tabstops> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/licenseagreementpage.ui b/util/install/win/pages/licenseagreementpage.ui deleted file mode 100644 index 5349e1f..0000000 --- a/util/install/win/pages/licenseagreementpage.ui +++ /dev/null @@ -1,202 +0,0 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>LicenseAgreementPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>LicenseAgreementPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>440</width> - <height>284</height> - </rect> - </property> - <property name="caption"> - <string>Form3</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout4</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>countryLayout</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <spacer> - <property name="name"> - <cstring>spacer4</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>31</width> - <height>21</height> - </size> - </property> - </spacer> - <widget class="QLabel"> - <property name="name"> - <cstring>countryLabel</cstring> - </property> - <property name="text"> - <string>Please choose your region:</string> - </property> - </widget> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>North or South America</string> - </property> - </item> - <item> - <property name="text"> - <string>Anywhere outside North and South America</string> - </property> - </item> - <property name="name"> - <cstring>countryCombo</cstring> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer3</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>51</width> - <height>21</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget class="QTextView"> - <property name="name"> - <cstring>introText</cstring> - </property> - <property name="text"> - <string>The license could not be found in the package. The package might be corrupted.
-Please contact support@trolltech.com to resolve the problem.</string> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout3</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <spacer> - <property name="name"> - <cstring>Spacer1_3</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>156</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>licenceButtons</cstring> - </property> - <property name="frameShape"> - <enum>NoFrame</enum> - </property> - <property name="title"> - <string></string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QRadioButton"> - <property name="name"> - <cstring>acceptLicense</cstring> - </property> - <property name="text"> - <string>I agree</string> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>rejectLicense</cstring> - </property> - <property name="text"> - <string>I disagree</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </vbox> - </widget> - <spacer> - <property name="name"> - <cstring>Spacer3</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>155</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </vbox> - </widget> - </hbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/licensepage.ui b/util/install/win/pages/licensepage.ui deleted file mode 100644 index 9c7b98c..0000000 --- a/util/install/win/pages/licensepage.ui +++ /dev/null @@ -1,264 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>LicensePage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>LicensePage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>445</width> - <height>284</height> - </rect> - </property> - <property name="caption"> - <string>Form2</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout6</cstring> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel" row="3" column="0"> - <property name="name"> - <cstring>licenseeLabel</cstring> - </property> - <property name="text"> - <string>Licensee</string> - </property> - </widget> - <widget class="QLabel" row="5" column="0"> - <property name="name"> - <cstring>expiryLabel</cstring> - </property> - <property name="text"> - <string>Support and upgrade expiry</string> - </property> - </widget> - <widget class="QLineEdit" row="5" column="1"> - <property name="name"> - <cstring>expiryDate</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - <widget class="QLineEdit" row="2" column="1"> - <property name="name"> - <cstring>licenseID</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - <widget class="QLabel" row="1" column="0"> - <property name="name"> - <cstring>customerIDLabel</cstring> - </property> - <property name="text"> - <string>Customer ID</string> - </property> - </widget> - <widget class="QLineEdit" row="6" column="1"> - <property name="name"> - <cstring>key</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - <widget class="QLabel" row="4" column="0"> - <property name="name"> - <cstring>productsLabel</cstring> - </property> - <property name="text"> - <string>Products</string> - </property> - <property name="buddy" stdset="0"> - <cstring>productsString</cstring> - </property> - </widget> - <widget class="QLineEdit" row="3" column="1"> - <property name="name"> - <cstring>licenseeName</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>licenseInfoHeader</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Enter the supplied license information here, all fields except Licensee are mandatory. -Alternatively, the installation wizard may read them from a license file.</string> - </property> - <property name="alignment"> - <set>WordBreak|AlignVCenter</set> - </property> - </widget> - <widget class="QComboBox" row="4" column="1"> - <item> - <property name="text"> - <string>qt-professional</string> - </property> - </item> - <item> - <property name="text"> - <string>qt-enterprise</string> - </property> - </item> - <property name="name"> - <cstring>productsString</cstring> - </property> - </widget> - <spacer row="8" column="1"> - <property name="name"> - <cstring>Spacer7</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - </spacer> - <widget class="QLabel" row="2" column="0"> - <property name="name"> - <cstring>licenseIDLabel</cstring> - </property> - <property name="text"> - <string>License ID</string> - </property> - </widget> - <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>Layout5</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <spacer> - <property name="name"> - <cstring>Spacer5</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>readLicenseButton</cstring> - </property> - <property name="text"> - <string>Read from file...</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Spacer6</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - </spacer> - </hbox> - </widget> - <widget class="QLineEdit" row="1" column="1"> - <property name="name"> - <cstring>customerID</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - <widget class="QLabel" row="6" column="0"> - <property name="name"> - <cstring>keyLabel</cstring> - </property> - <property name="text"> - <string>Product key</string> - </property> - </widget> - </grid> - </widget> - </hbox> -</widget> -<tabstops> - <tabstop>customerID</tabstop> - <tabstop>licenseID</tabstop> - <tabstop>licenseeName</tabstop> - <tabstop>productsString</tabstop> - <tabstop>expiryDate</tabstop> - <tabstop>key</tabstop> - <tabstop>readLicenseButton</tabstop> -</tabstops> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/optionspage.ui b/util/install/win/pages/optionspage.ui deleted file mode 100644 index 01033d2..0000000 --- a/util/install/win/pages/optionspage.ui +++ /dev/null @@ -1,503 +0,0 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>OptionsPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>OptionsPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>413</width> - <height>372</height> - </rect> - </property> - <property name="caption"> - <string>Form7</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout8</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QGroupBox"> - <property name="name"> - <cstring>optionsGroup</cstring> - </property> - <property name="title"> - <string>Installation options</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>pathLabel</cstring> - </property> - <property name="text"> - <string>Destination &path (appr. 1Gb free space required)</string> - </property> - <property name="buddy" stdset="0"> - <cstring>installPath</cstring> - </property> - </widget> - <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>pathLayout</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLineEdit"> - <property name="name"> - <cstring>installPath</cstring> - </property> - <property name="frameShape"> - <enum>LineEditPanel</enum> - </property> - <property name="frameShadow"> - <enum>Sunken</enum> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>installPathButton</cstring> - </property> - <property name="text"> - <string></string> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - </widget> - </hbox> - </widget> - <widget class="QCheckBox" row="2" column="1"> - <property name="name"> - <cstring>installExamples</cstring> - </property> - <property name="text"> - <string>Build &Examples</string> - </property> - <property name="accel"> - <string>Alt+E</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QCheckBox" row="2" column="0"> - <property name="name"> - <cstring>installTools</cstring> - </property> - <property name="text"> - <string>Build &Tools</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QCheckBox" row="3" column="0"> - <property name="name"> - <cstring>installExtensions</cstring> - </property> - <property name="text"> - <string>Build E&xtensions</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QCheckBox" row="3" column="1"> - <property name="name"> - <cstring>installTutorials</cstring> - </property> - <property name="text"> - <string>Build T&utorials</string> - </property> - <property name="accel"> - <string>Alt+U</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QCheckBox" row="4" column="1"> - <property name="name"> - <cstring>skipBuild</cstring> - </property> - <property name="text"> - <string>&Skip Build Step</string> - </property> - <property name="accel"> - <string>Alt+S</string> - </property> - </widget> - <widget class="QCheckBox" row="4" column="0"> - <property name="name"> - <cstring>installDocs</cstring> - </property> - <property name="text"> - <string>Install &documentation</string> - </property> - <property name="accel"> - <string>Alt+D</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </grid> - </widget> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>sysGroup</cstring> - </property> - <property name="title"> - <string>Compiler options</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget" row="0" column="1"> - <property name="name"> - <cstring>layout13</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QCheckBox"> - <property name="name"> - <cstring>installIDEIntegration</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>&Integrate with IDE</string> - </property> - <property name="accel"> - <string></string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="buttonGroupId"> - <number>99</number> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer7_2</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>40</width> - <height>40</height> - </size> - </property> - </spacer> - </vbox> - </widget> - <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>layout21</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout20</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QRadioButton"> - <property name="name"> - <cstring>sysOther</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Other</string> - </property> - <property name="buttonGroupId"> - <number>4</number> - </property> - </widget> - <widget class="QComboBox"> - <item> - <property name="text"> - <string>win32-watcom</string> - </property> - </item> - <property name="name"> - <cstring>sysOtherCombo</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>5</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="duplicatesEnabled"> - <bool>false</bool> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>spacer9</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>121</width> - <height>21</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>noteLabel</cstring> - </property> - <property name="text"> - <string>Note: The compilers specified in the 'Other' section are not officially supported.</string> - </property> - </widget> - </vbox> - </widget> - <widget class="QLayoutWidget" row="0" column="0"> - <property name="name"> - <cstring>layout7</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QRadioButton"> - <property name="name"> - <cstring>sysMsvcNet</cstring> - </property> - <property name="text"> - <string>Microsoft Visual C++ .&NET</string> - </property> - <property name="accel"> - <string>Alt+N</string> - </property> - <property name="buttonGroupId"> - <number>0</number> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>sysMsvc</cstring> - </property> - <property name="text"> - <string>Microsoft &Visual C++</string> - </property> - <property name="accel"> - <string>Alt+V</string> - </property> - <property name="buttonGroupId"> - <number>1</number> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>sysBorland</cstring> - </property> - <property name="text"> - <string>&Borland C++</string> - </property> - <property name="accel"> - <string>Alt+V</string> - </property> - <property name="buttonGroupId"> - <number>2</number> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>sysMinGW</cstring> - </property> - <property name="text"> - <string>MinGW32</string> - </property> - <property name="buttonGroupId"> - <number>3</number> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>sysIntel</cstring> - </property> - <property name="text"> - <string>Intel C++</string> - </property> - <property name="buttonGroupId"> - <number>6</number> - </property> - </widget> - </vbox> - </widget> - - </grid> - </widget> - <spacer> - <property name="name"> - <cstring>spacer6</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>64</height> - </size> - </property> - </spacer> - </vbox> - </widget> - </hbox> -</widget> -<images> - <image name="image0"> - <data format="XPM.GZ" length="379">789c5d8ec10ac2300c86ef7d8ad0dc8a6cad4e3b101f41f1288887b43ae6610a3a0f22bebb766de6e65f4af27f247f9b2bd86dd7a072716fa93d7bf035dd401d1f4df3dc1f562f21cd02cc0ce660e444c80c3c6cae9753e8f1dba3d6bad03a581f6c5994d36829d8ca56365ac7b6b25d0e0b11431932ec2e8e589a8d2cedf07af71772845119e7a1a374068c11fdcde14f7d9e6721cf0d51ca1ba1c8c628b15ef1ddf7527c00b6995250</data> - </image> -</images> -<connections> - <connection> - <sender>sysOther</sender> - <signal>toggled(bool)</signal> - <receiver>sysOtherCombo</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>sysBorland</sender> - <signal>toggled(bool)</signal> - <receiver>installIDEIntegration</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>sysMsvcNet</sender> - <signal>toggled(bool)</signal> - <receiver>installIDEIntegration</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>sysMsvc</sender> - <signal>toggled(bool)</signal> - <receiver>installIDEIntegration</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>sysOther</sender> - <signal>toggled(bool)</signal> - <receiver>installIDEIntegration</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>sysMinGW</sender> - <signal>toggled(bool)</signal> - <receiver>installIDEIntegration</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>sysIntel</sender> - <signal>toggled(bool)</signal> - <receiver>installIDEIntegration</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>skipBuild</sender> - <signal>toggled(bool)</signal> - <receiver>installTools</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>skipBuild</sender> - <signal>toggled(bool)</signal> - <receiver>installTutorials</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>skipBuild</sender> - <signal>toggled(bool)</signal> - <receiver>installExtensions</receiver> - <slot>setDisabled(bool)</slot> - </connection> - <connection> - <sender>skipBuild</sender> - <signal>toggled(bool)</signal> - <receiver>installExamples</receiver> - <slot>setDisabled(bool)</slot> - </connection> -</connections> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/pages.cpp b/util/install/win/pages/pages.cpp deleted file mode 100644 index 3ee4093..0000000 --- a/util/install/win/pages/pages.cpp +++ /dev/null @@ -1,349 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "pages.h" -#include "resource.h" -#include "../environment.h" -#include <qcombobox.h> -#include <qlineedit.h> -#include <qcheckbox.h> -#include <qlabel.h> -#include <qvalidator.h> -#include <qdir.h> -#include <qbuttongroup.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qmultilineedit.h> -#include <qfiledialog.h> -#include <qtabwidget.h> -#include <qmessagebox.h> -#include <setupwizardimpl.h> -#include <qtextbrowser.h> -#include <qtextview.h> -#include <qlayout.h> - -#if defined(Q_OS_WIN32) -#include <windows.h> -#endif - -extern SetupWizardImpl *wizard; - -BuildPageImpl::BuildPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : BuildPage( parent, name, fl ) -{ -} - -ConfigPageImpl::ConfigPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : ConfigPage( parent, name, fl ) -{ - if( globalInformation.reconfig() ) { - currentInstLabel->show(); - currentInstallation->show(); -#if defined(Q_OS_WIN32) - // Makes no sense to have the rebuild installation option on DOS based - // Windows - if ( qWinVersion() & WV_NT_based ) -#endif - rebuildInstallation->show(); -#if defined(Q_OS_WIN32) - else { - rebuildInstallation->setChecked( false ); - rebuildInstallation->hide(); - } -#endif - } else { - currentInstLabel->hide(); - currentInstallation->hide(); - rebuildInstallation->hide(); - } -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - // ### these pages should probably be included but all options should be - // disabled so that the evaluation customer can see how he can configure Qt - configTabs->removePage( generalTab ); - configTabs->removePage( advancedTab ); -#else - configTabs->removePage( installTab ); -#endif -} - -FinishPageImpl::FinishPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : FinishPage( parent, name, fl ) -{ -#if !defined(Q_OS_WIN32) - showReadmeCheck->hide(); -#endif -} - -FoldersPageImpl::FoldersPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : FoldersPage( parent, name, fl ) -{ -#if defined(Q_OS_WIN32) - QByteArray buffer( 256 ); - unsigned long buffSize( buffer.size() ); - GetUserNameA( buffer.data(), &buffSize ); - folderGroups->insertItem( "Anyone who uses this computer (all users)" ); - folderGroups->insertItem( QString( "Only for me (" ) + QString( buffer.data() ) + ")" ); -#if defined(QSA) - folderPath->setText( QString( "QSA " ) + globalInformation.qsaVersionStr() ); -#else - folderPath->setText( QString( "Qt " ) + globalInformation.qtVersionStr() ); -#endif - if( qWinVersion() & Qt::WV_NT_based ) // On NT we also have a common folder - folderGroups->setEnabled( true ); - else - folderGroups->setDisabled( true ); -#elif defined(Q_OS_UNIX) - folderGroups->setDisabled( true ); -#endif -} - -LicenseAgreementPageImpl::LicenseAgreementPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : LicenseAgreementPage( parent, name, fl ), - titleStr("License agreement") -{ -#if !defined(NON_COMMERCIAL) - countryLabel->hide(); - countryCombo->hide(); - delete countryLayout; -#else - connect( countryCombo, SIGNAL(activated(int)), SLOT(countryChanged(int)) ); -#endif - connect( licenceButtons, SIGNAL(clicked(int)), SLOT(licenseAction(int))); -} - -void LicenseAgreementPageImpl::licenseAction(int act) -{ - if( act ) - wizard->setNextEnabled( this, false ); - else - wizard->setNextEnabled( this, true ); -} - -void LicenseAgreementPageImpl::countryChanged(int index) -{ - ResourceLoader *rcLoader; - if ( index == 0 ) - rcLoader = new ResourceLoader( "LICENSE-US" ); - else - rcLoader = new ResourceLoader( "LICENSE" ); - - if ( rcLoader->isValid() ) { - introText->setText( rcLoader->data() ); - } else { - QMessageBox::critical( this, tr("Package corrupted"), - tr("Could not find the LICENSE file in the package.\nThe package might be corrupted.") ); - } -} - -LicensePageImpl::LicensePageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : LicensePage( parent, name, fl ) -{ -#if defined(Q_OS_MAC) - // StyledPanel style looks very windowsish - customerID->setFrameShape( QFrame::LineEditPanel ); -#endif - customerID->setFocus(); -#if defined(EVAL) - // ### improve text -# if defined(QSA) - licenseInfoHeader->setText( tr("Thank you for your interest in QSA.\n" - "Please enter the license information you got for this evaluation version of QSA.") ); -# else - licenseInfoHeader->setText( tr("Thank you for your interest in Qt.\n" - "Please enter the license information you got for this evaluation version of Qt.") ); -# endif - - customerIDLabel->setText( tr("Name") ); - licenseIDLabel->setText( tr("Company name") ); - licenseeLabel->setText( tr("Serial number") ); - evalName = customerID; - evalCompany = licenseID; - serialNumber = licenseeName; - - expiryLabel->hide(); - expiryDate->hide(); - productsLabel->hide(); - productsString->hide(); - keyLabel->hide(); - key->hide(); - readLicenseButton->hide(); -#elif defined(EDU) - licenseInfoHeader->setText( tr("Please enter the license information for the educational edition of Qt.") ); - - customerIDLabel->setText( tr("Educational institution") ); - licenseeLabel->setText( tr("Serial number") ); - university = customerID; - serialNumber = licenseeName; - - licenseIDLabel->hide(); - licenseID->hide(); - expiryLabel->hide(); - expiryDate->hide(); - productsLabel->hide(); - productsString->hide(); - keyLabel->hide(); - key->hide(); - readLicenseButton->hide(); -#else - licenseID->setValidator( new QIntValidator( -1, 9999999, licenseID ) ); - - // expiryDate and productsString comes from the license key - expiryDate->setEnabled( false ); - productsString->setEnabled( false ); - keyLabel->setText( tr("License key") ); - licenseInfoHeader->setText( tr("Please enter your license information.\n" - "The License key is required to be able to proceed with the installation process.") ); -#endif -} - -QValidator::State InstallPathValidator::validate( QString& input, int& ) const -{ - if ( ( globalInformation.sysId() == GlobalInformation::MSVC || - globalInformation.sysId() == GlobalInformation::MSVCNET ) - && input.contains( QRegExp("\\s") ) ) { - QMessageBox::warning( 0, "Invalid directory", "No whitespace is allowed in the directory name due to a limitation with MSVC" ); - return Intermediate; - } else if ( globalInformation.sysId() == GlobalInformation::Borland && input.contains( "-" ) ) { - QMessageBox::warning( 0, "Invalid directory", "No '-' characters are allowed in the directory name due to a limitation in the " - "Borland linker" ); - return Intermediate; - } - return Acceptable; -} - -OptionsPageImpl::OptionsPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : OptionsPage( parent, name, fl ), - titleStr("Options"), - shortTitleStr("Choose options") -{ - connect( installPathButton, SIGNAL(clicked()), SLOT(choosePath())); - sysGroup->setButton(globalInformation.sysId()); -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - sysOther->hide(); - sysOtherCombo->hide(); - noteLabel->hide(); -#endif -#if defined(Q_OS_WIN32) - installPath->setText( - QString( "C:\\Qt\\" ) + - QString( globalInformation.qtVersionStr() ).replace( QRegExp("\\s"), "" ).replace( QRegExp("-"), "" ) - ); - installPath->setValidator( new InstallPathValidator( this ) ); -#elif defined(Q_OS_MAC) - // ### the replace for Windows is done because qmake has problems with - // spaces and Borland has problems with "-" in the filenames -- I don't - // think that there is a need for this on Mac (rms) - QString base("QtMac-"); - base = QDir::homeDirPath() + QDir::separator() + base; -#if defined(EVAL) - base += "Eval-"; -#elif defined(EDU) - base += "Edu-"; -#endif - installPath->setText(base + QString( globalInformation.qtVersionStr() ).replace( QRegExp("\\s"), "" )); - sysGroup->hide(); -#endif -} - -void OptionsPageImpl::choosePath() -{ - QDir dir( installPath->text() ); - -#if defined(Q_OS_WIN32) - if( !dir.exists() ) { -# if defined(QSA) - dir.setPath( "C:\\Qt_QSA" ); -# else - dir.setPath( "C:\\Qt" ); -#endif - } - - QString dest = QFileDialog::getExistingDirectory( installPath->text(), this, NULL, "Select installation directory" ); - if ( dest.isNull() ) { -# if defined(QSA) - dest = "C:\\Qt_QSA"; -# else - dest = "C:\\Qt"; -# endif - } - if ( dest.right(1) == "\\" ) { -# if defined(QSA) - dest += "Qt_QSA"; -# else - dest += "Qt"; -# endif - } - if ( dest.contains( QRegExp( "\\s" ) ) && !sysBorland->isChecked() ) - QMessageBox::warning( 0, "Invalid directory", "No whitespace is allowed in the directory name due to a limitation with MSVC" ); - else if ( dest.contains( "-" ) && sysBorland->isChecked() ) - QMessageBox::warning( 0, "Invalid directory", "No '-' characters are allowed in the directory name due to a limitation with the Borland linker" ); - else { - dir.setPath( dest ); - installPath->setText( QDir::toNativeSeparators(dir.absPath()) ); - } -#elif defined(Q_OS_MAC) - if( !dir.exists() ) - dir.setPath( "/" ); - - QString dest = QFileDialog::getExistingDirectory( installPath->text(), this, NULL, "Select installation directory" ); - if (!dest.isNull()) - installPath->setText( dest ); -#endif -} - -ProgressPageImpl::ProgressPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : ProgressPage( parent, name, fl ) -{ - // ######### At the moment, we show only one line when unpacking. So the - // horizontal scrollbar is never shown for now to avoid flickering. - filesDisplay->setHScrollBarMode( QScrollView::AlwaysOff ); -} - -#if defined(Q_OS_WIN32) -WinIntroPageImpl::WinIntroPageImpl( QWidget* parent, const char* name, WindowFlags fl ) - : WinIntroPage( parent, name, fl ) -{ -#if defined(QSA) - textBrowser->setText( "<p>This program installs Qt and QSA.</p>" + textBrowser->text() ); -#else - textBrowser->setText( "<p>This program installs Qt.</p>" + textBrowser->text() ); -#endif -} -#endif diff --git a/util/install/win/pages/pages.h b/util/install/win/pages/pages.h deleted file mode 100644 index 8108f42..0000000 --- a/util/install/win/pages/pages.h +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef PAGES_H -#define PAGES_H - -#include <qvalidator.h> - -#include "buildpage.h" -#include "configpage.h" -#include "finishpage.h" -#include "folderspage.h" -#include "licenseagreementpage.h" -#include "licensepage.h" -#include "optionspage.h" -#include "progresspage.h" -#include "winintropage.h" -#include "../globalinformation.h" - -class Page -{ -public: - virtual QString title() const = 0; - virtual QString shortTitle() const = 0; -}; - -class BuildPageImpl : public BuildPage, public Page -{ - Q_OBJECT -public: - BuildPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~BuildPageImpl() {} - QString title() const - { -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - return "Building Qt Examples and Tutorial"; -#else - return "Building Qt"; -#endif - } - QString shortTitle() const - { -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - return "Build Qt Examples"; -#else - return "Build Qt"; -#endif - } -}; - -class ConfigPageImpl : public ConfigPage, public Page -{ - Q_OBJECT -public: - ConfigPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~ConfigPageImpl() {} - QString title() const - { - if( globalInformation.reconfig() ) - return "Reconfigure Qt"; - else - return "Configuration"; - } - QString shortTitle() const - { return "Configure Qt"; } -}; - -class FinishPageImpl : public FinishPage, public Page -{ - Q_OBJECT -public: - FinishPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~FinishPageImpl() {} - QString title() const - { return "Finished"; } - QString shortTitle() const - { return "Finish"; } -}; - -class FoldersPageImpl : public FoldersPage, public Page -{ - Q_OBJECT -public: - FoldersPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~FoldersPageImpl() {} - QString title() const - { return "Folders"; } - QString shortTitle() const - { return "Choose folders"; } -}; - -class LicenseAgreementPageImpl : public LicenseAgreementPage, public Page -{ - Q_OBJECT -public: - LicenseAgreementPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~LicenseAgreementPageImpl() {} - QString title() const - { return titleStr; } - QString shortTitle() const - { return titleStr; } - -private slots: - void licenseAction(int); - void countryChanged(int); - -public: - QString titleStr; -}; - -class LicensePageImpl : public LicensePage, public Page -{ - Q_OBJECT -public: - LicensePageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~LicensePageImpl() {} - QString title() const - { -#if defined(QSA) - return QString("License Information to Install QSA %1").arg(globalInformation.qsaVersionStr()); -#else - return QString("License Information to Install Qt %1").arg(globalInformation.qtVersionStr()); -#endif - } - QString shortTitle() const - { return "License information"; } - -#if defined(EVAL) - QLineEdit* evalName; - QLineEdit* evalCompany; - QLineEdit* serialNumber; -#elif defined(EDU) - QLineEdit* university; - QLineEdit* serialNumber; -#endif -}; - -class InstallPathValidator : public QValidator -{ -public: - InstallPathValidator( QObject* parent = 0, const char* name = 0 ) : QValidator( parent, name ) {} - ~InstallPathValidator() {} - QValidator::State validate( QString& input, int& ) const; -}; - -class OptionsPageImpl : public OptionsPage, public Page -{ - Q_OBJECT -public: - OptionsPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~OptionsPageImpl() {} - QString title() const - { return titleStr; } - QString shortTitle() const - { return shortTitleStr; } - -private slots: - void choosePath(); - -public: - QString titleStr; - QString shortTitleStr; -}; - -class ProgressPageImpl : public ProgressPage, public Page -{ - Q_OBJECT -public: - ProgressPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~ProgressPageImpl() {} - QString title() const - { return "Installing"; } - QString shortTitle() const - { return "Install files"; } -}; - -class WinIntroPageImpl : public WinIntroPage, public Page -{ - Q_OBJECT -public: - WinIntroPageImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~WinIntroPageImpl() {} - QString title() const - { return "Introduction"; } - QString shortTitle() const - { return "Introduction"; } -}; - -#endif // PAGES_H diff --git a/util/install/win/pages/progresspage.ui b/util/install/win/pages/progresspage.ui deleted file mode 100644 index 927d975..0000000 --- a/util/install/win/pages/progresspage.ui +++ /dev/null @@ -1,78 +0,0 @@ -<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> -<class>ProgressPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>ProgressPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>440</width> - <height>286</height> - </rect> - </property> - <property name="caption"> - <string>Form10</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>layout2</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QTextEdit"> - <property name="name"> - <cstring>filesDisplay</cstring> - </property> - <property name="vScrollBarMode"> - <enum>AlwaysOn</enum> - </property> - <property name="hScrollBarMode"> - <enum>AlwaysOff</enum> - </property> - <property name="textFormat"> - <enum>LogText</enum> - </property> - <property name="linkUnderline"> - <bool>false</bool> - </property> - <property name="wordWrap"> - <enum>NoWrap</enum> - </property> - <property name="undoDepth"> - <number>0</number> - </property> - <property name="autoFormatting"> - <set>AutoNone</set> - </property> - </widget> - <widget class="QProgressBar"> - <property name="name"> - <cstring>operationProgress</cstring> - </property> - <property name="centerIndicator"> - <bool>false</bool> - </property> - <property name="percentageVisible"> - <bool>false</bool> - </property> - </widget> - </vbox> - </widget> - </hbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/sidedecoration.ui b/util/install/win/pages/sidedecoration.ui deleted file mode 100644 index 1ea5761..0000000 --- a/util/install/win/pages/sidedecoration.ui +++ /dev/null @@ -1,108 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>SideDecoration</class> -<widget class="QWidget"> - <property name="name"> - <cstring>SideDecoration</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>122</width> - <height>156</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>logoPixmap</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>AlignTop</set> - </property> - <property name="vAlign" stdset="0"> - </property> - </widget> - <widget class="QLayoutWidget"> - <property name="name"> - <cstring>Layout1</cstring> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>versionLabel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Installing Qt</string> - </property> - </widget> - <widget class="QLabel"> - <property name="name"> - <cstring>editionLabel</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>(Clear me)</string> - </property> - </widget> - </vbox> - </widget> - </vbox> -</widget> -<images> - <image name="image0"> - <data format="XPM.GZ" length="55092">789cccbd47b7eb38b2ef397f9fa2d6e5ecae5e7cf266d0035266cb6da7ed77af1ed07b2f1aa9bf7c83883f704c56d5cd7c75bb5f95d6c9ca5f8a22114044202200f0fccffffcdbe7d3fddffef37ffe8fea625c02eb6f966f947ffb4fbb4e92ebfff57fff9fffcffff88fe160f0b7fecf68389bfe6df41fffc7fff80febf96fd6df9401ff5fcff64232ffde36244f7a762ac953fefd56f29cf35cf2a267f3072ff9f733c906e7836493f35eb2c59fd74ab6797b1f243bfcfb46b2cb7fef0a1e72799c5af2907f7f94cce5732cc963fefd483297cf3a8387d43f992999ffde0c25f3dfb79a64de5f662099dfcfe924cf386f24f3fe4a44ff0fd17e5b327f9e772799dfcfb8078fa87d662499cbebbb9249de6fc9bcbd9d2f99dab795ccc7b31a48e6e3b71a4ae6e315ed25f3f1b04f82a93f0dc1636a9ff32999daf32599f757a54ae6fde17e48e6fae23892b97e78a2bd63ea1f438cef849e97e892f9f7652b99b76f3d91cce53763f0947e6f08fd9c1137b664de5e43c83fc7f53bf0022cf475499c8be719c4f113d824de5cc01671fd0eb6895dbaff50d8ab174ae6f2ad3ac9a47f63c924df4832d73f732a99f777f324998fb73993ccfb5f7f96ccc7df3a49e6e3514592b9bd3aa664ae1fd6bd646eaf9a2b98f4ddf52573fdb58e60d89f6d49e6df9b13c97c3c1d45326fbf634826ffb2934cfee40086fdf88164de7ff65232d9eb9b646e1fa607867e9bbe641a8f816092cf14f2423f4d070c7d8b9f25f3e7bbaf60e89fb791ccfb3b15df43ffe22f30f42f13f240ffea1b18fab716bf877ee967b043dc92bf1f0ea16fdd9af3a8f740bc3dbe64f2f70bc9bcbfcd2fc9bcbfbd4432f90b4730f5cff55e3297bfc9c0187f732899f4772099c6e35b321f7f6b0fc6f8daa6649aff7692f9f3724d32d7f7cb4932ef6ffb4e32e9b302c6f86723c9dcdefc50326f9ff32e99f7975382a10fd75c32d7e795906742fdd3bd49e6df67a2bdd09ff20886beb89164fefcd54932ef9ffa2c98fca72bda0b7d6a9f25f3feb0c4f842bf9a07b0d02fd13fd0afe2090cffd6c660e85b24ae87be05a40f63e1df8277c9bc7debab643e5e575732efef6e2799cb1bfcf89ecbdbed2573fd5cfd781e1fcf952d98fa3b91cf277f74cd24f3fe0f3ec08807ba8d64ae9fc54232e98f27993faff9f13df787ae680ff4d57995cce57103c95c7fac3bc97c7c7c5f308d67b8028bf9f72299cbd3dc49e6f2981f92797fd69664de5f7e2499dbb33b92ccdb6f2dc1d067772099fca72e99b7ff6a49a6f946f437f4b9bd48267934b0d0ef77c9bc7dad68df9cee9fee25f3fe69447fcc31df88f1843eaf6e92f9f3da89649a0fee25f3f1cb85be41ff0331bed07f5f8ca7f0a7d43f13a1df9d2a99f777f32899dfffea80111faeae92b93cee41f090f7effa0c463ce77f48a6f9ee51321fafeb4930f547bb01433fecb164fe7cff5b321f2f2f92ccfb3f93d793bd745b30f421ae2593bfd94be6fd1b2692b93cde4e32b79fda164ced8ddec1d017e74332f9dbb564de5e772899e299140c7dcaa692b93db8df92797fe61d18fe3117e303fd59b792e979b164de3f8918ff05f5cf46f40ff4c715e301fdb9bd80e13f57f792797fad4a30fce906bf17f3f51ae331c4fc19a13d43f89780e693a9f0a7ed028cebfd4e321fafe6198c7cc00b2473f9bc77c95cdf4a4ff0908fc75a5c8f78bfb52553fcf02999ebbfdf08a6f10e5ec1c2bfdc49a6f97c2b99e6ff27c9642f3fbee7fab416f2407fc299643efe912f99ec692099cbd3b492b9bc9ab8ff94c63711fd0bfdb2a792c93e2ac9140f689229df5125f3feed5660e85ffd2a99fce34432efdfee00867e5e14c9941f8ec0d0bfcc904cf9572a99b7a76e25f3fe73c760a1afaa646ebf99e85fe86f2ec61bfaea0b79e11f0ba12f2eda8bfb4b7d267b98897c64dd81a1cfeb503297afbd934cf1d45e30fc93f81ef363b896ccefbf3a4a26793dc1149fae7d30f247ff2a99ea1d3fbee7fed68b05a31eb1924cf9c2083ca5f6076bc9542fd948e6fa900e2473fdbbbc09463d630246be1a6692f9f84481643edef95532b73f5df01cfd7993ccdb7be92453beb5924cf3c14432efbf5cfc7e01fffa2999e6bfb1646e5f9b022ce2cba364de3e37114cfec132c0d047f74d32f9e37b30f26b2f05431f5763c9bc7f42c1d04797e6cf99d0c71be41fc21fa52a18fe24207d9f0bfd5a1d04d3f8570fe009d573dca3642e7fbb054f697ca237c1246f3a944cf53a5b32c5a72f60f81bd796ccaf4f2bc994af2d2593be6f2453bea682e7345eed4e32d5ff14c9bcbf2f57c95cff7dd15ef8a35097ccdb93cd25537e2bfa6b3124fffd055ec2bfcc24537c548045fe518331decda7647ebd2eda6ba37fc478c01f6d44ffb8d43e1ded17e3af3960cc97f5022cf481e257a6dd149fd96bf08cc6ffe64aa6f92604c35eec4032b7efab2799e2375b30e94b2aae5f50ff58aa642e6fe148a67ce1065e927fb80d2553bd2494cc9fdf3e49a6fc45c863c07e1dc97cfcd3a3606a5f7d05633e887682497faf4bb08df8e2030cfb2bc9de17a2ff4bf49f886762f4cf10f666bd80618f3e8dff92f5177f5e914be6ed2f36e005c91b5f24533cf22598ecafeec04be467ae64f28757b041bfaf5f040f29fe68c0268d9726da63917e14a2bdd0c7f424998f5f44fdb314fd91bf83a18f8105467fdc4660e86783e789fee94a30e215e3118c78a3a0f9dc60fd45fa34072f491fc329d8a0f685a964aae7dfc0265d5f2f05537f568f60d86bb091ccfbe36248e6fad988dfbba85f8e24533e48f66f88fe892b30fa67634ba6f97508467f6d1cb0a827435ed11f35fa6388f9c9a7f8c814f157fd065e92fe5f6e6083e42f5cb0897ac417d8227dca3fc036f55fb305431fba77c1747f3b02bba4df3ad9ab29e42f669229df46fb647fe460d8d3aa0243fecd2758d4bbefc0a21eb403a33f2a8a772c263f6fff35055ba827d1f85aa2bf2f1a58f4f70a8cfb252a18febdf1c0f02701f58f2dda7f5d48a6fe9b8071fff21d2cfc83603caf51c1b87fb106433f4b1a1f87fd17eebf1b17ec903efbd43e46b0f71a0c79cb2d58c4e72d18cf2f1bb078be0dc6f3339abf5cd11f8906c6f5de1a8cf846e3f6c1cbe724df068cf6548964ae3f1b130c7f9096608c7f7603a3bde90e8ce7bb2f60b4d77e00c39f075c9f98f639e47fa34832d7e7f84c2c9eb7ba80216ffb08c6f3cc042cd64f1a30e42f9760d88fe382d19e1ced19c11e42aebf0cf17cd306435ecb04a33d610e16f20b16f1470a16ed3981457cf9443c82bdae2660e19f79bc341c8be7d70e18cfd71ec022df8ac178feaa05e379d72bf108e3df70ff369cc8fe1d8345bc9c81d1fe60452cfaeb7a03c3be74ba7e2adbd382f1fbcb3b18e3910dc1689f4df24e657fd4603cafb2c168bffb0cc6f32b1ebf0c67e2fe01e9d34cdcef1283e12faa6f30ee67f860e1ffe660a1efdc7f0ee7e2fed58c58b6e70cc6ef8d002cd6173db0a83f2dc0d0b78edbf77021e5bd078bf6aec1f87d41fabd14f2155bb0f8fd108cdfeb2330da93de83f1fc8ac6d310f2ac1a309ed772ff3734c5fdb48d64ee0fb72e58d4e75ec0f87d7202a33f0d713df4a5237bb7e4782a60b11ee681d15eed112cee1782a1cf158f4f86b6b8bf6581c5fa2af5a733823f762d30eed7d2efdd11f2efcd1d18d76bdc5e468311f2a3c007e379f5082cea75f760e8fbfa8d782cf49dfba3d150fcbebc030b7bdc83a17f099faf472371ffe64c2ceed73460e883cefb6b3416f7ab4fc463e10f2c30e46b8927e279b94b2cee6f6cc1d087ec092cec4930c6f342f24f85fc46442caef75660e8cf85fb93d18cfd9ec783f1162ceaa37cfe19cdc5fd3ceabfb990d79d80d13eeb152cd64fe9fa85f8de7c05a33df9188cf66cbec0d0c7f50d0c7df3b8ff1f2d85bcce002ce227078ceb1d0f2cfca54e3c41fb6f74bd21ef5780f17c5d058bf53beeaf46e618ebd77a2299c77f5bba9f25c6b7f4c1c2bfbd80d19eeb07f104fda1933cb678de2603e37eba01c6ef6f57b0a8ff71ff3d72c6a8b7e8d47faee88fb507c6effd188cdf3bdc1ec67d38c739e2e3c5a63393e21723269e60fde4f22c99d677b93e307577285eb7b8fd8f27ecfe9cf50e0c7d8a79ff8ca7ec7bfefb6b412cc627db81c57e823730ead9eb1158d43fb8bce399b8fe7a0716eb5d7330c663c3fb733c67eda1fa484d2cc6c39a83a11fed193ca57a651282b13e16f3f96ebc9860bdc8d880c5fe810c2cf21bae8fe3e544d4cb23c93c5ed30a30ea071b170cff92d0f81813d443d71730eaed9a07c6f53eb7b7b1c9bee7fa117c49a6f5024b30c5b3760cb6b19ec9e3adb13331e8face93ccfbaf3883f13c23013ba8a72e05d3fd0d1b8c7c734df23b53d8df86facf9da03e7e1b80f1fc82f7e76430813e6d63e229fa3be5e333194e4cd40b52b04ded31b8fe4e4653110ff2fa0a73a736f28d9a788afd67fa180cfd6a1db0588fe3fe7f32610accfb77c3f59721f2c77c493cc5fe0aaf00e37eb731788afa4e059ed1f8361f60d48f6dde1f93d914ebc7460a46bd2fe4fd37994fc7940f6cbec1e89f98cf5f93a578def5013c433d86da6f4c51bf09b9bd4dcce982f2b39cebcbc49a22fff6b83e4dec29ea15d95932adb704c433acffebf43c776ad1fd039d7886f5d315bf3f5356f09acf77d3d1d4a5fa65734f3cc3fe035d134cf7372c30ec355b824dc413dc3fb0e9906574dcdf79c4e2f74501c6fa5b74104cdfb73c3e9d4ea6d6887f7fdb10b3e791bef1f9940ddf1ceb078fe005f5b7c5e7e3e96c86f58f8d0246fd3a76c1f311f9b377b043e31bf07c693a9fa1de19df816dec07f804bb584fa3fe5accc47a86069e517b82002cd6f775b043f39bc6e3dde9923d8eeb7332035bd47f3705ec60ff824d3cc7fecf84ebefd498c19e2faf609bfa2be6f9f0d49c2d51cff5c016e5fb2b176c8f78fb8b15d8a5fa99c9e7d7a93543fdab1b831dfafde6287844f5d10e8cf1af49bfac39c63bff024f499e98ee6fb3fb937f7d023bd4fed407bb435aafb124d37e2d5d30b53f03cf87d43eeb0d8cf5dd7803c67cb7e1f63d75587f707df1e9fece7c30a2fd5d7b30f6b3469f9269fdc792cce5594dc1587fba52ffb84c1edebecd5e326f7f41faebceb19f2cda8271bfa6133ca2e727e0118d4fb2164cfa9c2892f978af4c30eca1f1c19321d7bf2bff7e3660e34ff5e53bb043cfaf5dc174bf6c0076a97fdb929805acfcfb6d0446bdbee4ed9f0d857eddd660f89b6e2298da5f05c4ac3f687e6bc0c311ad87e07a263f9f0fda77f094da537f8067245fc5f569369a1963d29f2b31eb5fdabfe20ba6e7a777e0d188ff3eb9815906c29fa78227d04f053ca3f6b65c3f6663260fd553a93d2cfca4fec91bc95cfeea041e517f5fb8fece2662fcdd023c86ff33c1d31167cd06cf21cf5c308d679d8017d41f0df72fb3e9cc1ef3ebab14ec8c69bfc05432ed47d38885fe5d4cc9b4fe37028fc8fecb37c9649f25784cf6ebbf82e7f47dbc042fe87e05f5cf4ce8936b82e7f4fb36113ca6f17a002fe8f986b8de80fe8bef4dd28fc292cce52fa68269fc4d1effb0db2f49decd0c0c7fdc92fe2ce6131a3f6d2d98fcb7bf02cf49bf370330d68fea5a30fdde38831dfabea3fe59b2fea178b0009bd41e4f03db23aeff37713decb5f00593fc2df5a7c1ee47eb6f2330eadd17156c8ea87ff7609bfc45590b267f78d5c02e714bfa6ab2f1207ff80136c87ef22918f34dfe06c67cd186c48b018dafcee3cd99c5ee47faa48217647f99609bf4c7a0f1b2160392afa3f6da6cfc68bcd69279ff949f6093daef4ec1f067f5817831a4e76de8f70ebb9ece177c806d6abfb3235ec0dfba2bc9b4df9bc6d7ed1376ae5f5c3fe703263f6f4f520a1e53fc99102f66d4be8cf7cf7cc8e4e3d7673e784c7cdd82a7d4de5a03c3fe751e9f3265c2fca09be009d94fc2e397394b87c99f186bf08cfa4fe3fd3b9fb0e7717dacc792e97c0b8f5f58f8bb20d6793d613e5f2cc7b49fc5005bd49e35b56fb1c4fcecf1fe9e2fd9f7743dfdde582ca83f8267b049ed59f3f9686eb2eb69fd782699d62fa83de67244f67de1fa3eb79643b237ef2698f4ab9e8347d4feb0008fc99e1c6a8fbd70d05f4762261e6f9f46e3e730a6f3160618fdbbe6f9c6dc5d0ea8bd0df5bf6b88f89aebdfa25f00a5f8ff4e32edd749c0636aff66019ee17939780e7de2f92a73f643e8bb031e537b7c133c237bf5dec073ba7f44f71f1a225ea3e78f447f79dfe011ddcfe3f22dc68c29feff06e379ba0e9ed2ef0b1effb1747d44f3b1fd0d5ed2f78d0236c65cdf367c7e5fb0009858bf07cfd15f7bf082f4a3492473f96f19d8257b6df8f82e66cb05f55fbe223630ff6f797cbc98b3f67079527afe82319d17e1f6b7581a03fafdc693ccc7d7a0fb194b97da7bbb111b63f2af1bae9f0bd31810eb7cbd61612d1dd2bf94da671943c8cfe7af856d8c69be6e0563be594f2573fdd7b8bd2c1c763ded0f53c01392c7bb4ae6fdd3717d5db8c684fa4bbb134cdfa767f094e28180fba3e5c080fff15fc0b309f5ef9764d24ff13dfc43cae7a3e5d0807d6cf8782d47acbdfcfeed0b783ea1fad50ebca0ef6f3ed82079a32f30f2c5644f6c627f5acce7df655fd0e1e3930460a662dc3f1cc14beaaf40133ca178a8069bf47cdf90ccc74ff3c10e8de78dfa676c8afd09b564daff5982b1ff36a6f64c58ffd2fed40b7836a1fac504bc9c50fd6101c6fc97abc426e2b3700fc67911f3018cf33ac99d643e1edd198cf3176e07463da4fa0063bf8826be47bd53e7fe773965e345fded806db217eb1d8c78f29612b3f6923ea9603cbffb0663bf4949d7b38083c663b3022f68fceb7bb043f6118682a9ff8c02ec92bfcbe9fe7dba49f5c30d18fb636c9e2f2ce7ecf7144f2a6097e4bbe5c4ecf7140fcdc0b0b734018bfde03a784af3c53504cfb15f47dc0ffb0bbb8160ecbffc002fa95e58edc1d8bf1a4dc1163d2f36c1a8575495609c5f1a4aa6f3a134febd83e2ed2f376093faafa3e72fcc01f1f50b3c217ddd5660ac37ad63f00cfe5407cf69beef5230ea35c6026c60bfe55532e55b39d8a4eb6f73b0d8df20ee6f637fe04a32cdff03b043fd757b904cf9d9168c7ae7ed2299ce7b3692697fc898d8c2f99ddb128cf3b317f49f85fa6348f75f1a06d9afb604c37ff817b04dfa1c0ec10ee9bb4ef22ecd015d7fdd8047345eb5079e907e598e60d2d7b40363ffe3762598e2d5750e16e703d692297ffc128cf35768af897afb36108cfaee5c32d56b0f9269fe2e24f3f61731d880ff5125d37ed80558ac974c25d37ec09d64de7fe64132f73fea27d8a2f15732c9b4bea008a6f655a23fb1dfb28c24d3fe470d8c7ae1ed5132e95b2099cf8fa6e82fd4e3c32fc9b4bee3125b38ef7723ff641816d99b7d03dbe48fc22bd8a1f9f95a825d9adf4af28706eb1ede5eaf060fe97aaf133ca1fc5605237e6d8ee009e5bbd5198cf58b4efc1efb6fb71730f67bae66e025c5df8a09c6fecae020998fafd248a6f3ba909fd93b6f4f71025bb0af52329ddf9849e6cf533fc036e993924ba6f96726993f2fcec00ef57ff12e99e2c34a32ed7f0cc1f017d5bb649aef7cc9bc3f22f13c97fa4fc3f859388f5a6d25f3f69443c1d86f3b06e37c4be54ae6edd354c9bc7dd791643aefdc4aa67acf2b18e7f134f13dced325a4ef26d3379affc95f9826e2cb952a99c6f7153ca57835fd0463ff691108267fb579028b78c2001b34dee14532bf7f62814df88b4832d52f2ab085f59d0118eba3752899ecff2699eae307c9b43fb405431f9454329d2fbb97ccdb938cc02ee95b2adaebd2f8b590dfc279e448974ce3f12998e67b4d30ce074713c934ff403e0be72d2dba9fc5e607defeca014fc85f5413f094e2313b954cfea0114cfe467901233fd41792a99e6a49a6f527c198afd71bc9549fb9822dea8fba944cf9502799dad782b17e6d7592c9be6782495fea42321fdff8c7f77cbcb477b043fa1deb9229ff4904e37cc697641a7f0decd27828aa647abfc45032ade7b982495f13b25fcbc2fb0c944032d9cb93606abf5949a6f314cf60bc4fc00a24f3f6b79960d29f5a914cf11dfa53d87bf82999d6df303e16ceb755a4cf369b3fc8ff7660ec3f57de04933ff0f760ac5f665bc114df2b67c1a44f57156c507f5f1cc9b49ff3198cfdc69bab60aac7ac4f601be7fd22c1781fc95132ddaf95ccdbabd492b93e794f60e883229e87fd9ef959326fbf3a964cf9e00318fe5d9d4be6fda192fed916ce83a92f92a93dbe64ca8fd11f229e4c6f92f9f3938164ca1f4f82b1fe994ae6df871f60acf79a6bc9bc7f62f49785f3b1b75230d95775914cf30bfacfc279b22df90f47c413a621995f9f7be011f99b6d2b98e2136d021e4f683d63059e4cb83e7ae2fa19dd4f3b83e734df943118f581f22099cba33c8397549f592dc026d69b8f9279fb6f9f60e453d6156c537f5a63c9644f8160aa47695330fc8dee0aa6e7c5b964f28791648a6fe692297e580aa6fa6628da8bf8c3bc974cf9642118fa38954cf58f89649acf1692e93c27e9936361ffbdd149e6df2b9e609c1f7d96ccf549ad24d37974e887d0676721998f8fba924cf1fa9364b247713df687754f92e9fc672399ea45a23d581f35af92f9f7b9f81eef13885ac1181f4b32d5dfa10f16f6a3044bc974dee9158cfd3f892399fcbb2d993fff26fa6786fd3ba23f711ef146d7bbcc7e283f7b944ce7995ec0639aafab25784af671db0a9e52feb200cfc9fe320f2cec650f5e52beae7d49a6f319e2fe4bd457766083f453bf80b11fa878154cf6b2adc1585f37c4fde0af235530f251717fc45b9e90d7c17ca848a67add5530ad1f74a160aa8f76e279c8e7c34630f97f3b174cf2379a645abf247fe35a781f90ff2818f3c1443297571d49a67cfd4930cd87da1b58e8ff5630ece74b32cd1fa564aaef7982697dc87900633f73694ae6faa0be4aa6fd789a648aa724637fd25a32ed3f79924ceb3d3330f6f325ad64de1fd98364927f2598facbd42553fd3594ccafcf311e16cecbdf22c95c5e652a99de7f267e8ff3c9e1bb641a6f4732bf3efb008bfd812f92297eb32473794b31bec87fa30a2ccea3ee0493ff30f79269bfe23718f53e6b2099ea0377609c7f34be2453fc7b914cf91c1f2f63c0e6478a0fb6e019d58be207c1538aff8fe039e503712b99e6eb5c3297a750c04b1afff22618fb1922c1347fc73bc9b47f4630f2f9eda360b2efab2e98fcd1ea158cfd83452598f47f6b48e6cf8feec1a8b7a40bc1f05f3bc9bcffb61918f596f85d32d5e3447fbaa48ff94030f6ffdc24737bf267c416f6a7ac3f2453fe580bc67e99122cceeb9c24533d6b2299f4ad108cfce30773fd500cc9341f7792a9fe6b0ba6f5da6b2399ce372ec1d85f1d9d25f3efd59b60f89f3bc9bc3fd4a364f22f6f60ec97543792797fa8a960d8c74d32f9932918f61ed49269ff832d99e44d24f3f61a23c1d43f96fc1ef1fe1c8cf763448e645a3f16cfc3fe3d632899e2955832cdafd01f0be7d5ad4a32ad9f3792b9fcc64030ced3d792b93e9723c9b41feb02c6fe67732b99f68b7c4aa6faa3180f9c17f6499ffa032dc46bf098ec5d8f24d3fe08133ca1f530ed049e527eb7f50593ffb83c48a6fd570a7846f7d36b30e6fff25b32d5ab73c1145f28ef82299ed1e660d473b64f92a9def92698fcdd5a3cdf46fd24914cfbcd74c9b43e21e445fda611f7437cb1fe124cf65edcc02edd3f7225d3fb001e05d3fc5ebd108b7879bb93ccfbc72f05937e66a9605abf538e92493f56e021d99f6249a6fa5b2b98fc9f72914cedc3785a789f52f12698e42943c964ef17c9e40fe792697e1849e6f2648e60ac470660bc9f243b4aa6fd3fa1647ebda20826f9d24c32ef0ff55e32d5d7447f60fe2f9f25933f5a4aa6f8e62c18f9502299f40ffa61e1fd4b4a2899f6279492495ed19e29e297028cf795048d64dedef05530e29137c9e47fe4efb19f740cc6fed152134ced0f55c9fcfb488c17dedf74b9934cf64dfa3c326754ffab0cc1643f510ac67a78ba04633e77466083ecb309c026cdffa921998f476582b19fa7ba0aa6f93e5e0ba6fca6188051bf4b447bb1bf4aff00237ff60f92e9fd41f792e9bc7d2599e6f717c1d8cf247e8f7a5d160ba6fecf23c1b4bf21a0f86264e13c72f82499f2fd57c1f06727c954bfcec098df755b30d9ef7a2e98ecdf78974cf54cb447d47b3d5330e2cb0fc9b4df47dc0ffbd12ea9647a9fec1e2cde07f92e99f60b1c05239e3e4ba6f9df974cf9d74932ed9ffff17b2e5f70014f90ef288261df8664b25f5332bd6f0ae36be1fc4ef92499f22d4b3297ff593c0fefb7525dc9e4df3c30de5fa53a9229feb12553bc2ec66f46f2565f92c97f37609ca7b4df25d37e825a32adff89fba39eaafb92293fea24f3ebb7627cb13ebbfd944cfbadbf2453fe37154cf287a664d257d15e715e80fa6fcce673f2af117846f94076075e503d2188c1d88f9a9b82c91f2457c954cf38832df2279ba9647adfe70a8cfaecf62098e2ef6e2699ce27ed04533cb2d5c0d8efaa3c09a6fa46f12199ec5d3c0feba51dcd9f63517f5dbd0886bd3f4be6d76f7f30d59b62c164afde5432d5271f2453bdf0118c7abd77124ced4f1ac914afae2553bd5edc0ff3b9f32498ec6d1308a6f66c55c9341fdd83313f9ba23da8ef46a564dabf664aa6fd21f27b8a37e291643abfe249a6f9ce174cfb13a2028cf78b25b9647a1fd4a364f20fdf92c97f0c25d37a512599d607a03f22bf375ac994ffa49229ff78944cf94a2618fe48fe1ef59e4632bd3f270163becf2ac994bf8beb71fe4b0d2453bd27964cf552d13fa807da2f9269ff612499e627d13ed40f424330b55f13d763bfc6ed4332c50f37c1f0f78a64daff3d964cfb43c578637daf7a138cfd39429f719e6745fa30314df21f590ec6fedd32134cfbb10c5d30f98bcb8b64da2f3c01dbd87fbc174cf5c92001e37c4d25eee760fff1b7605a0fc8b792e9fc81b8bf43f149740263ff68fe2a989eb722fb9c8878201849a6f75f9e25d3f37cc974fee15532bdaf752898ecdd0904d37a475080512faf7e30e9432e18e7f56e82914f5482c91e0bf13ce4ff7e2698c627fb924cebcfe2f7d8ff1b3e80719eaa934cfaee3992491e717ff80f6f2699f22ff13dcecfa753c9e4bf0e92293f394aa6fd139660b2cfc8904cf9df4230e68b4a32add78bf1c0feda740ec6fbebcab3648a8f2792c95fd492299e1848a67ccd164cf25b2d58f887ab64f2379d64de3fea4132bd6f4efc7e8e7827944cfb7f1e2553bd4f134cfa6c799269ffb6781eea8df14432b57f2718ebe591645a2f8b05231f15bfc77e0f652699e229f13cbc7faa9a4ba6f361427fb03f5013fa8cf5e2c495ccbfd73dc924af180fec0fd33e24737922f17c9c6f6cc91ea626f69b5e13f082fccfe64d32d547bfc0385f565ec0886fba1cecd07a663394ccfb237b05633d627b144cf6779949a6f75fd682c93f06349f4dc5fa433d154cfaace982697d721b4aa6f3c11918f585742299fce5bd64aa67958229be5ac560ac27ac12c178bfd79b64da0ff1e37b7adf95fc3dcef70592a95ebb174cfe3a10cf47fda01c08c67e1b5f32bdcfb0134cfde12a92493ed17f585fc81f25d378dc49a6f8e253308d57249e3f417c7a904cfbcd7e30c5d382b11e982592797f24df82b1de954ba67aa6907f4af69baec138af6c8d24533d692f99ea733bc1e4ff3c0b2cde37be944cfe712499f2b1b964b2675732c52bd0670bfb45d54832e58fba64da0fb301e3fd8d4a2499d67f857ee0fc72f82d99be5f81713e3e194aa6fd49e27e588fb89ec1884fae13c9d4ffa27fb0bff0229e67537fae481f66e612fb2d776083ec3debc026eaa53618f18a3b0323fe580f04d3f5c98b64da7f63825df217852e99ce77907c33113f6c4dc134df6f1f24d37c9982b17ee04f05537b9a77c9148f88dfa3deb07a92ccfb7f73168cf365778229be48bf25537d19f28bf501e55e309d4fc94f92c97fcec158cf2b12c1e41fbb4fc9b43e3d104cf3f7f6158cf87ebb170cffe448267942c1e47fba05187f1f455049a6f5614330f4ff0d8cf3b88ab83fde3770d94ba6fafc12bca0f6a557c1c80f6dc9644fb964aa7f1492a99eb1934cf3f718bc44fd632199f2ab67c914bfd782518f16e389f78346a23dd8bfa58c25d379ba4030c95b5f2453fc5c824deacfec2299f6eb6c25d37ae74630e2b94632ad170bf9b13fb87b964cf514713df61bd4aa643a9f0f7bb31cecbf10fa28f6e3f89269bd83e2adb9399f52bd33032fa6fcfef9086cd07e8d95f81eeb1b97a964b2bf0dd8a2f958ff02dbb41fbbbb825d9a3f2eb5608a3fe28560caafb6141fcd45fdb11a83b11e180f05d37e5c5f114cfe669d8051ef6f3dc1a40fab108cf3d9e55a30ce3b1a60d4d78bab649a5fe5f7645f978364dededbb360f247452899ea616730d6e7d6779269fdfb4330f9bbd4148cf8e7058cf5b8e44932bdffe25e30f6835c24d3f9d1b964b27f713decdd16ed9b937fd2f792a99ed2082679a247b0380f33964cf3ab18af05c52f57d1df381f5baf2453bcff0046fcacfe60daaf6a4aa6f9ed4b30ce7fce25d3fedd1918f65f8af1c37e6d4f954cf9cf5a32c927fa17fbede254326faf22aec77c1bd582a9fd971d58ecef3524d3fe5ea1bfd84f97d1f82ec47a83be124cf5c8ca07dba4efbab8de9df2dffba44f0b51afeb5cc1747d32154cf61eecc043ccf74f9269ffd3098cf7495c1e25d3f9c14a30ad9f281f92693de2001ee3bcf34430e94f71114cfe259883f17ef6b52599de2f36144cfaa23c4aa6fafd188cfa79d60a267de832c1345f1786649a3f7e30cd97a2bdc86ff55232c54fb9648a6fc4f367e44fbaa1649a5f669269ffb7f87e4ef6915f2453beaf4ba6f9443c1feb655a2c99e47b944cfb532493ff6bef25d3f86ec1e2bc532318ef1712fa82f3cdc55e32b5ff1b0c7b5acd25d3df9fa04ba67ac25e32bd0f44b4cfc0f95ad13f787f759c08c6fb8f34c9141f6e2453fee80b46fe22fac7c2fbafef24933f17fa8efdf9590dc6fb8d4a8a079626ceb3d513b04bfa5a527cb664f645eb65067848f359fd8369bfec063cc27ae45532d5e31f25f3f15c3d83315f5d12c9544f740553fe1e6592a93f3dc158bfb88127145ffb9560b2873a96cce5d75f25537ce90ba6fa62f283a95e2ae49bd2f82b0f82c93ef385645a6f17ed453d39984aa6fac04c32fdfd5607c1a42ff14a30cdb7b74232e5a76f60e483fe5132cdafb960c4fb5f60c4aba52218ebaf7b30d69fb6e27b9c1f0ceec1d82f962b92c95f1d24537da7148cf93d05239f534f92e9bc8bb81fcefb1547c9544fabc1383fe68af1c67e92f807d3fe43213ff6af7662fcb19fdaa37cc410f5ebfc5e30cd1f6b07ecd2f85a347e06332faa8f1cc0d0efdb17784cf6e91a82499ff44ff004eb318f92693fdebd649adf5f05937efa67c1347fe91618e7bb6e7782112faa60ac8736a1601a8fac00a31ee98c05e37d155bc1347ff8aa647a1fc009bca0f1f21682c99f9ae2fe0b6acf360763fd62bb168cfcb0148cf7790879f1be9ad4954cf53cd17fd8bfe49f24533db1164cfdbd7d07e33cd346fc1efb17b789643a4f300423bf303760bcdfec42f669b27885ee47f38169e1bc977e124cf18d3706e3fd11fa163c22fdda9482a7b43e7805c3ff058660ba9f2b9e87f364d14632d5fb4792e9ef37fe02e33cd926028bf364efe039c9b712f747fdd9ad24d3f58231fee58b601affdb9b648a6f7230dedfe12d25d3fa760a467d3817f218145fd99f9269bda1924cefdf93df23fe7e009b349f98623c2c1a5ffb2298ee97d8609c3f32e6609c3f8b2cc9646f0bc914cf3f4aa6786607c6fe958ee20f8bcdafb43f81e20b165e93fe5c3e25d37e30f13dea3ddd093cc27ede2d18f5983804e3fd1d9a25989ed7168269ff61fa089e223f9e8167d47f862699d6f39e25d3fe68152ce2b70318e7c9ec67c9f4fe12138cf70f252918f1932b9e67507caf08f9f1be9938069b648fc15e308dbf32108cf7df88e7637f627c150cff7a0163ff42f000c6f99c88ec9b4d37a867d1fc62b3f1a3fd3c743f5b8c5ff102463cb2da82117fb4df9269bde12498ec510f25d3fef01c8cfcb8b425d37eaa5232bd5f2506235ed85a9269bda4154ce31d89f6cef17ea8037841f76b447b17d84fb6012fa9fd6b211fea49978b608a4f0c156c423f3bc9b49f3602c31e6f7bc1d0bf4a32c50fe44f6c1bfb3be22918e7e93a6287d907adb70ec063eacfd51b784afdb3d1c0c85f8a5232cd97afe0398ddf652d99fcf75130e5879d09c67c961482c97eae7bb049f74b3ac9349e86649a4f2692b93cb978be8df749b88229be509660eca7f39f24d3f922713dd6afaedf8269bcd690c7c6f9d755001e52bc5b533ceb5a63d29fab2199ce63edc1139a9f82083c25f9f5068cf745dd2cf082c6238d25d3fb1d378229bf503ec178dfce6a0946fce9bd0aa6fe5ccf04e37d0af27aca77ac1bd8a2e747df9229fe2dc136f98ffc4530e9f34a934cf9f10fa6e78be739387f48fde9daa8f7273c3e310716f67b260f9269ffde1318efefb91e24537dcd06e3fd79f6156ca0deb1904cf6a080d1fe6a2199e67b5f303d4fbb801dd8fb0a8cf8f9a611db78ff5dac8211df745f60d413133e7e2c389be17ccc183c27ff97459279ffac4b30de27947e0826f94c4532bd7f5d032fa9fd6d2a784af58e21d8a0f9e1aa48a6f53f5b30d58ffd6730de5f94ad89ed01d9ef86eb2b0b2eb0feac6fc04b92af7525d3fbcd8f6093fccde64532d9cb4d30c57fe1128cfd33eb77c1a41feb028cf7355a1f82e9f9ee1cec62ffea9b60f227892918e785f0bd8dfdafe9b3601a4f270463fda81980f17ea59adbbf3966fd41ef472dc14bf2075b1b6c60fdec4132d50f0bc9944f1cc126c693dad7bf5e9ff2075c6f63bd6b45fd33b1e6549fb8adc0580fdc7682c97fdd5ab035a5f74309c67961e50bec523c1de2f736eaf7f11c3ca4feaba8bfa6d664467fffdc080c7f53b492a97e6f08a6f686776013fab4964cf69982717ed224ff30b5b15fe81608c6fbd3ce60c48b2d8dd78cdd8ff2eb5430c5839b5730f2dff60086be74a4af33d6ff148fdd8391ff6a74bf390b30693de808b6917f64c436ce8fdf1230f6bfb7345e0b6b3a27fbe9c0f319bdaf8bfcc782a5f7e43f0f60cc4705f99f256b3fedf71c826d92ef3625b627349f68dcdf9b2c9f9b927f237d3458ffd1fc5b8327f007241f530f1aaf6b00467cad51ffb2f8674efd41fed5b6711ed0e4fac192cf39b57733022fe97ecf977feda32abf7d8c9f3e26ffa7827fa74fcf0afb9da5daaac3fe58ff6a0be8f3df21cb2f72b9ecf3bb5c0afe9b90afff77f7df5116d62247f5d81ffad87ddba87590cbfd87bfb3f1f9779605f20899fa6be8cfffb79fff167b71e9f393743ffadc1663f4e33aa96fbdedf8eccf3f18b9ffff65e16dfbc90e6009240d1fa9bf2b3bc9439ee0df4d1661eb3f64f9313a3f24f3e4e717cbfa7791e5379fecfefa91d758f05a8e94457a8a7f2b590235542335561335553335570b364ea55aa917b5669f86e951ab76ec7365b2de544dd5d99f15ff9dc67eb1fe379365a3aed827652391a85bf6b963d2ecd43dfbec982c07464726dd91fdfb4e3da9f74cce7bf5817d0c76e53ff4daff5b6479e43dfdc446e699fddb597d515fb94ebda9efea87faa906ec9a9449f8c524f85607ea501da96375a24ed5993a67d2fc1bc9c25a7a5637ec9f91ba607f02d8fd92c9f2cafe6929aafaa4284cc7be15431d2ba662b18fad380af31a8aa7f8ff3d92fcf7cc954aa0844aa4c44aa2a44aa6e44ccf5ca63d2dfbf4b6622a059b45064aa954ca45a9954669954eb92a3745537465a5acffe8b5ff37cab251b6ca9db253cf8aa2ec95036bf1513929f7ca83f2a83c29cfca5979515e9537e55df9503e952ff6dfbf9581325446ca589928d37f23596c65a6cc9505d3b393b26413cd83f261288661b044c0b00dc7700dcff08dc0088dc8888dc4488dccc88dc2288dcab8a87746fddf23c99f9345b58ca6ff23a390df6677a3353ae36adc0ccdd08d95b13636c6d6b83376c69efd391847e364dcb3cf897d8e8c1fd8e7d178329e8db3f162bc1a6fc6bbf1c1b4b0cf02685e757f9b797f9aadfe999ff8af6561527c1a5feccfb7313086c6c818315fd4186363624c8d194b9916c6b2370ad3304dd3326de3683aa68b8fc73ebe19b04f684666c465eaa53a9a31936a6726666a66666e16666956e6c5accdc66ccdcebc9a375333757365aecdcd2f33b1f2eb1cfcd764311a736bde3169becd9db9e7b21ccc8379344fe6bdf9603e9a4fe6b379365fcc57f3cd7c373fcc4ff38b7dbecd8139c467648ed967c23e63736aceccb9b960992a3334e3de322cd3b22cdb722cd7f22cdf0aacd08aacd84aacd4caacdc2aac12b9dc2f91c5ffaa2c56655dac4b3f2e566d0cad5a3d5b8dd55a9d75b56e9666e9d6ca5a5b1bd6d3f7ccd96ead3bd6522689b5b3f61677bfd6019f2393666a9dac7beb817d1ead27ebd93ab351da592fd6abf566bd5b1fd6274b98bf5884b0601e3d61b3e9c0faeea3cf1fd1d1bfa2634cb31a8bfe82f001fff74a89aca135b2c6d6c49a5a336b6e2d7acdb196cc74fa4a9ed18f85b5b34d48f2439643bf4c614e6ddb766cd77ab03ddbb7033bb42326cfc178b4633bb1533bb37336abda766197ea935dd997de92fecce74fc932307756cdc6646055aa67d77663b776675fed9badd9ba71303fec95bdb6376c249ef9676fed9924625414662bcc5e602bf766681bf6d6beb377f6de3eb0cfde3eda27fb9e8debde7eb01fed27fbd93eb319d7b35fec57656fbfb1d1b07efffcafc9f27cb16a66274cb78cc6f8b4df992c1ff6a7fd657fdb037bc8faf3c47a7864bbe6dc1edb137b6a2db924bb7e64fab161ff9cb1f6ce85fd9b91bdb0972c485698ddcc1dc3311d662c8eed384cd2bde33a9ee33b8113b218f5dd89545df17fcdecfe155954d7183ab113333bb1edda499cd4c9ec2f27778a5e0ea7640ff0ed3d6b55653d3b17361acf4cc706cc6216dc6ed8ff3b356b6be3b44ca6b9d3998173756e8e66f7938feeac9cb5b3b1b7ecf78eb365d21c8d9d73e7ec9cbd73708ecec9b9771e7ec9107ecb7a7eb6a03f234b2f09f3c683fe7ecea3f3e43c3b67e7c58cadb33db1ced6b33d6656cc3ece2b6b5dc5dab5c0a7f765ec63cfe9e374f8bc39efbd24f6d20e9d0f66fd47e7d3f9ea7fe954ce379366dffff5f6cec8e9ff5acca933b3eb9fe4f8576599ab9db3b05f9c25fba1e21a6ce2b08c23f34accd3bab6ebb8aebd702a73e17ab66b1f5d9ff9a8931b981fccdacfaca5f76ec86c2ae673e6d18ddcd84d98bde0e3746e6a7acc73b02b594fbcd93336be67377373b7704bb7722f6e6d176e63356e6b358ae67656f3afe8987a70afaaeddeecd6d55cdd5db96b3626cfeec6dd9a43f7ceddb97b3622dbde86dd837bb4576e6031ed331df7e4debb0feea3fbe43e1b817b765fdc472195fbeabeb9efec5707f7c3f9703fdd2ff7db1db84377c474f1c0fe7dec4edca93b73e7eec25daabd2f6091b8a7aa81f70fbdda9f91c533d8f46d79b6e778ae937b9e71b2179eef055ec8e4601fdbf0222ff612e6030eb6d1eb8c977a99977b85577a9577f16aaff15aaff3aedecdd33cdd5b796b36e7c7c6c9db785befce7a70471ebb0b1b5d9dfd3ff36fde8e59cec1db7b07efe89dbc7bb5f01e58467af31ebcc71f5af5bb1ff853b23c79cfded97bf15ebd37a730637362dbde3bd32f2e099368cbe6f229b39ae7de76bd0fefd3fbf2bebd8137f446ded89b78536fe6cdbd85b76441d7a3aff8866ffa966ffb8e71f45ddfb31e7c9ff9e8ad6df8811ff663e547ee8069e4831ffb899ffa198bd6be51bffd523c9189fe75599e2f7eee177ee957fec5af0d6603e6d46f7a49fc967d3aff6acead27ffd6cf77bee6ebfeca5ffb1b7febdff93b7fef1ffca37f62f966a2bef8f78aea3ff88ffe93ffec9ffd17ffd57ff3df8da3bdf03ffc4fff8bf9f485bd30c74ee57ffb037fe88f8cbd3ff627fed49ff9737fa1382c27fd6679f70f597ea97dfc99d8d25f066aa004060b112da65f6aff97c0f7fae5b7811d38fe3570cd0fe31478811f04411844411c24411a64411e14411954c14509839a7d1afb3d68838ee59af3e06a3f07b7400bf460c5fc48ef0d9560ddeb99ad30d906f6c27a0e36ecaedbe02ed8057ba50e0e4a191c8353708f0af54f35ab3f2d8b1d3c048fc153f01c9ccdd829ad73f012bcf6da15bc05ef81137c049fccf38c83afe03b1804c360148c8309fb330d66c19c49b47016c1325443253442d3188416fbc39c71e8865ee88741188651c86cc73a8709f3cb4698f29881c50f61d6fbfc300f8bb00cabf012d661e32fd421d3b41fb2387f94e5e77af6cf63d25f1db661175ec39b19875aa8b3bbafac636f27e13a5c33795e8c7b2f0d37e136bc0b77e13e3c84c7f014de870fe163f8143e8767f52d7c095fc337ab08dfc38ff033fc62d2982c22f6d97ff90e07e1301c8563e3184ed82cb40dd6e1943d63e6ee99fd7c9b53f6dfe7e1225c466aa428456444e68fcacdaf5a46b288ff862c28f1d4c8525fd5d7c88e1c7f19b9e673e41987c8376751c02375a61351c8e2f7cf88e524511c25511a65c62dca8347ab65f369cafe3c4645f01895aa1255d125aaa3266a5910d345d7e8166966678ccc75d4467ab48ad6d126da4677c629da452c82f0039ef778d68ecdb40bf6bc7d74888ed129ba77d2e8217aecefcdabed866af4d1eeaff6f2932c068fb043b77516ca2e7a8a9ea373f4629ea357f6a437e6750d16a79ca37773c2e6e8aad7eae823fa8cbea2ef68a0ce153f1a2aea8f2a2c7f9e1b8da27134096d2b8ca6d1cc8aa379b48896b11a2b56111b319bac629b85166eccbc3d9f73962c7f93b29843e33ef6e3200ea3fb388ae3f081f554cadbcafc5a1f25fe2c0b7ff68f7131d4f8f9e22cd4f73889d3388bf3b888cbb86277bcb0f87111d7d6dedd5b4f7c2639b959dcc46ddcc557ff515dfdb4f662cb3bbaca5875e25bacc5ba3f8b57f13adec4dbf82edec57ba5890fea323ec6a7f83e7e881fe327e3143fb3d866c9bc7380b86e689de373fc120ce2d76011bfc5effd88736b3055a38fdeff992c0ad34726cb6b9cb8adba8a3f4c23fe649db7641ec6b09ee3da665ed3fc0c33f6dcaff83b1ec4c378a456eaca7e51ee94713c862c3c1eecff9dfdb7493c55f57816cfe345bc4c54e3c17e4894c448ccc44aecc449dcc44bfc24484263efde9b3e8bd8d887e7a42c3b65f3d6d17c4da2244e92244db2a84872b1baf07765b1c886f8155b36bbb2fe65914fa2b8499194e69b71f26fd69e8dc9d9b998dff6c13ad953e39054c925a99326d6d5f7beea9db4ccca52f40d55c1d97d95bb385332bb4abae49adc12cd38252ceb4956c93ad924dbe42eba26bb641f1c9243724cd82c657a8ec272014364d94c9b4b2f4dee9387e4d158264f09b34ab146d2e722ff4c96e499f5e198e50e2bf6efe7e4257935dfad3e3f3f276f56ff8afa7df26ece8dfb709c7c249fc957f29d0c143d192a8b64c4abe3bdc7b4fbac8dc9c264b2df93713231de9269324be6c63159d8c76469c6a99a2aa9919aa995daa9e3dfa76eeaa5bef1603a2cbfe1b2f45910cb54b769601cd3308dd2384dd294cbc2d76dfa7cc4180aaff6932c96b0fe3453466e6b97cc8e9d344f8bb4343fd22a4c98f75a5afdfe8687f4621becee75daa46ddaa5d7d451f4a04b6fa996ea91c9fd3f978549c3644957e93adda4dbf42eddb15fedd3837d4c8fe9c9d8a7f7e943fa18fae953642b7a344c9fd373fa92bed2c8902c2ca7db4681719fbea5efe947fa997ef5feb197a56f7f9f5bfd2acb8f91e17a78607dbb5412ff2139a7dfce9069eb673ae86da5f7c54ee5fa696f8f553a4ac7e9249da6b3a4b50b65c3f42c5177fe23ef31361a7d0edad724d379ba4897999a29c63163f971b4efb3e3ccecb3e2649559999d39ea57ea0475e6665ee66781e9fa81a3a06ab0eb675096e1c5599845599c25ce23b3172e8b6af5b9d52fb2889a9add3f99d14efd4a064ccf952c553eb2cc74cc2fe61b077dcecbf477613d982316e37efaeb2ccf8aaccc2a61e7e45b98b34db24b56678d5dc763f53b6bb32ebb662c62f343d6df6ff6c2fd66de9c652c99661ce3a74ccf56d93adb306bd3b36d76e74efa5999c53363a603cf76bfcd8445369691edb23d93e5901db313d31d85db7491ddff268bf28b2ca67a973d3032b24743c99eb82ccc37f67d642ebcc4661146f69c9db397ec357bcbde852c1855577d4bdaec23fb8c9e93419a655fd97736c8d8e866a36cec8eb24936355da7cc66d9bcf7ebacbf17d93257734509552b377233b7723b77d8377d3d6dc29edad74398b7cedddccbfdec900779a828ff4496be024a7dabf8bd36f63edacc23c330ee982cbd97efed70c024619219f7799c27fe364ff32c3c30597eac4172bf95e779919779a556f925aff3266f8d63dee5d75eb7dc613f1ef9cdfdeeb3e25cb316f153aee7ab7cad9eed32dfe4dbfcced67396c1b09879c8729a4bafd9feb7719f29f93e3fe4c73cc88e4c9b1392c52afe812cbd0f559209d332db2ed5263f1926f32baed05ca6678eed5877ecbfbce6f7fe5dfe104cf347a3fd690d92d97afe943f671725cecff94bfe9abfe5ef7dd4937ff49909af719cddaf6cca73628dcd8871fe997fe5dff9404d9cc833f3613ecac7f1579ff1997dbc4c51b4cfee30c9a7f92cc9988e1d59a699f47e377c0bdffe200bb75792259fab7b854d65ea77be302c63cfd2fb1dd5bc481673943bf9b2500b8545f5b3e8814547b6dcabc0575793b1fa919f0ba33059b7d9ac557d2cbfe8f312ebaeb7e4c2e96b1785cb62ad53e1157e111461112923d52ee22229d22233f67d5ec365611ac6aecdd98cb92f8aa22caa3c2459faf6b398f5f597f9e5375958c6b34f6fcc62be8b0b7be4ce74a97227646177ae8ba6688b2e288a6b714bf25f7684303d53fc645268855eac8ab5710835e7b597a5d8b06cabaf6a7ef4d5be60cd243916dbe2aed815fbe2a0d8c5317b284ec57df1503c16cc3efa1a279764614e0b268f7128cec54bf15abcfd248b1aaa7f57164fcab22bde59fe742a3ed894b5efa33c5420875c9645f1597c15dfc5a01806398ba2c90bffd8555114a3625c4c8a692f4931ebd72c989ea8c5bc8f467b5b6677e03163b12cd5ecbb544287c540d7d250c2d22cadd22e9dd2354ebc22c2ae36c7f6a1f498cdc6a55f06e1ae64290dd731f7efc822d654c40cf3adb665c472b053191b2ecbef852cfb5e16f3cb3a9749999659996749745f163f564a7824669465599597b22e9b5e92b2cd34661b565f3b6371dc985bb4e10ffaaca7ecca6b79b3be4acd0a4a9d8d67c4a45995eb72536e992cbabdeda326368e5bebbecf64cabb7257ee7b591425cd7a6d28b552fb45961fd13ef773ea8dcd103b75c56439183e1bebc81c5b7d3d2cb0674e63cfcb63792aefcb87f2b17c6271ce86e527a398c594ca9d5d97cfe5b97c295fcbb7f29d79d12eef32adafee9bb3bebec13f337b5f7eb079bc2c3fcbaff2bb1c985d392c47e5b89c94d3c42d67e5bc5c944be3c45c7d156a7c4c0f665f1939564a655466d06746a7e0d4ef2ab2aadf62fedefb3059d8b7663f36c8d834bbaa2c26cbbd19b2deec97483a264b6b06c6a1b22bc79bc5e3a00996e5c4dc562e538ba86236cfa29545e5574115329fca66bb3ea736471513d73a313946fd9a4515dbdb2aa9d22aabf2aaa84a2bacaaea52d55553b5556745c1b1ba062b362e5ba7a355b57ebda3aff254b74aabf42467b21c83a36ad9f51f641151a5cf6571d488e9e246bd315559556b264bc4662c268b193269f64c96a37bf65a6fae2e2387e9eb5bb5a9b6d55db5abf6cab53a54c7ea54f575e17be6c717d681c5d5233e26a3fe2ebd3d570f4c96c7eaa97af646d5b97ab1aaead5dc556fd57bf5517d565ff128afabef5e966ac07ac2e5f5cf678bddb11a56a36a9ce4ce23c6c5339adf627e4bca6270efba60d1ee539ac5a36a524db98e912c51af654c965335f33a8f656bca3c34ccae9a87af9eaac6ac3f17d5f2a26637f7f5a25cb81fb615f38349d17f26b406c3ee7570377d7e75312fd6c5be38e1cbc5bd78179f8d897f092e6134b8449798c9d2b91fccbadefb159cde673059946a7449823e47f6d9c7fea32ca859283c96225912f549bdbfa4ec9e593fc6fdfa9c6df523d4af3d18a774e75d2fb9925e8ad0c8eefbbcfd525eaacbe5525f9a4b6b9c2edde56a6fcdd1e5165f98bd93244764f10773e445d68e5da55df4cbeab2b6c2cbe6b2bddc5d7655a7b697fde57039ba2fbd2c173633b1d8cde27fd5d684fde2fef27079e4b2a0adfd5add3f95256071f24d29c2faf27479eeb585d61bfb95a07ecd81e9d8a377f35545b3df7975c88ca6feec72bebc5c5ecdc4383afae58daf136d8235f75dbd7e8db92c7c3d96f5f196c5dd5333bebc5f3e2e9f97afcb777cbcf06a13d388e16578195dc66c869ddb6c66cd466c967db5ee7adbbf4c2ed3cb8ccba2f0bcc2fe5d16392f4096545373b5cdcf97f9657159f6eb90bdcdb2d8b85fd50accc08d8c83a7298f8a1fb4c620fca8d55a49b6b5519bc98ac9f9565bb56def1cc38bfaf99ecd8d336ef74cc7b8341e9b3146e6dcdef82cdeac9ddaadbddaaf83484b46e9ad0eeba88eeb84e5ca9fcce3796c6e9db008f4c9dd32590e755a67756e325990875bfd0aeaeff9cbcfb2287eaa2b6e5dd4a5f25557c68149c0bc0fb3dfa8978569716cc69eee2b6aa9cc422bfc8caa9a4590ec7f0d6b5beb7eb84347cdaf2c63af9cd73063f67faa22f6ebdeaff7d27875c746f9cbfc626d5cd6d7fa566bb55eafea35d36ca77c8af27a536fcdd8b9b23cdceb6318d6239bdec2eabb7a57efcb3d932515759e3fe695d8112074cc55efd44370523ae5b13e184cb3597e7f6fdbbc12cfda581f599b4ff57dfde0b6a1556d13b77eac9fea67e3549feb17a65b8bfab59f159cd728b02d1691ceeb37bfb1b7fe376fd994b220ca89acbdfb5abfd71ff56738a8bfeaef7a500fcba01e992ed3c27db17077aec3f29881cb324b63578feb493de5b2507ef20f7264f6a797a59ffb13f6ff0d9bfda7f5ac9ed70b9657b2fc8bc52e5b7b592f9d779bcdc98dda288de13f5a35f3ca1f8dd958c64363db47f6d9374e3f438693be6ed3fbb2c665ff34a2d0def09a9af1cb1ae0d074eb5be3357e1334a1f3d4444ddc244dcafae291e54977eeaec9ac2dfb158b429bbc299ab2a9b8bdd09ca8f42b763fcb42732397c5e4b364aa8cd2cc99c77a7369eaa6316377c3eefb7039352d0b8359d6e186c6aee99a6b738badd0b48a466b74fbc18c9b557aecc7c57c6fd64cdfc76c2c3efa5cbdd9345bebdcdcb9dbbe8283d53fac9c9b5ebfb3a4d935fbe6604d9a63736aee9b0726c363f3d43c3799bbeb6be64c2fe3e6dcbc34afcd9b948559c51f65a1d95ecaa2f1959bb5faa138cd7bf3c1a22ac7ff609e89d973bfa6686f9b4fe3e0dbcd57f31dbae167ad3483669828d60b7bde283359ae356bc66c961b46611f41369366dacc9ab971b296eeb6e1e3815566167d9b9ed3354b63efad5bb5555aa3355bcbe8ebd581396efb15c45d9f2b87ba71689dd66dbdd6ef63181e7719aadfaf09ff365752a5cfa4bdc2fdfa937a8bc76de03dc65d1b1afd4afdb658703fbbed6dba8d8c531bb7499b865ef5de666d9e9fdaa22ddbcad8370fed85595585fce4beaddba66ddbaebd5e5876dfded8bcf3ddd70ee4eabfefed5aaddf1de36baddeaeda755bb35f6dda6df0dede056f5ec89eb7734a63d7eedb437b6c4f52163f38fd41161bd97abff39945bc2c951e313ddbe5b9a2b7f7ed43fbc8b4f7686ffa9d05b5d53ef55adf326fdf9edb97f6d518861f4e5c44ed5bb269df59ccb3cf3b7bc9645ef5f949fbd17eb65fed773b6887eda865b3068b697aed123b19f67e906bf6b69db0acf8d44edb593b6751cb397875ed76d12e3bb59fdbeace38754a67746667c571922779af472c8e39fe4116e75759d84c99a94967770e93e6dab99d67192cd770d89cb063be56ef7c7b5b9f7d3753baa00bbba8da767197746997b1b0b8e8ca7e6dc8db75157bfea5abbbc6df756dd775d7eed6699ddeadfaac8e723b5ec95b326b687b8fe2fb4e65dce75db7ee36eeaedb76776c02d875fbe6397aef0eddb13b75f7dd43f7f8ab2cbfc563b40fdae2fbb87b59fabdb76ef7d43de7cfddb97be95e6bc738b9ae7de8ff1a4166c38eb3eddeba77964f9cba8feeb3fbeabe9d85fad80dba6137eac6d19d195b0b33f6b56ed24dbb5937ef16ddf2aa5e95ab71358d9dfbca7763f9bd1ce6d00ffa99fd6ad97bc7bada4cbe73b7bb322bb18ee1cadd5d5deffdea3109dfaffe35b886d7280fa302b66ffe1d1d13eb0b72bf196a7fdcef5de36b52b2d65d53ebe19ab119ef6c9dddcf7eb5f79ab3ff5a5ccb6bc5e29897ebe55a5bfeb5b9b6d7ee7acd27d7db55bb321d5533b30bdf8da69c5c57d7f57573dde6937efe655aa8f4750ce623a2be06c6f7638dd87c74ecfd38d515ade7de5aaa8171bcde5d77d7bdda3847b5edab2c5993353c07367f9c07f8afd7f89ca7ebe17a8cd953afa7eb3d3dddbf998b6641d1eef5e1fa787dba3e5fcfd797eb6bad3069deaeefd78febe7f5ebfa5d75d74139bc0eafa3eb987d26d7e975769d7b6bd60b8bcccccceb92dba2f5f327f2dd7d73c7fc1c27ebcc52c3a79b7263f955348c4c36f3b9aa6dbf33591cbebef31764b99937eb66df1cd6379ecb66877edf8bad140b2fb9b139d0b8f7b51b0b346f8152ddc25b748bd5db2db9a5b7ec96df8a68d025e15755df4a7377ab6e97f0e3c626c65b5bac6e9db1ef772df0fd16d6af1f5eafb0d86cc4246aee7236b3dcaeb7db4d4bc6d133cb2d44fefb87ddf3ffb52ce6e34dbfad6eeb86c5860d1b0d663515f3f8ecff6d8fc5eecc9fe593dbe6b6bdddd5a5fa62d7cae2b65386b7fdeda0d4ea58dd869f55773bde4eb7fbcbddede1f6787bba3ddfce51623f180fb71733643e7af24759983454afa4fbbfdede54f7f67efb48068a226ac97f7d7d3f2a6e9fb7afdbf76dc02b565f2cb35c58776c86d89a73162f6d6e43e3741bddc6b7c96d9abab759eadce6f1241ef77bf56f8bc80a5fa2eab6d4d4a8d394a85202f5ac199aa9599aadb1b16e5acdedade4e78fbbef3396c82759cc58f3345f0bb4508bf242d1d20ce3f287d3597fc25e1eb5584bb454cbfad981dd7b617e7a119385f624cdedad96f733a75668a5566917ad564325615ed0b65fe289b25322add15aadd3aedacdf84c1dd573979aa6e9da4a5b6b1b7ba16da99af0ebc8b03f2a8bb1ad7667dada9db653bba0b9bddbef2c7f37642dcfa1f8f22fc8926a7beda01db59376af3db008efce9cfa1f2c3bda71eb6451633568f92e43ed517bd29eb5b3f6a2bd46b935d2de8c85f61e4fb40f36269f2c216e94246ccb2767e999da97f6ad0d3436a6edeeefd98bf5dcee2c35f2b59136d6260a8bd955d72eed525db37111f562ef2fcbf2a84db59936d716da52578d7da8318f79673d9993b86e6fecb363518056b6bac26c79a71bbad92a9dab5bc64db77527327457c97596ee844e7fe622ce597e32d4033dd4233dd6133dedc7e0d74f98f5b2447e2f95bbd7333dcfebb2d20bf6fbfe0c84266b797c86ff2b3a16157aa957fa45aff5466ff5aedf11c3f2de39af8f322fa45ffb798faffbfaa6ebbe66817ed3355dd757fa5adfe85bfdcef850bff59dbe77c6d5413fe847fda4dfeb0ffaa3fe14bd07aece722db28dde4ef86e0bf3e78fe9e8e764adbfe8af4aa36ead86cdca34abf4f6eff075c43fbd8724c9f537fdbdb8ea1ffaa7fea57febcc07588affed6ed3ca56a3f7beea637afd3a561f4733895c33d687fa888dd0589fe8537da6cff585be5ca92b6565accc95e5eddd3c7ded778d38d5ca5e39b6e1eec90f0b0ff68b2cae7170dc95bbf2567e3c535f56415f310a4e2cdeea57df6a5a7bfb73b2048fab701505b355bc4a56e92a5be5ed78555807166b6efa5ccb3afe248bc9b28265dee5ceed8565b4b755b9aa5697555dcd568d3e5ab5b1c7f7c23129dcddaaeb76abab395e752c5bbbe3f66e626ef955166f7533e3b261f9d270a5b1f178e335567efeafaf2afd9571311f57fa6ab55a6bb362b8daacb6abbbcbc76ad75767d2a05f79b0b67d0ecf64796372ec983c0adfc570cff7819ef85efea3d8cf6bdcbbdf76e87ff8cd6abf3aac8ead1d7cb84edffa7e9e679aa6b63b6627bfcae2af4eab7b9643ad570fcdfbea919fce727f3a052c4f69fca971795a3dafceab176db67ad5ebd5dbea7df5b1fa8cbff26ef595f615a31fbbddf98749f7c177bc0f9d57f6795b7daf06d17e35147b2cfbbdbccd9339ee7739b58bd5a8d72e173b9358e3acdf65b1ceab717d67ec5693d574355bcd51c3b7708ec1fdf3314c92af16abe55a5d2b6b439badcdb5b5b6d7ceda5d7bc69e45cffb1f7bdefb489eaffb32097a7b62b3105fc7e3fba9f9beea7e36627e6318266b7f1dacc3c0091cbecb91452c6431bd17f85d967e7473dbd8d7efeb681dab77e20c2d9745f9b16be9cff8b1f03198af933c5d5bc1789daeb375be2ed6e5ba5a5fd6b5b5b437741601fbf7fbd5b30fbe57a25f6bb15a16fc34ceba757416dfb3e83e9ce9d77ecd807df6ebceefd6cc62bc50c8d2eeb411f366bfd90bd7d26374b7beadb53573e4b2fee5fed5793f628aba5eaf37ebedfa6ebd5befd787f5717d5adfaf1fd68feba790c5fdd69eef5ac1b8b04fbf9ef76a7e704b3e584bbedb9f5950bffba8f7e2eb7e97fcb1df83b63eaf5f02d736cc28effa73246c8e1feb193f73d2e7373edfafe4b23c69bb7e5dbf35cafa7dfdc1e617c8f2f7f78ffdf38ff3283f69566595d196e7f5e7fa6bfdbd1eac87eb11d335bea38c568b980e4db0afbf8fa6c6acc7cffc04c6b2dfadd7cbe90f7a7bea77569a43967505d5e0a69a713e6171d79d36d1f3f5b8f776eb49bfa3b61f93cb389f38de7aba9eade7eabdd8d32b674be7afc8f2d3d9621ecf798f6a11dcaf179774bdcc5f36ea46d9181bb37faead164ebf368979c230a77db5439cb4602336661ab91436d3dc39174ba1fd0a2caa7f6511e4ae0f0b36569fdfacc6cce59f8ce3c6c9271b77e36dfc4d607da94f56f35b9bfed2b8fc7eb6381a2a9ee2da55972acd26dc449b78936cd24db6c9f9aa0bcb6eac27ffdbf68bbc782effdf76ae6549552488eee733a6f615fdba7dbb6356a899203e5a6db51f3b4444f0c14b1489987f9faa8202a4bd37b457331113b9d010943a661645669d93b6d9e37b5a6207f5ce54d90a7b630ee6244ed8f3c2d4532060d9afca32ad349d280e4d481246103617866ae8b10a11c3b2b36c86248e1fe983506f36cb7bd7f59cde1344592e9dd23decc91c0e90c0115250a0014d680104cf80a691efb672cf7c667bc1191af13a6a6c8d2ed758790ea8a041fba8a546ca6681e23a2c67047dffd9b4a1130fb9e20cbad0833e2ce34747a706bc2c0e85fef98baee722bfd4f4404187dc51957668dcd0c2d0b660004318c12b8c61025378f3347fb13bb0acbe5df0f8ab3a31cdd0e01d3ee0136ee036e9c2ddb1ed7437f7e95459c13d7169c0bcfd003fe0117eb2bb700a4ff08c94def1b9eef5e9337dca1557dfc052a8ea8aefae6ed98c216b9d45ef4ffa485524aebeeaa181333471eeaa5edbb7f71bff47100423b4421517519a70a1686ff7106f632dbe471b97ebe0a027b3a4874ec8a276354cdffc603e255ca59dee228325a4b8c2354b719e8d29bbca113774bcb961e319c8f15c1f6327bd3884873ca043ee1bdcda7dce35430f7d0c30740718e10e636fed2f7ddd7f0cc2861b3aa1161991827b3cecfa8d66ec6112bce2115354f693204dfadb96d559cd6ccab25f967cd21655d61b3627a2d61336b0892d72a03dc20e53978ef868d8fa229f5faee75a7fe935c07eb745b764495b08ec7d0311d5f514356ca3bffd70224ff774bfb3f1822818bb5ad8461d3bd8c5de6e837df6fe0507fb088787258ef015c7d68bd0fa1a7cc79ef3f0a8623d21573237714a0f6bb636061dba66de58d0211dac1b76bfe293ef6039b59ad281736c393795d713791dceebf80ee712f96e3009ddd07544a5d179e13613e6e4967d435ca3ec245389a0cad56bfd58aad7bf7aee9fc122ff178e852391e3f3ba9c7d9399eff23a234758aeb7d96b869def6fe7fb0f468e60216ac18678a2378b9890bd31a42ee18c42f1d27b720dcf09969c1fb0909d7904e76ec356026184f0baafc89d66956e3da5fecbf6f6f369d67545d6b5c5d924df135a7ec542cb5e26e49a7cbfc201afa191da8093df3604f79408ae9ab0ad576031ca9ca3caca1635c83935653d22cfb448ce3bcf6adc752c32e62a9eb9443352aa19aaaae7e288acea1ab4729f2cb50e052bf5d4871cf952b02732ae47d9db635ea9689b453c57bc2062244752ad5f5e84c592fcc3e1ee4c949995795bc152fdbea830d827ffc84c20e9088f91d2fb395e4b665b520152c3422492ebf27dce3a1163b10a2cc60916c11710bad85b6ed69a7320cdc09db863ceee0a1533e20c1ccef6c814cd995eb334f9fc9ecf4b7ebda988b5c23b67b1108e04dff03d63da7fc32f8b9a5f4caeec2fc7c9c7e6f5bc5e154b795ce2e596e3679fca7dd222b624e3bc58134fe3a1e0bbcd199677fcb81c4b3d6a7ea7d6aeb0fb7e71ceb9a3f5738b7cbeda2ba7de3ba79caf57e52fff15fb1fcbbfd3fefcfbaf3ffe0193cc32fd</data> - </image> -</images> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/pages/sidedecorationimpl.cpp b/util/install/win/pages/sidedecorationimpl.cpp deleted file mode 100644 index aa25825..0000000 --- a/util/install/win/pages/sidedecorationimpl.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "sidedecorationimpl.h" -#include <qlabel.h> -#include <qlayout.h> -#include <qgrid.h> -#include <qregexp.h> - -/* XPM */ -static char *check_data[] = { -/* width height num_colors chars_per_pixel */ -" 11 12 4 1", -/* colors */ -". c #939393", -"# c #dcdcdc", -"a c None", -"b c #191919", -/* pixels */ -"aaaaaaaaaa#", -"aaaaaaaaabb", -"aaaaaaaabba", -"aaaaaaabbaa", -"aaaaaabbaaa", -"a#aaabbaaaa", -"ab.a.b.aaaa", -"a#bbbbaaaaa", -"aabbbaaaaaa", -"aa#b.aaaaaa", -"aaa.aaaaaaa", -"aaaaaaaaaaa" -}; - -/* XPM */ -static char *arrow_data[] = { -/* width height num_colors chars_per_pixel */ -" 11 11 4 1", -/* colors */ -". c None", -"# c #b9b9b9", -"a c #8a8a8a", -"b c #0d0d0d", -/* pixels */ -"...##......", -"...ab#.....", -"...abb#....", -"...abbb#...", -"...abbbb#..", -"...abbbba..", -"...abbba...", -"...abba....", -"...aba.....", -"...aa......", -"..........." -}; - -/* XPM */ -static char *cross_data[] = { -/* width height num_colors chars_per_pixel */ -" 11 11 3 1", -/* colors */ -". c #cc0000", -"# c None", -"a c #fc3464", -/* pixels */ -"###########", -"###########", -"########a.#", -"##a####a.##", -"##a.###.###", -"###a...a###", -"####...####", -"####...a###", -"###.a##..##", -"##a.####aa#", -"##.########" -}; - - -SideDecorationImpl::SideDecorationImpl( QWidget* parent, const char* name, WindowFlags fl ) : - SideDecoration( parent, name, fl ), - checkPix( ( const char** ) check_data ), - arrowPix( ( const char** ) arrow_data ), - crossPix( ( const char** ) cross_data ), - activeBullet( -1 ) -{ - Q_ASSERT( layout() != 0 ); - if ( layout()->inherits("QBoxLayout") ) { - ((QBoxLayout*)layout())->setMargin( 0 ); - } - setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding) ); - if ( globalInformation.reconfig() ) { - versionLabel->setText( "Reconfigure Qt " + globalInformation.qtVersionStr() ); - } else { -#if defined(QSA) - QString versionStr = globalInformation.qsaVersionStr(); - versionStr.replace( QRegExp(" Evaluation"), "" ); - versionLabel->setText( versionLabel->text().replace( "Qt", "QSA" ) + " " + versionStr ); -#elif defined(EVAL) - QString versionStr = globalInformation.qtVersionStr(); - versionStr.replace( QRegExp(" Evaluation"), "" ); - versionLabel->setText( versionLabel->text() + " " + versionStr ); -#elif defined(NON_COMMERCIAL) - QString versionStr = globalInformation.qtVersionStr(); - versionStr.replace( QRegExp(" Non-Commercial"), "" ); - versionLabel->setText( versionLabel->text() + " " + versionStr ); -#elif defined(EDU) - QString versionStr = globalInformation.qtVersionStr(); - versionStr.replace( QRegExp(" Educational"), "" ); - versionLabel->setText( versionLabel->text() + " " + versionStr ); -#else - versionLabel->setText( versionLabel->text() + " " + globalInformation.qtVersionStr() ); -#endif - } -#if defined(EVAL) - editionLabel->setText( "Evaluation Version" ); -#elif defined(NON_COMMERCIAL) - editionLabel->setText( "Non-Commercial Edition" ); -#elif defined(EDU) - editionLabel->setText( "Educational Edition" ); -#else - editionLabel->setText( "" ); -#endif -} - -SideDecorationImpl::~SideDecorationImpl() -{ -} - -void SideDecorationImpl::wizardPages( const QPtrList<Page>& li ) -{ - QBoxLayout *lay = 0; - Q_ASSERT( layout() != 0 ); - if ( layout()->inherits("QBoxLayout") ) { - lay = (QBoxLayout*)layout(); - } else { - return; - } - QPtrList<Page> list = li; - Page *page; - QGrid *grid = new QGrid( 2, this ); - grid->setSpacing( 2 ); - for ( page=list.first(); page; page=list.next() ) { - QLabel *l = new QLabel( grid ); - l->setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed) ); - bullets.append( l ); - l = new QLabel( page->shortTitle(), grid ); - } - lay->insertWidget( -1, grid ); - lay->insertStretch( -1 ); -} - -void SideDecorationImpl::wizardPageShowed( int a ) -{ - if ( activeBullet>=0 && (uint)activeBullet<bullets.count() ) { - if ( a < activeBullet ) - bullets.at(activeBullet)->clear(); - else - bullets.at(activeBullet)->setPixmap( checkPix ); - } - bullets.at(a)->setPixmap( arrowPix ); - activeBullet = a; -} - -void SideDecorationImpl::wizardPageFailed( int a ) -{ - bullets.at(a)->setPixmap( crossPix ); -} diff --git a/util/install/win/pages/sidedecorationimpl.h b/util/install/win/pages/sidedecorationimpl.h deleted file mode 100644 index f39e204..0000000 --- a/util/install/win/pages/sidedecorationimpl.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SIDEDECORATIONIMPL_H -#define SIDEDECORATIONIMPL_H - -#include "sidedecoration.h" -#include "pages.h" -#include <qpixmap.h> -#include <qlabel.h> - -class SideDecorationImpl : public SideDecoration -{ - Q_OBJECT - -public: - SideDecorationImpl( QWidget* parent = 0, const char* name = 0, WindowFlags fl = 0 ); - ~SideDecorationImpl(); - -public slots: - void wizardPages( const QPtrList<Page>& ); - void wizardPageShowed( int ); - void wizardPageFailed( int ); - -private: - QPixmap checkPix; - QPixmap arrowPix; - QPixmap crossPix; - QPtrList<QLabel> bullets; - int activeBullet; -}; - -#endif // SIDEDECORATIONIMPL_H diff --git a/util/install/win/pages/winintropage.ui b/util/install/win/pages/winintropage.ui deleted file mode 100644 index ac2545b..0000000 --- a/util/install/win/pages/winintropage.ui +++ /dev/null @@ -1,39 +0,0 @@ -<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> -<class>WinIntroPage</class> -<widget class="QWidget"> - <property name="name"> - <cstring>WinIntroPage</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>387</width> - <height>228</height> - </rect> - </property> - <property name="caption"> - <string>Form1</string> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QTextBrowser"> - <property name="name"> - <cstring>textBrowser</cstring> - </property> - <property name="text"> - <string><p>It is strongly recommended that you exit all Windows programs before running this install program.</p><p>Click <tt>Cancel</tt> to quit install and then close any programs you have running.</p><p>Click <tt>Next</tt> to continue with the setup program.</p></string> - </property> - </widget> - </hbox> -</widget> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/qt.arq b/util/install/win/qt.arq deleted file mode 100644 index f3f1ccc..0000000 --- a/util/install/win/qt.arq +++ /dev/null @@ -1,3 +0,0 @@ -This is just a dummy file. Use the package program to add the real qt.arq -file to the package. -This file must be smaller than 500 bytes. diff --git a/util/install/win/resource.cpp b/util/install/win/resource.cpp deleted file mode 100644 index 4ea0ad8..0000000 --- a/util/install/win/resource.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "resource.h" -#include <qfile.h> -#include <qfileinfo.h> -#include <qapplication.h> - -#ifdef Q_OS_WIN32 -#include <windows.h> -#endif - -/* - Tries to load the binary resource \a resourceName. If the resource is - smaller than \a minimumSize, the resource is not loaded and isValid() - returns false. isValid() returns also false when the loading failed. - */ -ResourceLoader::ResourceLoader( char *resourceName, int minimumSize ) -{ -#if defined(Q_OS_WIN32) - valid = true; - - HMODULE hmodule = GetModuleHandle( 0 ); - // we don't need wide character versions - HRSRC resource = FindResourceA( hmodule, resourceName, MAKEINTRESOURCEA( 10 ) ); - HGLOBAL hglobal = LoadResource( hmodule, resource ); - arSize = SizeofResource( hmodule, resource ); - if ( arSize == 0 ) { - valid = false; - return; - } - if ( arSize < minimumSize ) { - valid = false; - return; - } - arData = (char*)LockResource( hglobal ); - if ( arData == 0 ) { - valid = false; - return; - } - ba.setRawData( arData, arSize ); -#elif defined(Q_OS_MAC) - valid = false; - arSize = 0; - arData = 0; - QFile f; - QString appDir = qApp->argv()[0]; - int truncpos = appDir.findRev( "/Contents/MacOS/" ); - if (truncpos != -1) - appDir.truncate( truncpos ); - QString path = appDir + "/Contents/Qt/"; - path += resourceName; - f.setName( path ); - if (!f.open( IO_ReadOnly )) - return; - QFileInfo fi(f); - arSize = fi.size(); - arData = new char[arSize]; - if (f.readBlock( arData, arSize ) != arSize) - { - delete[] arData; - return; - } - ba.setRawData( arData, arSize ); - valid = true; - return; -#endif -} - -ResourceLoader::~ResourceLoader() -{ - if ( isValid() ) - ba.resetRawData( arData, arSize ); -#if defined(Q_OS_MAC) - delete[] arData; -#endif -} - -bool ResourceLoader::isValid() const -{ - return valid; -} - -QByteArray ResourceLoader::data() -{ - return ba; -} - - -#if defined(Q_OS_WIN32) -ResourceSaver::ResourceSaver( const QString& appName ) - : applicationName(appName) -{ -} - -ResourceSaver::~ResourceSaver() -{ -} - -bool ResourceSaver::setData( char *resourceName, const QByteArray &data, QString *errorMessage ) -{ - // we don't need wide character versions - HANDLE hExe = BeginUpdateResourceA( applicationName.latin1(), false ); - if ( hExe == 0 ) { - if ( errorMessage ) - *errorMessage = QString("Could not load the executable %1.").arg(applicationName); - return false; - } - if ( !UpdateResourceA(hExe,(char*)RT_RCDATA,resourceName,0,data.data(),data.count()) ) { - EndUpdateResource( hExe, true ); - if ( errorMessage ) - *errorMessage = QString("Could not update the executable %1.").arg(applicationName); - return false; - } - if ( !EndUpdateResource(hExe,false) ) { - if ( errorMessage ) - *errorMessage = QString("Could not update the executable %1.").arg(applicationName); - return false; - } - - if ( errorMessage ) - *errorMessage = QString("Updated the executable %1.").arg(applicationName); - return true; -} -#endif diff --git a/util/install/win/setupwizardimpl.cpp b/util/install/win/setupwizardimpl.cpp deleted file mode 100644 index 909d986..0000000 --- a/util/install/win/setupwizardimpl.cpp +++ /dev/null @@ -1,2571 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "setupwizardimpl.h" -#include "environment.h" -#include <qfiledialog.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qprogressbar.h> -#include <qtextview.h> -#include <qmultilineedit.h> -#include <qbuttongroup.h> -#include <qsettings.h> -#include <qlistview.h> -#include <qlistbox.h> -#include <qapplication.h> -#include <qcheckbox.h> -#include <qtextstream.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qcombobox.h> -#include <qmessagebox.h> -#include <qregexp.h> -#include <qtabwidget.h> -#include <qarchive.h> -#include <qvalidator.h> -#include <qdatetime.h> -#include <qlayout.h> - -#include <keyinfo.h> -#if defined(Q_OS_WIN32) - -#include <process.h> -#endif - -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) -#include <check-and-patch.h> -#endif - -#if defined(EVAL) -# define LICENSE_DEST "LICENSE.EVAL" -#elif defined(EDU) -# define LICENSE_DEST "LICENSE.EDU" -#elif defined(NON_COMMERCIAL) -# define LICENSE_DEST "LICENSE.NON_COMMERCIAL" -#else -# define LICENSE_DEST "LICENSE" -#endif - -#include "resource.h" -#include "pages/sidedecorationimpl.h" - -#define FILESTOCOPY 4582 - -static const char* const logo_data[] = { -"32 32 238 2", -"Qt c None", -"#u c #000000", -".# c #020204", -"a. c #102322", -"af c #282500", -"as c #292e26", -"a8 c #2c686a", -"ae c #307072", -"#C c #322a0c", -"#s c #36320c", -"am c #3b3d3f", -"#3 c #3c8082", -"#f c #3e3a0c", -"## c #423e0c", -"#9 c #434341", -"ad c #438888", -"aU c #458d8e", -"#g c #46420c", -"aM c #46494a", -"ay c #474948", -"#D c #4a4328", -".W c #4a4611", -"az c #4a4641", -"a1 c #4a4a49", -"aH c #4b9e9e", -"au c #4d9a9f", -"aS c #4e9a9a", -"an c #4f4e4a", -".X c #504e0c", -"a7 c #51a4a9", -"#0 c #525250", -"aT c #55a6a3", -".Y c #56520c", -"#a c #5a5604", -".Z c #5e5a0c", -".V c #5e5e5c", -"a0 c #5e5e60", -"a6 c #5ea0a6", -".J c #625e0c", -"bB c #64aaa9", -"#m c #665e2c", -"aL c #686867", -"bw c #68acb2", -"bo c #696928", -"ba c #696967", -"aE c #69aeb2", -"#z c #6a5614", -".K c #6a660c", -"aZ c #6a6a65", -"bG c #6db4b4", -".9 c #6e5e24", -"#. c #6e6a5c", -"bv c #6fb6b9", -"bC c #706d28", -"br c #70bcc5", -"aQ c #71b7ba", -".I c #726234", -".L c #726e0c", -".0 c #72720c", -"#w c #746d44", -"be c #747028", -"bH c #747428", -".M c #76720a", -"aR c #78c1c2", -"#Z c #797977", -"a2 c #7a5d3d", -"#H c #7a6614", -"#I c #7a760a", -"#l c #7a7634", -".1 c #7a7a0c", -"#e c #7a7a5c", -"bL c #7bc0c2", -"b. c #7c7d82", -"#d c #7e6e34", -".N c #7e7a0a", -"bP c #816c20", -".8 c #82763c", -"#h c #827a3c", -".x c #827e0c", -"#t c #827f4b", -".O c #828204", -"#v c #828384", -".P c #868604", -"bq c #87d4d9", -"#k c #89864b", -"#c c #8a8244", -".y c #8a8604", -"#j c #8d8652", -"al c #8d8d8a", -"#b c #8e8644", -".z c #8e8e04", -"aW c #8f9094", -"#i c #908952", -"#Q c #909021", -"ag c #90d0d2", -"bO c #916f34", -"bQ c #91cdd3", -".7 c #928a44", -"#p c #928e6c", -"#P c #947f2f", -".A c #949204", -"bh c #949495", -".6 c #968e4c", -"aC c #999721", -".w c #9a8a44", -"#M c #9a9a99", -"ap c #9b9b21", -".5 c #9c924c", -"#R c #9c9a04", -"#7 c #9d9d9b", -"ao c #9e7641", -".4 c #9e964c", -"#J c #9e9b21", -".B c #9e9e04", -"ac c #9e9e9d", -"#S c #a09e21", -"ax c #a0a0a3", -"aK c #a1a1a2", -"aX c #a1a1a4", -".r c #a2a204", -"#1 c #a2a221", -"aF c #a2e1dd", -".3 c #a49a54", -".2 c #a69e54", -"bR c #a78446", -"#6 c #a9a9a8", -".T c #aaa254", -".s c #aaaa04", -"#W c #abaaa6", -"aN c #ac8861", -".S c #aea25c", -".R c #aea65c", -".t c #aeae04", -"#L c #b0b0b0", -"#o c #b2ae94", -".u c #b2b204", -"aI c #b2b2b4", -"b# c #b3b3b2", -"#X c #b4b4b6", -"#V c #b5b4b4", -".Q c #b6aa5c", -".n c #b6b604", -"aY c #b6b6b7", -"bN c #b79658", -"ah c #b7e5e3", -"aG c #b7ebe9", -"ar c #b9d9dc", -"#8 c #bcbcbe", -"ab c #bdbdbe", -".m c #beae5c", -".F c #beb264", -"aq c #bef6f6", -"aB c #c1a470", -"#F c #c1c1c3", -".E c #c2b664", -"at c #c2e9eb", -"bI c #c39c6a", -"bs c #c3a366", -"#U c #c3c3c0", -"aw c #c3c3c1", -"#G c #c3c3c7", -"aD c #c3f1f2", -"a# c #c6c6c3", -"#2 c #c7edf3", -".D c #c8ba6c", -"bM c #c9a470", -"#N c #c9c9c4", -".C c #cabe6c", -"ak c #cacaca", -"bx c #cbb076", -"aa c #cbcbc9", -"a3 c #ccac7f", -".H c #ceba54", -"#E c #ceced0", -"bi c #cfaf7e", -"#Y c #cfcfcb", -"bK c #d1ac80", -"#5 c #d1d1cf", -"bu c #d2ae83", -"bm c #d3b180", -"bD c #d3b384", -"bF c #d4b589", -"aJ c #d4d4d3", -".j c #d6c664", -".v c #d6c674", -"#K c #d6d6d5", -"bJ c #d7b588", -"bd c #d8b289", -"bz c #d8b78d", -".q c #d8ca74", -"aj c #d8d8d9", -"bb c #dabd97", -"a5 c #dcba91", -"bE c #dcc097", -"aA c #ddc292", -"aP c #dec491", -".p c #dece75", -"bk c #dfc79c", -"av c #e0e0e0", -"#A c #e2dabc", -"#O c #e2e2e4", -"aO c #e3c898", -"by c #e4c7a1", -".l c #e6da84", -"a4 c #e7c7a2", -"bt c #eacaa5", -".o c #eede84", -".G c #eee284", -".i c #eee294", -"bn c #efd7b4", -".k c #f2e69c", -".e c #f2eaa4", -"bc c #f3d8b8", -"bj c #f5e2c8", -"#r c #f6eea4", -".f c #f6eeb8", -".g c #f6f2cc", -".c c #faf6d4", -".d c #fafae4", -".U c #feee95", -"bA c #fef26c", -"#q c #fef2ac", -"#x c #fef2b8", -"bp c #fef684", -"bl c #fef690", -"bg c #fef69c", -"bf c #fef6a4", -".a c #fef6b4", -"#B c #fef6c4", -"#y c #fef6ce", -"a9 c #fefaac", -"aV c #fefab7", -"ai c #fefac4", -"#4 c #fefad1", -"#n c #fefadf", -".h c #fefaec", -"#T c #fefee6", -".b c #fefefa", -"QtQtQtQtQtQtQtQtQtQtQtQt.#QtQtQtQtQtQt.#QtQtQtQtQtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQtQtQt.#.#.a.#QtQtQtQt.#.b.#.#QtQtQtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt.#.#.a.a.a.a.#QtQt.#.c.d.b.b.#.#QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQt.#.#.e.e.e.e.e.e.e.#.#.f.f.g.g.c.h.b.#.#QtQtQtQtQtQt", -"QtQtQtQt.#.#.i.i.i.i.i.i.i.i.j.j.b.b.k.e.f.f.g.g.c.d.#.#QtQtQtQt", -"QtQt.#.#.l.l.l.l.l.l.l.l.m.m.n.n.o.o.b.b.k.k.e.f.f.g.g.c.#.#QtQt", -"Qt.#.p.p.q.p.p.p.p.p.m.m.r.s.t.u.p.q.v.v.b.b.i.i.k.e.f.f.g.g.#Qt", -"QtQt.#.j.j.j.j.j.w.w.x.y.z.A.B.r.C.C.D.E.E.F.b.b.o.G.k.k.e.#QtQt", -"QtQtQt.#.H.H.I.I.J.K.L.M.N.O.P.z.Q.Q.Q.R.R.R.S.T.b.b.G.G.#QtQtQt", -"Qt.#.#.U.V.W.W.W.X.Y.Z.J.K.L.0.1.2.3.3.4.5.5.6.6.7.8.9#..b.#.#Qt", -"QtQtQt.#.U.U.U.W.W##.W.X.Y#a.J.K.7.7#b#b#b#c#c#d#d.h.h.b.#QtQtQt", -"QtQtQtQt.##e.U.U.U.W.W#f#g.W.X.Y#h#i#j#k#l#m#m#n#n.h#g.#QtQtQtQt", -"QtQtQtQt.##o#p#e#q#q#r#f#f#s#f#g#t#u#v#u#w#x#y#y#g#g#z.#QtQtQtQt", -"QtQtQtQt.#.b#A#o#p#e#B#B#B#C#C#D#u#E#F#G#u#y#g#g#H#I#J#uQtQtQtQt", -"QtQtQtQt.#.b.h.b#A#o#p#e.d.d.d#u#K#L#M#N#O#u#P#Q#R#S#u#u#uQtQtQt", -"QtQtQtQt.#.b#T.h#T#n#A#o#p#e#u#U#V#W#X#Y#Z#0#u#1#S#u#2#3#uQtQtQt", -"QtQtQtQt.##T.h#T#n#T#n#4#A#u#5#6#7#6#8#Z#0#9#u#S#u#2#3a.Qt#u#uQt", -"QtQtQtQt.##T#n#T#4#4#4#4#u#Oa#aaabac#Z#9#9#u#S#u#2adaeaf#uagah#u", -"QtQtQtQt.##n#n#4#4#4ai#u#Oajak#Yalamanao#u#Sap#uaqar#3asagatau#u", -"QtQtQtQt.##T#4#4#4ai#uav#O#OawaxayazaAaB#uapaC#uaDaEaFaGataH#uQt", -"QtQtQtQt.##4#4aiaiai#uaIaJ#OaKaLaMaNaOaPao#u#uaDaQaRaSaTaU#uQtQt", -"QtQtQtQt.##4aiaV.aaV#uaWaXaYaZa0a1a2a3a4a5ao#ua6a7a8#u#u#uQtQtQt", -"QtQtQtQt.#aiaiaiaV.aa9#ub.b#baa0#u#1#ubbbcbdao#ua8#ube.#.#.#.#Qt", -"QtQtQtQt.#aV.aaVaVbfbfbg#ubhba#u#1.AaC#ubibjbkao#ube#a.#.#.#.#.#", -"QtQtQtQt.#.aa9.abfa9bgbgbg#u#ubl.AaC#uaD#ubmbna5ao#ubo.#.#.#.#Qt", -"QtQtQtQt.#.aa9a9bgbgblblblblbpbpaC#uaDbqbr#ubsbtbuao#u.#.#QtQtQt", -"QtQtQtQtQt.#.#bgbgbgblblbpbpbpbp#uatbvbwa8#u#ubxbybzao#uQtQtQtQt", -"QtQtQtQtQtQtQt.#.#blblbpbpbAbp#uaDbBbwa8#ubebC#ubDbEbFao#uQtQtQt", -"QtQtQtQtQtQtQtQtQt.#.#bAbpbA#uaDbGbwa8#ubH.#.#Qt#ubIbJbKao#uQtQt", -"QtQtQtQtQtQtQtQtQtQtQt.#.##uaDbLbwa8#u.#.#QtQtQtQt#ubMbNbObP#uQt", -"QtQtQtQtQtQtQtQtQtQtQtQtQt#ubQbwa8#u.#QtQtQtQtQtQtQt#ubRbO#uQtQt", -"QtQtQtQtQtQtQtQtQtQtQtQtQtQt#u#u#uQtQtQtQtQtQtQtQtQtQt#u#uQtQtQt"}; - -static bool findFileInPaths( const QString &fileName, const QStringList &paths ) -{ - QDir d; - for( QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it ) { - // Remove any leading or trailing ", this is commonly used in the environment - // variables - QString path = (*it); - if ( path.startsWith( "\"" ) ) - path = path.right( path.length() - 1 ); - if ( path.endsWith( "\"" ) ) - path = path.left( path.length() - 1 ); - if( d.exists( path + QDir::separator() + fileName ) ) - return true; - } - return false; -} - -bool findFile( const QString &fileName ) -{ - QString file = fileName.lower(); - QStringList paths; -#if defined(Q_OS_WIN32) - QRegExp split( "[;,]" ); -#else - QRegExp split( "[:]" ); -#endif - if ( file.endsWith( ".h" ) ) { - if ( globalInformation.sysId() == GlobalInformation::Borland ) - return true; - paths = QStringList::split( split, QEnvironment::getEnv( "INCLUDE" ) ); - } else if ( file.endsWith( ".lib" ) ) { - if ( globalInformation.sysId() == GlobalInformation::Borland ) - return true; - paths = QStringList::split( split, QEnvironment::getEnv( "LIB" ) ); - } else { - paths = QStringList::split( split, QEnvironment::getEnv( "PATH" ) ); - } - return findFileInPaths( file, paths ); -} - -static bool createDir( const QString& fullPath ) -{ - QStringList hierarchy = QStringList::split( QDir::separator(), fullPath ); - QString pathComponent, tmpPath; - QDir dirTmp; - bool success = true; - - for( QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it ) { - pathComponent = *it + QDir::separator(); - tmpPath += pathComponent; -#if defined(Q_OS_WIN32) - success = dirTmp.mkdir( tmpPath ); -#else - success = dirTmp.mkdir( QDir::separator() + tmpPath ); -#endif - } - return success; -} - -SetupWizardImpl::SetupWizardImpl( QWidget* parent, const char* name, bool modal, WindowFlags flag ) : - QWizard( parent, name, modal, flag ), - tmpPath( QEnvironment::getTempPath() ), - fixedPath(false), - filesCopied( false ), - filesToCompile( 0 ), - filesCompiled( 0 ), - licensePage( 0 ), - licenseAgreementPage( 0 ), - licenseAgreementPageQsa( 0 ), - optionsPage( 0 ), - optionsPageQsa( 0 ), - foldersPage( 0 ), - configPage( 0 ), - progressPage( 0 ), - buildPage( 0 ), - finishPage( 0 ) -{ - // initialize - if ( !name ) - setName( "SetupWizard" ); - resize( 600, 390 ); -#if defined(QSA) - setCaption( trUtf8( "QSA Installation Wizard" ) ); -#else - setCaption( trUtf8( "Qt Installation Wizard" ) ); -#endif - QPixmap logo( ( const char** ) logo_data ); - setIcon( logo ); -#if defined(QSA) - setIconText( trUtf8( "QSA Installation Wizard" ) ); -#else - setIconText( trUtf8( "Qt Installation Wizard" ) ); -#endif - QFont f( font() ); - f.setFamily( "Arial" ); - f.setPointSize( 12 ); - f.setBold( true ); - setTitleFont( f ); - - totalFiles = 0; - - // try to read the archive header information and use them instead of - // QT_VERSION_STR if possible - QArchiveHeader *archiveHeader = 0; - ResourceLoader rcLoader( "QT_ARQ", 500 ); - if ( rcLoader.isValid() ) { - // First, try to find qt.arq as a binary resource to the file. - QArchive ar; - QDataStream ds( rcLoader.data(), IO_ReadOnly ); - archiveHeader = ar.readArchiveHeader( &ds ); - } else { - // If the resource could not be loaded or is smaller than 500 - // bytes, we have the dummy qt.arq: try to find and install - // from qt.arq in the current directory instead. - QArchive ar; - QString archiveName = "qt.arq"; -# if defined(Q_OS_MAC) - QString appDir = qApp->argv()[0]; - int truncpos = appDir.findRev( "/Contents/MacOS/" ); - if (truncpos != -1) - appDir.truncate( truncpos ); - archiveName = appDir + "/Contents/Qt/qtmac.arq"; -# endif - ar.setPath( archiveName ); - if( ar.open( IO_ReadOnly ) ) { - archiveHeader = ar.readArchiveHeader(); - } - } - -#if defined(QSA) - ResourceLoader rcLoaderQsa( "QSA_ARQ", 500 ); - if ( rcLoaderQsa.isValid() ) { - // First, try to find qt.arq as a binary resource to the file. - QArchive ar; - QDataStream ds( rcLoaderQsa.data(), IO_ReadOnly ); - QArchiveHeader *archiveHeaderQsa = ar.readArchiveHeader( &ds ); - if ( archiveHeaderQsa ) { - QString qsa_version_str = archiveHeaderQsa->description(); - if ( !qsa_version_str.isEmpty() ) - globalInformation.setQsaVersionStr( qsa_version_str ); - delete archiveHeaderQsa; - } - } -#endif - -#if defined(Q_OS_WIN32) - // First check for MSVC 6.0 - QString regValue = QEnvironment::getRegistryString( "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++", "ProductDir", QEnvironment::LocalMachine ); - if (!regValue.isEmpty()) - globalInformation.setSysId(GlobalInformation::MSVC); - - // MSVC.NET 7.0 & 7.1 takes presedence over 6.0 - regValue = QEnvironment::getRegistryString( "Software\\Microsoft\\VisualStudio\\7.0", "InstallDir", QEnvironment::LocalMachine ); - if (regValue.isEmpty()) - regValue = QEnvironment::getRegistryString( "Software\\Microsoft\\VisualStudio\\7.1", "InstallDir", QEnvironment::LocalMachine ); - if (!regValue.isEmpty()) - globalInformation.setSysId(GlobalInformation::MSVCNET); - - while (globalInformation.sysId() == GlobalInformation::Other) { - globalInformation.setSysId(GlobalInformation::Borland); - if (findFile(globalInformation.text(GlobalInformation::MakeTool))) - break; - globalInformation.setSysId(GlobalInformation::MSVCNET); - if (findFile(globalInformation.text(GlobalInformation::MakeTool))) - break; - globalInformation.setSysId(GlobalInformation::MinGW); - if (findFile(globalInformation.text(GlobalInformation::MakeTool))) - break; - globalInformation.setSysId(GlobalInformation::Watcom); - if (findFile(globalInformation.text(GlobalInformation::MakeTool))) - break; - } -#endif - - if ( archiveHeader ) { - QString qt_version_str = archiveHeader->description(); - if ( !qt_version_str.isEmpty() ) - globalInformation.setQtVersionStr( qt_version_str ); - -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - if ( archiveHeader->findExtraData( "compiler" ) == "borland" ) - globalInformation.setSysId(GlobalInformation::Borland); -#endif - delete archiveHeader; - } - - initPages(); - initConnections(); - - if (optionsPage) { -#if defined(QSA) - optionsPage->installPath->setText( - QString( "C:\\Qt_QSA\\Qt" ) + - QString( globalInformation.qtVersionStr() ).replace( QRegExp("\\s"), "" ).replace( QRegExp("-"), "" ) - ); -#endif - } - if ( optionsPageQsa ) { -#if defined(QSA) - optionsPageQsa->installPath->setText( - QString( "C:\\Qt_QSA\\QSA" ) + - QString( globalInformation.qsaVersionStr() ).replace( QRegExp("\\s"), "" ).replace( QRegExp("-"), "" ) - ); -#endif - } - readLicense( QDir::homeDirPath() + "/.qt-license" ); -} - -static bool copyFile( const QString& src, const QString& dest ) -{ -#ifdef Q_WS_WIN - QT_WA( { - return CopyFileW( (const wchar_t*)src.ucs2(), (const wchar_t*)dest.ucs2(), false ); - }, { - return CopyFileA( src.local8Bit(), dest.local8Bit(), false ); - } ); -#else - int len; - const int buflen = 4096; - char buf[buflen]; - QFileInfo info( src ); - QFile srcFile( src ), destFile( dest ); - if (!srcFile.open( IO_ReadOnly )) - return false; - destFile.remove(); - if (!destFile.open( IO_WriteOnly )) - return false; - - while (!srcFile.atEnd()) { - len = srcFile.readBlock( buf, buflen ); - if (len <= 0) - break; - if (destFile.writeBlock( buf, len ) != len) - return false; - } - destFile.flush(); - return true; -#endif -} - -void SetupWizardImpl::initPages() -{ -#define ADD_PAGE( var, Class ) \ - { \ - var = new Class( this, #var ); \ - SideDecorationImpl *sideDeco = new SideDecorationImpl( var ); \ - \ - Q_ASSERT( var->layout() != 0 ); \ - if ( var->layout()->inherits("QBoxLayout") ) { \ - ((QBoxLayout*)var->layout())->insertWidget( 0, sideDeco ); \ - ((QBoxLayout*)var->layout())->insertSpacing( 1, 10 ); \ - } \ - \ - pages.append( var ); \ - addPage( var, var->title() ); \ - setHelpEnabled( var, false ); \ - \ - connect( this, SIGNAL(wizardPages(const QPtrList<Page>&)), \ - sideDeco, SLOT(wizardPages(const QPtrList<Page>&)) ); \ - connect( this, SIGNAL(wizardPageShowed(int)), \ - sideDeco, SLOT(wizardPageShowed(int)) ); \ - connect( this, SIGNAL(wizardPageFailed(int)), \ - sideDeco, SLOT(wizardPageFailed(int)) ); \ - connect( this, SIGNAL(editionString(const QString&)), \ - sideDeco->editionLabel, SLOT(setText(const QString&)) ); \ - } - - QPtrList<Page> pages; - if( globalInformation.reconfig() ) { - ADD_PAGE( configPage, ConfigPageImpl ) - ADD_PAGE( buildPage, BuildPageImpl ) - ADD_PAGE( finishPage, FinishPageImpl ) - } else { -#if defined(Q_OS_WIN32) - ADD_PAGE( winIntroPage, WinIntroPageImpl ) -#endif -#if !defined(EVAL_CD) && !defined(NON_COMMERCIAL) - ADD_PAGE( licensePage, LicensePageImpl ) -#endif - ADD_PAGE( licenseAgreementPage, LicenseAgreementPageImpl) -#if defined(QSA) - ADD_PAGE( licenseAgreementPageQsa, LicenseAgreementPageImpl) -#endif - ADD_PAGE( optionsPage, OptionsPageImpl ) -#if defined(QSA) - ADD_PAGE( optionsPageQsa, OptionsPageImpl ) -#endif -#if !defined(Q_OS_UNIX) - ADD_PAGE( foldersPage, FoldersPageImpl ) -#endif - ADD_PAGE( configPage, ConfigPageImpl ) - ADD_PAGE( progressPage, ProgressPageImpl ) - ADD_PAGE( buildPage, BuildPageImpl ) - ADD_PAGE( finishPage, FinishPageImpl ) - } -#undef ADD_PAGE - - if ( licensePage ) { - setNextEnabled( licensePage, false ); - } - if ( licenseAgreementPage ) { - setNextEnabled( licenseAgreementPage, false ); - } - if ( licenseAgreementPageQsa ) { - setNextEnabled( licenseAgreementPageQsa, false ); - licenseAgreementPage->titleStr = "License agreement Qt"; - licenseAgreementPageQsa->titleStr = "License agreement QSA"; - } - if ( optionsPage ) { - setBackEnabled( optionsPage, false ); - } - if ( optionsPageQsa ) { - optionsPageQsa->installExamples->hide(); - optionsPageQsa->installTools->hide(); - optionsPageQsa->installExtensions->hide(); - optionsPageQsa->installTutorials->hide(); - optionsPageQsa->skipBuild->hide(); - optionsPageQsa->installDocs->hide(); - optionsPageQsa->sysGroup->hide(); - optionsPageQsa->pathLabel->setText("QSA destination &path"); - - optionsPage->titleStr = "Options for Qt"; - optionsPage->shortTitleStr = "Choose options for Qt"; - optionsPageQsa->titleStr = "Options for QSA"; - optionsPageQsa->shortTitleStr = "Choose options for QSA"; - } - if ( configPage ) - setBackEnabled( configPage, false ); - if ( progressPage ) { - setBackEnabled( progressPage, false ); - setNextEnabled( progressPage, false ); - } - if ( buildPage ) { - setBackEnabled( buildPage, false ); - setNextEnabled( buildPage, false ); - } - if ( finishPage ) { - setBackEnabled( finishPage, false ); - setFinishEnabled( finishPage, true ); - } - emit wizardPages( pages ); -} - -void SetupWizardImpl::initConnections() -{ - connect( &autoContTimer, SIGNAL( timeout() ), this, SLOT( timerFired() ) ); - - if ( optionsPage ) { - connect( optionsPage->sysGroup, SIGNAL(clicked(int)), SLOT(clickedSystem(int))); - connect( optionsPage->sysOtherCombo, SIGNAL(activated(int)), SLOT(sysOtherComboChanged(int))); - } - if ( foldersPage ) { - connect( foldersPage->folderPathButton, SIGNAL(clicked()), SLOT(clickedFolderPath())); - connect( foldersPage->devSysPathButton, SIGNAL(clicked()), SLOT(clickedDevSysPath())); - } - if ( licensePage ) { - connect( licensePage->readLicenseButton, SIGNAL(clicked()), SLOT(clickedLicenseFile())); - connect( licensePage->customerID, SIGNAL(textChanged(const QString&)), SLOT(licenseChanged())); - connect( licensePage->licenseID, SIGNAL(textChanged(const QString&)), SLOT(licenseChanged())); - connect( licensePage->licenseeName, SIGNAL(textChanged(const QString&)), SLOT(licenseChanged())); - connect( licensePage->expiryDate, SIGNAL(textChanged(const QString&)), SLOT(licenseChanged())); - connect( licensePage->productsString, SIGNAL(activated(int)), SLOT(licenseChanged())); - connect( licensePage->key, SIGNAL(textChanged(const QString&)), SLOT(licenseChanged())); - } - if ( configPage ) { - connect( configPage->configTabs, SIGNAL(currentChanged(QWidget*)), SLOT(configPageChanged())); - } - if ( buildPage ) { - connect( &configure, SIGNAL( processExited() ), this, SLOT( configDone() ) ); - connect( &configure, SIGNAL( readyReadStdout() ), this, SLOT( readConfigureOutput() ) ); - connect( &configure, SIGNAL( readyReadStderr() ), this, SLOT( readConfigureError() ) ); - connect( &make, SIGNAL( processExited() ), this, SLOT( makeDone() ) ); - connect( &make, SIGNAL( readyReadStdout() ), this, SLOT( readMakeOutput() ) ); - connect( &make, SIGNAL( readyReadStderr() ), this, SLOT( readMakeError() ) ); - connect( buildPage->restartBuild, SIGNAL(clicked()), this, SLOT(restartBuild()) ); - } -} - -void SetupWizardImpl::stopProcesses() -{ - if( cleaner.isRunning() ) - cleaner.kill(); - if( configure.isRunning() ) - configure.kill(); - if( make.isRunning() ) - make.kill(); -} - -void SetupWizardImpl::clickedFolderPath() -{ - foldersPage->folderPath->setText( shell.selectFolder( foldersPage->folderPath->text(), ( foldersPage->folderGroups->currentItem() == 0 ) ) ); -} - -void SetupWizardImpl::clickedDevSysPath() -{ - QDir dir( foldersPage->devSysPath->text() ); - if( !dir.exists() ) - dir.setPath( devSysFolder ); - - QString dest = QFileDialog::getExistingDirectory( dir.absPath(), this, 0, "Select the path to Microsoft Visual Studio" ); - if (!dest.isNull()) - foldersPage->devSysPath->setText( dest ); -} - -void SetupWizardImpl::sysOtherComboChanged(int) -{ - clickedSystem(GlobalInformation::Other); -} - -static QString getDirectoryList(const char *envvar) -{ - QString environment; - const char *cpath = getenv(envvar); - if (cpath) { - environment = QString::fromLocal8Bit(cpath); - environment = QStringList::split(QRegExp("[;,]"), environment).join("\n"); - } else { - environment = "<Environment variable empty>"; - } - return environment; -} - -void SetupWizardImpl::clickedSystem( int sys ) -{ -#ifndef Q_OS_MACX - if (sys == 99) // This is the Integrate with IDE checkbox - return; - globalInformation.setSysId( GlobalInformation::SysId(sys) ); - if (sys == GlobalInformation::Other) { - if (optionsPage->sysOtherCombo->currentText() == "win32-watcom") - globalInformation.setSysId(GlobalInformation::Watcom); - } - if (!isVisible()) - return; - QString makeCmd = globalInformation.text(GlobalInformation::MakeTool); - QString environment; - fixedPath = false; - if ( !optionsPage->skipBuild->isChecked() && optionsPage->skipBuild->isEnabled() ) { - QString commandTool; - environment = getenv("COMSPEC"); - if( qWinVersion() & WV_DOS_based ) - commandTool = "command.com"; - else - commandTool = "cmd.exe"; - if (!environment.isEmpty() && !environment.endsWith(commandTool, false)) { - if (QMessageBox::critical(this, "Environment problems", - "The 'COMSPEC' environment variable is not set to use\n" - "'" + commandTool + "'. This could cause some problems when building.\n" - "If you have difficulty then change it to use '" + commandTool + "'\n" - "and restart the installation\n\n" - "Please contact your local system administration if you have\n" - "difficulties finding the file, or if you don't know how to\n" - "modify the environment settings on your system.\n\n" - "Alternatively, by clicking yes, the installer will try to set\n" - "these for you.", - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - fixEnvironment("COMSPEC", commandTool); - } - if( !findFile( makeCmd ) ) { - environment = getDirectoryList("PATH"); - // ### try to adjust environment - if (QMessageBox::critical(this, "Environment problems", - "The make tool '" + makeCmd + "' could not be located in any\n" - "directory listed in the 'PATH' environment variable:" - "\n\n" + environment + "\n\n" - "Make sure the path to this file is present in the PATH environment\n" - "variable and restart the installation.\n" - "\n" - "You can find the path to the tool using the 'Find' tool\n" - "and add the location to the environment settings of your\n" - "system. Please contact your local system administration if\n" - "you have difficulties finding the files, or if you don't\n" - "know how to modifiy the environment settings of your system.\n\n" - "Alternatively, by clicking yes, the installer will try to set\n" - "these for you.", - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - fixEnvironment("PATH", makeCmd); - } - if (globalInformation.sysId() != GlobalInformation::Borland && globalInformation.sysId() != GlobalInformation::MinGW) { - if (!findFile( "string.h" ) ) { - environment = getDirectoryList("INCLUDE"); - // ### try to adjust environment - if (QMessageBox::critical(this, "Environment problems", - "The file 'string.h' could not be located in any directory\n" - "listed in the 'INCLUDE' environment variable:\n\n" + environment + "\n\n" - "You might have to install the platform headers, or adjust\n" - "the environment variables of your system, and restart the\n" - "installation.\n\n" - "Please contact your local system administration if you have\n" - "difficulties finding the file, or if you don't know how to\n" - "modify the environment settings on your system.\n\n" - "Alternatively, by clicking yes, the installer will try to set\n" - "these for you.", - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - fixEnvironment("INCLUDE", "string.h"); - - } - if (!findFile("ole32.lib")) { - environment = getDirectoryList("LIB"); - // ### try to adjust environment - if (QMessageBox::critical(this, "Environment problems", - "The file 'ole32.lib' could not be located in any directory\n" - "listed in the 'LIB' environment variable:\n\n" + environment + "\n\n" - "You might have to install the platform libraries, or adjust\n" - "the environment variables of your system, and restart the\n" - "installation.\n\n" - "Please contact your local system administration if you have\n" - "difficulties finding the file, or if you don't know how to\n" - "modify the environment settings on your system.\n\n" - "Alternatively, by clicking yes, the installer will try to set\n" - "these for you.", - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - fixEnvironment("LIB", "ole32.lib"); - - } - bool foundCommonDll = false; - QString commonDll; - QString commonDllText; - QString presentFileText = "Make sure the path to this file is present in the PATH environment\n"; - if (globalInformation.sysId() == GlobalInformation::MSVC) { - commonDll = "mspdb60.dll"; - foundCommonDll = findFile(commonDll); - commonDllText = "The file 'mspdb60.dll' "; - } else if(globalInformation.sysId() == GlobalInformation::MSVCNET) { - commonDll = "mspdb70.dll"; - foundCommonDll = findFile(commonDll); - if (!foundCommonDll) { - commonDll = "mspdb71.dll"; - foundCommonDll = findFile(commonDll); - commonDllText = "The files 'mspdb70.dll' and 'mspdb71.dll' "; // VC 7.0 or VC 7.1 - presentFileText = "Make sure the path to one of these files is present in the PATH environment\n"; - } - } else { - foundCommonDll = true; - } - if(!foundCommonDll && !fixedPath) { - environment = getDirectoryList("PATH"); - // ### try to adjust environment - if (QMessageBox::critical(this, "Environment problems", - commonDllText + "could not be located in any\n" - "directory listed in the 'PATH' environment variable:" - "\n\n" + environment + "\n\n" - + presentFileText + - "variable and restart the installation.\n" - "\n" - "You can find the path to the tool using the 'Find' tool\n" - "and add the location to the environment settings of your\n" - "system. Please contact your local system administration if\n" - "you have difficulties finding the files, or if you don't\n" - "know how to modifiy the environment settings of your system.\n\n" - "Alternatively, by clicking yes, the installer will try to set\n" - "these for you.", - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - fixEnvironment("PATH", commonDllText); - - } - } - if (globalInformation.sysId() == GlobalInformation::Intel && !findFile("icl.exe")) { - environment = getDirectoryList("PATH"); - if (QMessageBox::critical(this, "Environment problems", - "The Intel C++ compiler (icl.exe) could not be found\n" - "in your PATH:\n\n" + environment + "\n\n" - "Make sure the path to this file is present in the PATH environment\n" - "variable and restart the installation.\n" - "\n" - "You can find the path to the tool using the 'Find' tool\n" - "and add the location to the environment settings of your\n" - "system. Please contact your local system administration if\n" - "you have difficulties finding the files, or if you don't\n" - "know how to modifiy the environment settings of your system.\n\n" - "Alternatively, by clicking yes, the installer will try to set\n" - "these for you.", - QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) - fixEnvironment("PATH", "icl.exe"); - - } - } -#endif -} - -void SetupWizardImpl::fixEnvironment(const QString &var, const QString &file) -{ - if (var == "COMSPEC" || !(globalInformation.sysId() == GlobalInformation::MSVC || - globalInformation.sysId() == GlobalInformation::MSVCNET)) { - QString fn = QDir::toNativeSeparators(QFileDialog::getOpenFileName(QString(), QString(), this, 0, - "Please find " + file)); - QString envs = getenv(var); - if (var != "COMSPEC") { - fn.truncate(fn.findRev("\\") - 1); - fn += ";" + envs; - } - if (!fn.isEmpty()) - QEnvironment::putEnv(var, fn, QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - } else if (globalInformation.sysId() == GlobalInformation::MSVC) { - QString visualStudio = - QEnvironment::getRegistryString("Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual Studio", - "ProductDir", QEnvironment::LocalMachine); - if (var == "PATH" && !fixedPath) { - QString newPaths = visualStudio + "\\vc98\\bin;"; - newPaths += visualStudio + "\\Common\\MSDev98\\Bin;"; - if (qWinVersion() & Qt::WV_NT_based) - newPaths += visualStudio + "\\Common\\Tools\\WinNT;"; - else - newPaths += visualStudio + "\\Common\\Tools\\Win95;"; - QEnvironment::putEnv("PATH", newPaths + getenv("PATH"), - QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - fixedPath = true; - } else if (var == "LIB") { - QString newPaths = visualStudio + "\\vc98\\lib;"; - newPaths += visualStudio + "\\vc98\\mfc\\lib;"; - QEnvironment::putEnv("LIB", newPaths + getenv("LIB"), - QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - } else if (var == "INCLUDE") { - QString newPaths = visualStudio + "\\vc98\\atl\\include;"; - newPaths += visualStudio + "\\vc98\\include;"; - newPaths += visualStudio + "\\vc98\\mfc\\include;"; - QEnvironment::putEnv("INCLUDE", newPaths + getenv("INCLUDE"), - QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - } - } else if (globalInformation.sysId() == GlobalInformation::MSVCNET) { - QString visualStudio = QEnvironment::getRegistryString("Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VS", - "ProductDir", QEnvironment::LocalMachine); - if (visualStudio.isEmpty()) - visualStudio = QEnvironment::getRegistryString("Software\\Microsoft\\VisualStudio\\7.0\\Setup\\VS", - "ProductDir", QEnvironment::LocalMachine); - // With .NET this isn't so easily done, we need to read in the vsvars32.bat file - // to get this right - QFile f(visualStudio + "\\Common7\\Tools\\vsvars32.bat"); - QString contents; - if (f.open(IO_ReadOnly)) { - contents = QString(f.readAll()); - } - int vsinstall = contents.find("VSINSTALLDIR=")+13; - QString VSINSTALLDIR = contents.mid(vsinstall, contents.find("\n", vsinstall) - vsinstall); - int vcinstall = contents.find("VCINSTALLDIR=")+13; - QString VCINSTALLDIR = contents.mid(vcinstall, contents.find("\n", vcinstall) - vcinstall); - int framework = contents.find("FrameworkDir=")+13; - QString FrameworkDir = contents.mid(framework, contents.find("\n", framework) - framework); - int frameworkVer = contents.find("FrameworkVersion=")+17; - QString FrameworkVer = contents.mid(frameworkVer, contents.find("\n", frameworkVer) - frameworkVer); - int frameworkSDK = contents.find("FrameworkSDKDir=")+16; - QString FrameworkSDK = contents.mid(frameworkSDK, contents.find("\n", frameworkSDK) - frameworkSDK); - if (var == "PATH" && !fixedPath) { - QString newPaths = VSINSTALLDIR + ";"; - newPaths += VCINSTALLDIR + "\\Bin;"; - newPaths += VCINSTALLDIR + "\\Common7\\Tools;"; - newPaths += VCINSTALLDIR + "\\Common7\\Tools\\bin\\prerelease;"; - newPaths += VCINSTALLDIR + "\\Common7\\Tools\\bin;"; - newPaths += FrameworkSDK + "\\bin;"; - newPaths += FrameworkSDK + "\\" + FrameworkVer + ";"; - QEnvironment::putEnv("PATH", newPaths + getenv("PATH"), - QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - fixedPath = true; - } else if (var == "LIB") { - QString newPaths = VCINSTALLDIR + "\\ATLMFC\\LIB;"; - newPaths += VCINSTALLDIR + "\\LIB;"; - newPaths += VCINSTALLDIR + "\\PlatformSDK\\lib\\prerelease;"; - newPaths += VCINSTALLDIR + "\\PlatformSDK\\lib;"; - newPaths += FrameworkSDK + "\\lib;"; - QEnvironment::putEnv("LIB", newPaths + getenv("LIB"), - QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - } else if (var == "INCLUDE") { - QString newPaths = VCINSTALLDIR + "\\ATLMFC\\INCLUDE;"; - newPaths += VCINSTALLDIR + "\\INCLUDE;"; - newPaths += VCINSTALLDIR + "\\PlatformSDK\\include\\prerelease;"; - newPaths += VCINSTALLDIR + "\\PlatformSDK\\include;"; - newPaths += FrameworkSDK + "\\include;"; - QEnvironment::putEnv("INCLUDE", newPaths + getenv("INCLUDE"), - QEnvironment::PersistentEnv | QEnvironment::LocalEnv); - } - - } -} - -void SetupWizardImpl::readCleanerOutput() -{ - updateDisplay( cleaner.readStdout(), currentOLine ); -} - -void SetupWizardImpl::readConfigureOutput() -{ - updateDisplay( configure.readStdout(), currentOLine ); -} - -void SetupWizardImpl::readMakeOutput() -{ - updateDisplay( make.readStdout(), currentOLine ); -} - -void SetupWizardImpl::readAssistantOutput() -{ -#if defined(QSA) - updateDisplay( assistant.readStdout(), currentOLine ); -#endif -} - -void SetupWizardImpl::readCleanerError() -{ - updateDisplay( cleaner.readStderr(), currentELine ); -} - -void SetupWizardImpl::readConfigureError() -{ - updateDisplay( configure.readStderr(), currentELine ); -} - -void SetupWizardImpl::readMakeError() -{ - updateDisplay( make.readStderr(), currentELine ); -} - -void SetupWizardImpl::readAssistantError() -{ -#if defined(QSA) - updateDisplay( assistant.readStderr(), currentELine ); -#endif -} - -void SetupWizardImpl::updateDisplay( const QString &input, QString &output) -{ - const QChar *c = input.unicode(); - for( int i = 0; i < (int)input.length(); ++i, ++c ) { - switch( char( *c ) ) { - case '\r': - case 0x00: - break; - case '\t': - currentOLine += " "; // Simulate a TAB by using 4 spaces - break; - case '\n': - if( output.length() ) { - if ( !globalInformation.reconfig() ) { - if ( output.right( 4 ) == ".cpp" || - output.right( 2 ) == ".c" || - output.right( 4 ) == ".pro" || - output.right( 3 ) == ".ui" ) { - buildPage->compileProgress->setProgress( ++filesCompiled ); - } - } - logOutput( output ); - output = ""; - } - break; - default: - output += *c; - break; - } - } -} - -#if defined(Q_OS_WIN32) -void SetupWizardImpl::installIcons( const QString& iconFolder, const QString& dirName, bool common ) -{ - QDir dir( dirName ); - - dir.setSorting( QDir::Name | QDir::IgnoreCase ); - const QFileInfoList* filist = dir.entryInfoList(); - if ( !filist ) - return; - QFileInfoListIterator it( *filist ); - QFileInfo* fi; - while( ( fi = it.current() ) ) { - if( fi->fileName()[0] != '.' && // Exclude dot-dirs - fi->fileName() != "sql" ) { // Exclude SQL-dir - if( fi->isDir() ) { - installIcons( iconFolder, fi->absFilePath(), common ); - } else if( fi->fileName().right( 4 ) == ".exe" ) { - shell.createShortcut( iconFolder, common, fi->baseName(), fi->absFilePath() ); - } - } - ++it; - } -} -#endif - -void SetupWizardImpl::assistantDone() -{ -#if defined(QSA) - QString contentFile; - static int count = 0; - if ( count == 0 ) { - connect( &assistant, SIGNAL( processExited() ), this, SLOT( assistantDone() ) ); - connect( &assistant, SIGNAL( readyReadStdout() ), this, SLOT( readAssistantOutput() ) ); - connect( &assistant, SIGNAL( readyReadStderr() ), this, SLOT( readAssistantError() ) ); - contentFile = "qsa.xml"; - } else if ( count == 1 ) { - contentFile = "qt-script-for-applications.xml"; - } else { - doIDEIntegration(); - return; - } - ++count; - - // install documentation - QDir html( optionsPageQsa->installPath->text() ); - html.cd( "doc/html/" ); - - QStringList lst; - lst << "assistant"; - lst << "-addContentFile"; - lst << QDir::toNativeSeparators( html.filePath( contentFile ) ); - assistant.setArguments( lst ); - if( !assistant.start() ) { - logOutput( "Installing QSA documentation failed\n" ); - assistantDone(); - } -#else - doIDEIntegration(); -#endif -} - -void SetupWizardImpl::doIDEIntegration() -{ -#if defined(Q_OS_WIN32) - QDir installDir( optionsPage->installPath->text() ); - if ( optionsPage->installIDEIntegration->isChecked() && optionsPage->installIDEIntegration->isEnabled() - && !foldersPage->devSysPath->text().isEmpty() ) { - // install the precompiled MS integration - if ( globalInformation.sysId() == GlobalInformation::MSVC ) { - QDir addinsDir( foldersPage->devSysPath->text() ); - addinsDir.cd( "Common/MSDev98/Addins" ); - if ( copyFile( installDir.filePath("qmsdev.dll"), addinsDir.filePath("qmsdev.dll") ) ) { - installDir.remove( "qmsdev.dll" ); - } - } else if ( globalInformation.sysId() == GlobalInformation::MSVCNET - || globalInformation.sysId() == GlobalInformation::Intel){ - QString filepath = installDir.filePath("QMsNetSetup.msi"); - filepath = filepath.replace( '/', '\\' ); - - int res = _spawnlp( _P_NOWAIT, "msiexec.exe", "msiexec.exe", "-i", filepath.latin1(), NULL ); - if ( res == -1 ) { - //MSIExec is not in path, look up in registry (only works for NT machines) - QString msiexec = QEnvironment::getRegistryString( "SYSTEM\\CurrentControlSet\\Services\\MSIServer", - "ImagePath", - QEnvironment::LocalMachine ); - if ( !msiexec.isEmpty() ) - msiexec.remove( " /V" ); - res = _spawnl( _P_NOWAIT, msiexec.latin1(), msiexec.latin1(), "-i", filepath.latin1(), NULL ); - } - - if ( res == -1 ) { - QMessageBox::warning( this, "Couldn't execute .NET addin installer script", - "Microsoft Installer (MSI) was not found on your system.\n" - "Please install MSI, then execute the .NET addin installer " - "script,\nlocated at " + filepath ); - } - } - - QFile *autoexp = 0; - QFile *usertype = 0; - switch( globalInformation.sysId() ) { - case GlobalInformation::MSVC: - autoexp = new QFile( foldersPage->devSysPath->text() + "\\Common\\MsDev98\\bin\\autoexp.dat" ); - usertype = new QFile( foldersPage->devSysPath->text() + "\\Common\\MsDev98\\bin\\usertype.dat" ); - break; - case GlobalInformation::MSVCNET: - autoexp = new QFile( foldersPage->devSysPath->text() + "\\Common7\\Packages\\Debugger\\autoexp.dat" ); - usertype = new QFile( foldersPage->devSysPath->text() + "\\Common7\\Packages\\Debugger\\usertype.dat" ); - break; - } - - if ( autoexp ) { - QString autoExpContents; - if ( !autoexp->exists() ) { - autoexp->open( IO_WriteOnly ); - } else { - // First try to open the file to search for existing installations - autoexp->open( IO_ReadOnly ); - QByteArray bytes = autoexp->readAll(); - autoExpContents = QString::fromLatin1(bytes.data(), bytes.size()); - autoexp->close(); - if ( autoExpContents.find( "; Trolltech Qt" ) == -1 ) - autoexp->open(IO_WriteOnly | IO_Translate); - } - if( autoexp->isOpen() ) { - bool written = false; - QTextStream outstream( autoexp ); - QStringList entries = QStringList::split("\r\n", autoExpContents, true); - for (QStringList::Iterator entry = entries.begin(); entry != entries.end(); ++entry) { - QString e(*entry); - outstream << e << endl; - if (!written && e.startsWith("[AutoExpand]")) { - outstream << endl; - outstream << "; Trolltech Qt" << endl; - outstream << "QString=<d->unicode,su> len=<d->len,u>" << endl; - outstream << "QCString =<shd->data, s>" << endl; - outstream << "QPoint =x=<xp> y=<yp>" << endl; - outstream << "QRect =x1=<x1> y1=<y1> x2=<x2> y2=<y2>" << endl; - outstream << "QSize =width=<wd> height=<ht>" << endl; - outstream << "QWMatrix =m11=<_m11> m12=<_m12> m21=<_m21> m22=<_m22> dx=<_dx> dy=<_dy>" << endl; - outstream << "QVariant =Type=<d->typ> value=<d->value>" << endl; - outstream << "QValueList<*> =Count=<sh->nodes>" << endl; - outstream << "QPtrList<*> =Count=<numNodes>" << endl; - outstream << "QGuardedPtr<*> =ptr=<priv->obj>" << endl; - outstream << "QEvent =type=<t>" << endl; - outstream << "QObject =class=<metaObj->classname,s> name=<objname,s>" << endl; - written = true; - } - } - autoexp->close(); - } - delete autoexp; - } - - if ( usertype ) { - if ( !usertype->exists() ) { - usertype->open( IO_WriteOnly | IO_Translate ); - } else { - usertype->open( IO_ReadOnly ); - QString existingUserType = usertype->readAll(); - usertype->close(); - if ( existingUserType.find( "Q_OBJECT" ) == -1 ) - usertype->open(IO_WriteOnly | IO_Append | IO_Translate); - } - if ( usertype->isOpen() ) { - QTextStream outstream( usertype ); - outstream << endl; - outstream << "Q_OBJECT" << endl; - outstream << "Q_PROPERTY" << endl; - outstream << "Q_ENUMS" << endl; - outstream << "Q_SETS" << endl; - outstream << "Q_CLASSINFO" << endl; - outstream << "emit" << endl; - outstream << "TRUE" << endl; - outstream << "FALSE" << endl; - outstream << "SIGNAL" << endl; - outstream << "SLOT" << endl; - outstream << "signals:" << endl; - outstream << "slots:" << endl; - usertype->close(); - } - delete usertype; - } - } - - if ( globalInformation.sysId() != GlobalInformation::MinGW ) - installDir.remove( "Makefile.win32-g++" ); - if (globalInformation.sysId() != GlobalInformation::MSVC) - installDir.remove( "qmsdev.dll" ); - if (globalInformation.sysId() != GlobalInformation::MSVCNET) - installDir.remove( "QMsNetSetup.msi" ); -#endif - - doStartMenuIntegration(); -} - -void SetupWizardImpl::doStartMenuIntegration() -{ -#if defined(Q_OS_WIN32) - /* - ** Set up our icon folder and populate it with shortcuts. - ** Then move to the next page. - */ - QString dirName, examplesName, tutorialsName; - bool common( foldersPage->folderGroups->currentItem() == 0 ); - QString qtDir = QEnvironment::getEnv( "QTDIR" ); - - dirName = shell.createFolder( foldersPage->folderPath->text(), common ); - shell.createShortcut( dirName, common, "Qt Designer", qtDir + "\\bin\\designer.exe", "GUI designer", "", qtDir ); -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - shell.createShortcut( dirName, common, "Reconfigure Qt", - qtDir + "\\bin\\install.exe", - "Reconfigure the Qt library", - QString("-reconfig \"%1\"").arg(globalInformation.qtVersionStr()), - qtDir ); -#endif -#if defined(QSA) - shell.createShortcut( dirName, common, "License agreement for Qt", "notepad.exe", "Review the license agreement", - "\"" + qtDir + "\\" LICENSE_DEST "\"" ); - shell.createShortcut( dirName, common, "Readme for Qt", "notepad.exe", "Important information", - "\"" + qtDir + "\\README\"" ); - shell.createShortcut( dirName, common, "License agreement for QSA", "notepad.exe", "Review the license agreement", - "\"" + optionsPageQsa->installPath->text() + "\\" LICENSE_DEST "\"" ); - shell.createShortcut( dirName, common, "Readme for QSA", "notepad.exe", "Important information", - "\"" + optionsPageQsa->installPath->text() + "\\README\"" ); -#else - shell.createShortcut( dirName, common, "License agreement", "notepad.exe", "Review the license agreement", "\"" + qtDir + "\\" LICENSE_DEST "\"" ); - shell.createShortcut( dirName, common, "Readme", "notepad.exe", "Important information", QString( "\"" ) + qtDir + "\\README\"" ); -#endif - shell.createShortcut( dirName, common, "Qt Assistant", qtDir + "\\bin\\assistant.exe", "Browse the On-line documentation", "", qtDir ); - shell.createShortcut( dirName, common, "Qt Linguist", qtDir + "\\bin\\linguist.exe", "Qt translation utility", "", qtDir ); - shell.createInternetShortcut( dirName, common, "Trolltech.com", "http://qtsoftware.com/" ); -#if defined(EVAL_CD) - shell.createInternetShortcut( dirName, common, "Register for Support", "http://qtsoftware.com/products/qt/evaluate.html" ); -#endif - - if ( ( ( !globalInformation.reconfig() && optionsPage->skipBuild->isChecked() ) - || ( globalInformation.reconfig() && !configPage->rebuildInstallation->isChecked() ) ) - || qWinVersion() & WV_DOS_based ) { - QString description; -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - buildQtShortcutText = "Build Qt Examples and Tutorials"; - description = "Build the Qt Examples and Tutorials"; -#else - buildQtShortcutText = "Build Qt " + globalInformation.qtVersionStr(); - description = "Build the Qt library"; -#endif - shell.createShortcut( dirName, common, - buildQtShortcutText, - QEnvironment::getEnv( "QTDIR" ) + "\\build.bat", - description ); - } - -#if defined(QSA) - QString qsaExamplesName; - if( qWinVersion() & WV_DOS_based ) { - shell.createShortcut( dirName, common, - "QSA Examples", - optionsPageQsa->installPath->text() + "\\examples" ); - } else { - qsaExamplesName = shell.createFolder( foldersPage->folderPath->text() + "\\QSA Examples", common ); - installIcons( qsaExamplesName, optionsPageQsa->installPath->text() + "\\examples", common ); - } -#endif - if( optionsPage->installTutorials->isChecked() ) { - if( qWinVersion() & WV_DOS_based ) { - shell.createShortcut( dirName, common, -#if defined(QSA) - "Qt Tutorials", -#else - "Tutorials", -#endif - QEnvironment::getEnv( "QTDIR" ) + "\\tutorial" ); - } else { -#if defined(QSA) - tutorialsName = shell.createFolder( foldersPage->folderPath->text() + "\\Qt Tutorials", common ); -#else - tutorialsName = shell.createFolder( foldersPage->folderPath->text() + "\\Tutorials", common ); -#endif - installIcons( tutorialsName, QEnvironment::getEnv( "QTDIR" ) + "\\tutorial", common ); - } - } - if( optionsPage->installExamples->isChecked() ) { - if( qWinVersion() & WV_DOS_based ) { - shell.createShortcut( dirName, common, -#if defined(QSA) - "Qt Examples", -#else - "Examples", -#endif - QEnvironment::getEnv( "QTDIR" ) + "\\examples" ); - } else { -#if defined(QSA) - examplesName = shell.createFolder( foldersPage->folderPath->text() + "\\Qt Examples", common ); -#else - examplesName = shell.createFolder( foldersPage->folderPath->text() + "\\Examples", common ); -#endif - installIcons( examplesName, QEnvironment::getEnv( "QTDIR" ) + "\\examples", common ); - } - } -#endif -#if defined(QSA) -#endif - buildPage->compileProgress->setProgress( buildPage->compileProgress->totalSteps() ); - setNextEnabled( buildPage, true ); - logOutput( "The build was successful", true ); -} - -void SetupWizardImpl::makeDone() -{ - makeDone( !make.normalExit() || make.exitStatus() ); -} - -void SetupWizardImpl::makeDone( bool error ) -{ - if( error ) { - if (!backButton()->isEnabled()) { - logOutput( "The build process failed!\n" ); - emit wizardPageFailed( indexOf(currentPage()) ); - QMessageBox::critical( this, "Error", "The build process failed!\nSee the log for details." ); - buildPage->restartBuild->setText( "Restart compile" ); - backButton()->setEnabled(true); - } - setAppropriate( progressPage, false ); -#if defined(QSA) - } else if ( make.workingDirectory() == QEnvironment::getEnv( "QTDIR" ) ) { - QStringList args; - args << globalInformation.text(GlobalInformation::MakeTool); - args << "sub-examples"; - - make.setWorkingDirectory( optionsPageQsa->installPath->text() ); - make.setArguments( args ); - - if( !make.start() ) { - logOutput( "Could not start make process.\n" - "Make sure that your compiler tools are installed\n" - "and registered correctly in your PATH environment." ); - emit wizardPageFailed( indexOf(currentPage()) ); - backButton()->setEnabled( true ); - } -#endif - } else { - // We still have some more items to do in order to finish all the - // integration stuff. - if ( !globalInformation.reconfig() ) { - logOutput( "Doing the final integration steps..." ); - assistantDone(); - } else { - setNextEnabled( buildPage, true ); - logOutput( "The build was successful", true ); - } - buildPage->restartBuild->setText( "Success" ); - buildPage->restartBuild->setEnabled( false ); - } -} - -void SetupWizardImpl::configDone() -{ - QStringList args; - - if( globalInformation.reconfig() && !configPage->rebuildInstallation->isChecked() ) - showPage( finishPage ); - -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - if( !configure.normalExit() || configure.exitStatus() ) { - logOutput( "The configure process failed.\n" ); - emit wizardPageFailed( indexOf(currentPage()) ); - buildPage->restartBuild->setText( "Restart configure" ); - setAppropriate( progressPage, false ); - backButton()->setEnabled(true); - } else -#endif - { - args << globalInformation.text(GlobalInformation::MakeTool); -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - args << "sub-src"; - args << "sub-plugins"; - if ( optionsPage ) { - if ( optionsPage->installTools->isChecked() ) - args << "sub-tools"; - if ( optionsPage->installTutorials->isChecked() ) - args << "sub-tutorial"; - if ( optionsPage->installExamples->isChecked() ) - args << "sub-examples"; - if ( optionsPage->installExtensions->isChecked() ) - args << "sub-extensions"; - } else if (globalInformation.reconfig()) { - args << "sub-tools"; // We want to make sure it rebuilds uic etc - } -#elif defined(Q_OS_WIN32) - if ( optionsPage ) { - if ( optionsPage->installTutorials->isChecked() ) - args << "sub-tutorial"; - if ( optionsPage->installExamples->isChecked() ) - args << "sub-examples"; -#if !defined(NON_COMMERCIAL) - if ( optionsPage->installExtensions->isChecked() ) - args << "sub-extensions"; -#endif - } - if ( args.count() == 1 ) { - make.setWorkingDirectory( QEnvironment::getEnv( "QTDIR" ) ); - makeDone( false ); - return; - } -#endif - if ( globalInformation.sysId() == GlobalInformation::MinGW ) { - args << "-fMakefile.win32-g++"; - } - - make.setWorkingDirectory( QEnvironment::getEnv( "QTDIR" ) ); - make.setArguments( args ); - - if( !make.start() ) { - logOutput( "Could not start make process.\n" - "Make sure that your compiler tools are installed\n" - "and registered correctly in your PATH environment." ); - emit wizardPageFailed( indexOf(currentPage()) ); - backButton()->setEnabled( true ); - } else { - buildPage->restartBuild->setText( "Stop compilation" ); - } - } -} - -void SetupWizardImpl::restartBuild() -{ - if ( configure.isRunning() || - (!configure.isRunning() && (!configure.normalExit() || configure.exitStatus())) ) { - if ( configure.isRunning() ) { // Stop configure - configure.kill(); - buildPage->restartBuild->setText( "Restart configure" ); - logOutput( "\n*** Configure stopped by user...\n" ); - backButton()->setEnabled( true ); - } else { // Restart configure - emit wizardPageShowed( indexOf(currentPage()) ); - backButton()->setEnabled( false ); - cleanDone(); - buildPage->restartBuild->setText( "Stop configure" ); - logOutput( "\n*** Configure restarted by user...\n" ); - } - } else if ( make.isRunning() || - (!make.isRunning() && (!make.normalExit() || make.exitStatus())) ) { - if ( make.isRunning() ) { // Stop compile - buildPage->restartBuild->setText( "Restart compile" ); - logOutput( "\n*** Compilation stopped by user...\n" ); - backButton()->setEnabled( true ); - make.kill(); - } else { // Restart compile - wizardPageShowed( indexOf(currentPage()) ); - backButton()->setEnabled( false ); - configDone(); - buildPage->restartBuild->setText( "Stop compile" ); - logOutput( "\n*** Compilation restarted by user...\n" ); - } - } -} - -void SetupWizardImpl::saveSettings() -{ -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - QApplication::setOverrideCursor( Qt::waitCursor ); - saveSet( configPage->configList ); - saveSet( configPage->advancedList ); - QApplication::restoreOverrideCursor(); -#endif -} - -void SetupWizardImpl::saveSet( QListView* list ) -{ - QSettings settings; - settings.writeEntry( "/Trolltech/Qt/ResetDefaults", "FALSE" ); - - QListViewItemIterator it( list ); - while ( it.current() ) { - QListViewItem *itm = it.current(); - ++it; - if ( itm->rtti() != CheckListItem::RTTI ) - continue; - CheckListItem *item = (CheckListItem*)itm; - if ( item->type() == QCheckListItem::RadioButton ) { - if ( item->isOn() ) { - QString folder; - QListViewItem *pItem = item; - while ( (pItem = pItem->parent() ) ) { - if ( folder.isEmpty() ) - folder = pItem->text( 0 ); - else - folder = pItem->text(0) + "/" + folder; - } - - settings.writeEntry( "/Trolltech/Qt/" + folder, item->text() ); - } - } else if ( item->type() == QCheckListItem::CheckBox ) { - QStringList lst; - QListViewItem *p = item->parent(); - if ( p ) - --it; - QString c = p->text( 0 ); - while ( ( itm = it.current() ) && - itm->rtti() == CheckListItem::RTTI && - item->type() == CheckListItem::CheckBox ) { - item = (CheckListItem*)itm; - ++it; - if ( item->isOn() ) - lst << item->text( 0 ); - } - if ( lst.count() ) - settings.writeEntry( "/Trolltech/Qt/" + p->text(0), lst, ',' ); - else - settings.writeEntry( "/Trolltech/Qt/" + p->text(0), "Nothing selected" ); - } - } -} - -void SetupWizardImpl::showPage( QWidget* newPage ) -{ - if ( currentPage() == configPage && newPage == progressPage && !verifyConfig() ) { - if (QMessageBox::warning( this, "Configuration with Warnings", - "One or more of the selected options could not be verified by the installer.\n" - "Do you want to continue?", "Yes", "No" )) - return; - } - - QWizard::showPage( newPage ); - setInstallStep( indexOf(newPage) + 1 ); - - if( newPage == licensePage ) { - showPageLicense(); - } else if( newPage == licenseAgreementPage ) { - readLicenseAgreement(); - } else if( newPage == licenseAgreementPageQsa ) { - readLicenseAgreement(); - } else if( newPage == optionsPage ) { - showPageOptions(); - } else if( newPage == foldersPage ) { - showPageFolders(); - } else if( newPage == configPage ) { - showPageConfig(); - } else if( newPage == progressPage ) { - showPageProgress(); - } else if( newPage == buildPage ) { - showPageBuild(); - } else if( newPage == finishPage ) { - showPageFinish(); - } -} - -void SetupWizardImpl::showPageLicense() -{ - licenseChanged(); -} - -void SetupWizardImpl::showPageOptions() -{ - static bool done = false; - if (done) - return; - - done = true; - - // First make sure that the current license information is saved - if( !globalInformation.reconfig() ) - writeLicense( QDir::homeDirPath() + "/.qt-license" ); - - // ### unsupported - optionsPage->installDocs->hide(); - - bool enterprise = licenseInfo[ "PRODUCTS" ] == "qt-enterprise"; - optionsPage->installExtensions->setChecked( enterprise ); - optionsPage->installExtensions->setEnabled( enterprise ); - -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - optionsPage->installDocs->setEnabled( false ); - optionsPage->skipBuild->setEnabled( false ); - if ( globalInformation.sysId()==GlobalInformation::Borland ) { - optionsPage->sysMsvcNet->setEnabled( false ); - optionsPage->sysMsvc->setEnabled( false ); - optionsPage->sysBorland->setEnabled( true ); - optionsPage->sysMinGW->setEnabled( false ); - optionsPage->sysIntel->setEnabled( false ); - optionsPage->sysOther->setEnabled( false ); - } else { - optionsPage->sysMsvcNet->setEnabled( true ); - optionsPage->sysMsvc->setEnabled( true ); - optionsPage->sysBorland->setEnabled( false ); - optionsPage->sysOther->setEnabled( false ); - optionsPage->sysIntel->setEnabled( false ); - optionsPage->sysMinGW->setEnabled( false ); - } -# if defined(Q_OS_WIN32) - optionsPage->installExamples->setEnabled( true ); - optionsPage->installTutorials->setEnabled( true ); - optionsPage->installTools->setEnabled( false ); -# if defined(NON_COMMERCIAL) - optionsPage->installExtensions->hide(); -# else - optionsPage->installExtensions->setChecked( true ); - optionsPage->installExtensions->setEnabled( true ); -# endif -# else - optionsPage->installExamples->setEnabled( false ); - optionsPage->installTutorials->setEnabled( false ); - optionsPage->installExtensions->setChecked( false ); - optionsPage->installExtensions->setEnabled( false ); -# endif -#else -# if defined(Q_OS_WIN32) - // No need to offer the option of skipping the build on 9x, it's skipped anyway - if ( qWinVersion() & WV_DOS_based ) - optionsPage->skipBuild->setEnabled( false ); -# endif -#endif - - // trigger environment test - clickedSystem(globalInformation.sysId()); -} - -void SetupWizardImpl::showPageFolders() -{ - QString ideName = globalInformation.text(GlobalInformation::IDE); - foldersPage->devSysLabel->setText( ideName + " path"); - foldersPage->devSysLabel->setShown(!ideName.isEmpty()); - foldersPage->devSysPath->setShown(!ideName.isEmpty()); - foldersPage->devSysPathButton->setShown(!ideName.isEmpty()); -#if defined(Q_OS_WIN32) - if( globalInformation.sysId() == GlobalInformation::MSVC ) { - QString devPath = QEnvironment::getRegistryString( "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual Studio", "ProductDir", QEnvironment::LocalMachine ); - if ( devPath.isEmpty() ) { - // fallback for Windows 9x - QDir msdevDir( QEnvironment::getEnv("MSDEVDIR") ); - msdevDir.cdUp(); - msdevDir.cdUp(); - devPath = QDir::toNativeSeparators( msdevDir.absPath() ); - } - foldersPage->devSysPath->setText( devPath ); - } else if ( globalInformation.sysId() == GlobalInformation::MSVCNET ) { - QString devPath = QEnvironment::getRegistryString( "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VS", "ProductDir", QEnvironment::LocalMachine ); - if ( !devPath.length() ) - devPath = QEnvironment::getRegistryString( "Software\\Microsoft\\VisualStudio\\7.0\\Setup\\VS", "ProductDir", QEnvironment::LocalMachine ); - foldersPage->devSysPath->setText( devPath ); - } -#endif -} - -void SetupWizardImpl::showPageProgress() -{ - saveSettings(); - int totalSize = 0; - QFileInfo fi; - totalRead = 0; - bool copySuccessful = true; - - if( !filesCopied ) { - createDir( optionsPage->installPath->text() ); - if (optionsPageQsa) - createDir( optionsPageQsa->installPath->text() ); - progressPage->filesDisplay->append( "Installing files...\n" ); - - // install the right LICENSE file - QDir installDir( optionsPage->installPath->text() ); - QFile licenseFile( installDir.filePath( LICENSE_DEST ) ); - if ( licenseFile.open( IO_WriteOnly ) ) { - ResourceLoader *rcLoader; -#if defined(EVAL) || defined(EDU) - rcLoader = new ResourceLoader( "LICENSE" ); -#elif defined(NON_COMMERCIAL) - if ( licenseAgreementPage->countryCombo->currentItem() == 0 ) - rcLoader = new ResourceLoader( "LICENSE-US" ); - else - rcLoader = new ResourceLoader( "LICENSE" ); -#else - if ( usLicense ) { - rcLoader = new ResourceLoader( "LICENSE-US" ); - } else { - rcLoader = new ResourceLoader( "LICENSE" ); - } -#endif - if ( rcLoader->isValid() ) { - licenseFile.writeBlock( rcLoader->data() ); - } else { - emit wizardPageFailed( indexOf(currentPage()) ); - QMessageBox::critical( this, tr("Package corrupted"), - tr("Could not find the LICENSE file in the package.\nThe package might be corrupted.") ); - } - delete rcLoader; - licenseFile.close(); - } else { - // ### error handling -- we could not write the LICENSE file - } -#if defined(QSA) - QDir installDirQsa( optionsPageQsa->installPath->text() ); - QFile licenseFileQsa( installDirQsa.filePath( LICENSE_DEST ) ); - if ( licenseFileQsa.open( IO_WriteOnly ) ) { - ResourceLoader *rcLoader; - rcLoader = new ResourceLoader( "LICENSE_QSA" ); - if ( rcLoader->isValid() ) { - licenseFileQsa.writeBlock( rcLoader->data() ); - } else { - emit wizardPageFailed( indexOf(currentPage()) ); - QMessageBox::critical( this, tr("Package corrupted"), - tr("Could not find the LICENSE file in the package.\nThe package might be corrupted.") ); - } - delete rcLoader; - licenseFileQsa.close(); - } else { - // ### error handling -- we could not write the LICENSE file - } -#endif - - // Install the files -- use different fallbacks if one method failed. - QArchive ar; - QString licenseKey; -#if !defined(EVAL_CD) && !defined(NON_COMMERCIAL) - licenseKey = licensePage->key->text(); -#endif - ar.setVerbosity( QArchive::Destination | QArchive::Verbose | QArchive::Progress ); - connect( &ar, SIGNAL( operationFeedback( const QString& ) ), this, SLOT( archiveMsg( const QString& ) ) ); - connect( &ar, SIGNAL( operationFeedback( int ) ), progressPage->operationProgress, SLOT( setProgress( int ) ) ); - // First, try to find qt.arq as a binary resource to the file. - ResourceLoader rcLoader( "QT_ARQ", 500 ); - if ( rcLoader.isValid() ) { - progressPage->operationProgress->setTotalSteps( rcLoader.data().count() ); - QDataStream ds( rcLoader.data(), IO_ReadOnly ); - ar.readArchive( &ds, optionsPage->installPath->text(), licenseKey ); - } else { - // If the resource could not be loaded or is smaller than 500 - // bytes, we have the dummy qt.arq: try to find and install - // from qt.arq in the current directory instead. - QString archiveName = "qt.arq"; -#if defined(Q_OS_MAC) - QString appDir = qApp->argv()[0]; - int truncpos = appDir.findRev( "/Contents/MacOS/" ); - if (truncpos != -1) - appDir.truncate( truncpos ); - archiveName = appDir + "/Contents/Qt/qtmac.arq"; -#endif - fi.setFile( archiveName ); - if( fi.exists() ) - totalSize = fi.size(); - progressPage->operationProgress->setTotalSteps( totalSize ); - - ar.setPath( archiveName ); - if( ar.open( IO_ReadOnly ) ) { - ar.readArchive( optionsPage->installPath->text(), licenseKey ); - } else { - // We were not able to find any qt.arq -- so assume we have - // the old fashioned zip archive and simply copy the files - // instead. - progressPage->operationProgress->setTotalSteps( FILESTOCOPY ); - copySuccessful = copyFiles( QDir::currentDirPath(), optionsPage->installPath->text(), true ); - - /*These lines are only to be used when changing the filecount estimate - QString tmp( "%1" ); - tmp = tmp.arg( totalFiles ); - QMessageBox::information( this, tmp, tmp ); - */ - progressPage->operationProgress->setProgress( FILESTOCOPY ); - } - } - -#if defined(QSA) - QArchive arQsa; - arQsa.setVerbosity( QArchive::Destination | QArchive::Verbose | QArchive::Progress ); - connect( &arQsa, SIGNAL( operationFeedback( const QString& ) ), this, SLOT( archiveMsg( const QString& ) ) ); - connect( &arQsa, SIGNAL( operationFeedback( int ) ), progressPage->operationProgress, SLOT( setProgress( int ) ) ); - ResourceLoader rcLoaderQsa( "QSA_ARQ", 500 ); - if ( rcLoaderQsa.isValid() ) { - progressPage->operationProgress->setTotalSteps( rcLoaderQsa.data().count() ); - QDataStream ds( rcLoaderQsa.data(), IO_ReadOnly ); - arQsa.readArchive( &ds, optionsPageQsa->installPath->text(), licenseKey ); - } else { - // ### error handling - } -#endif - filesCopied = copySuccessful; - - timeCounter = 30; - if( copySuccessful ) { - QDir installDir( optionsPage->installPath->text() ); -#if defined(Q_OS_WIN32) - QDir windowsFolderDir( shell.windowsFolderName ); -# if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - { - // move $QTDIR/install.exe to $QTDIR/bin/install.exe - // This is done because install.exe is also used to reconfigure Qt - // (and this expects install.exe in bin). We can't move install.exe - // to bin in first place, since for the snapshots, we don't have - // the .arq archives. - QString inFile( installDir.filePath("install.exe") ); - copyFile(inFile, installDir.filePath("bin/install.exe")); - QFile::remove(inFile); - } -# endif - { - // move the uninstaller to the Windows directory - // This is necessary since the uninstaller deletes all files in - // the installation directory (and therefore can't delete - // itself). - QString inFile( installDir.filePath("bin/quninstall.exe") ); - copyFile(inFile, windowsFolderDir.filePath("quninstall.exe")); - QFile::remove(inFile); - } -#endif -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - QStringList::Iterator it; - QDir lib( optionsPage->installPath->text() ); - lib.cd( "lib" ); -# if !defined(EVAL_CD) - // patch qt*.dll -# if !defined(Q_OS_MAC) - QStringList qtDlls = lib.entryList( "qt*.dll" ); -# else - QStringList qtDlls = lib.entryList( "libqt-mt-eval.dylib" ); -# endif - if ( qtDlls.count() == 0 ) { - copySuccessful = false; - QMessageBox::critical( this, - tr( "Error patching Qt library" ), -# if defined(EVAL) - tr( "Could not patch the Qt library with the evaluation\n" - "license information - no Qt DLL was found." ) -# elif defined(EDU) - tr( "Could not patch the Qt library with the educational\n" - "edition license information - no Qt DLL was found." ) -# else - tr( "Could not patch the Qt library the installation\n" - "path information - no Qt DLL was found." ) -# endif - ); - } - for ( it=qtDlls.begin(); it!=qtDlls.end(); ++it ) { - //### add serial number etc. to log - logFiles( tr("Patching the Qt library %1.").arg(*it) ); - int ret = trDoIt( lib.absFilePath(*it), -# if defined(EVAL) - licensePage->evalName->text().latin1(), - licensePage->evalCompany->text().latin1(), - licensePage->serialNumber->text().latin1(), -# elif defined(EDU) - "", - licensePage->university->text().latin1(), - licensePage->serialNumber->text().latin1(), -# endif - installDir.absPath() - ); - if ( ret != 0 ) { - copySuccessful = false; - QMessageBox::critical( this, - tr( "Error patching Qt library" ), -# if defined(EVAL) - tr( "Could not patch the Qt library with the evaluation\n" - "license information. You will not be able to execute\n" - "any program linked against %1. Error %2" ).arg( *it ).arg(ret) -# elif defined(EDU) - tr( "Could not patch the Qt library with the educational\n" - "edition license information. You will not be able to\n" - "execute any program linked against %1." ).arg( *it ) -# else - tr( "Could not patch the Qt library with the installation\n" - "path information. You will not be able to execute\n" - "some programs linked against %1." ).arg( *it ) -# endif - ); - } - } -# endif -# if !defined(Q_OS_MAC) - // copy lib/*.dll bin/ - QStringList dlls = lib.entryList( "*.dll" ); - for ( it=dlls.begin(); it!=dlls.end(); ++it ) { - copyFile( lib.absFilePath(*it), QDir::cleanDirPath(lib.absFilePath("../bin/"+*it)) ); - } - // delete the non-wanted database drivers - QDir plugins( optionsPage->installPath->text() ); - plugins.cd( "plugins" ); - plugins.cd( "sqldrivers" ); - QDir bin( optionsPage->installPath->text() ); - bin.cd( "bin" ); -#if defined(NON_COMMERCIAL) - if ( sqlitePluginInstall && !sqlitePluginInstall->isOn() ) { - plugins.remove( "qsqlite.dll" ); - } -#else - if ( mysqlPluginInstall && !mysqlPluginInstall->isOn() ) { - plugins.remove( "qsqlmysql.dll" ); - bin.remove( "libmySQL.dll" ); - } - if ( ociPluginInstall && !ociPluginInstall->isOn() ) { - plugins.remove( "qsqloci.dll" ); - } - if ( odbcPluginInstall && !odbcPluginInstall->isOn() ) { - plugins.remove( "qsqlodbc.dll" ); - } - if ( psqlPluginInstall && !psqlPluginInstall->isOn() ) { - plugins.remove( "qsqlpsql.dll" ); - bin.remove( "libpq.dll" ); - } - if ( tdsPluginInstall && !tdsPluginInstall->isOn() ) { - plugins.remove( "qsqltds.dll" ); - } - if ( db2PluginInstall && !db2PluginInstall->isOn() ) { - plugins.remove( "qsqldb2.dll" ); - } -#endif - // patch the .qmake.cache with the correct paths - QFile cacheFile( installDir.filePath(".qmake.cache") ); - if ( cacheFile.open( IO_ReadOnly | IO_Translate ) ) { - QTextStream tsIn( &cacheFile ); - QString cache = tsIn.read(); - cacheFile.close(); - if ( cacheFile.open( IO_WriteOnly | IO_Translate ) ) { - QTextStream tsOut( &cacheFile ); - if ( globalInformation.sysId() == GlobalInformation::Borland ) - tsOut << cache.replace( "C:/QtEvaluation/qtborland", installDir.absPath() ); - else - tsOut << cache.replace( "C:/QtEvaluation/qtmsvc", installDir.absPath() ); - cacheFile.close(); - } - } -# endif -#endif - logFiles( tr("All files have been installed.\n" - "This log has been saved to the installation directory.\n" - "The build will start automatically in 30 seconds."), true ); - } else { - logFiles( tr("One or more errors occurred during file installation.\n" - "Please review the log and try to amend the situation.\n"), true ); - } - } - if ( copySuccessful ) { -#if defined(Q_OS_WIN32) - /* - ** Then record the installation in the registry, and set up the uninstallation - */ - QStringList uninstaller; - uninstaller << ( QString("\"") + shell.windowsFolderName + "\\quninstall.exe" + QString("\"") ); - uninstaller << optionsPage->installPath->text(); - - if( foldersPage->folderGroups->currentItem() == 0 ) - uninstaller << ( QString("\"") + shell.commonProgramsFolderName + QString("\\") + foldersPage->folderPath->text() + QString("\"") ); - else - uninstaller << ( QString("\"") + shell.localProgramsFolderName + QString("\\") + foldersPage->folderPath->text() + QString("\"") ); - - uninstaller << ( QString("\"") + globalInformation.qtVersionStr() + QString("\"") ); - - QEnvironment::recordUninstall( QString( "Qt " ) + globalInformation.qtVersionStr(), uninstaller.join( " " ) ); -#endif - autoContTimer.start( 1000 ); - } - else - emit wizardPageFailed( indexOf(currentPage()) ); - setNextEnabled( progressPage, copySuccessful ); -} - -void SetupWizardImpl::showPageFinish() -{ - autoContTimer.stop(); - nextButton()->setText( "Next >" ); - QString finishMsg; - if ( ( ( !globalInformation.reconfig() && !optionsPage->skipBuild->isChecked() ) - || ( globalInformation.reconfig() && configPage->rebuildInstallation->isChecked() ) ) -#if defined(Q_OS_WIN32) - && qWinVersion() & WV_NT_based ) { -#else - ) { -#endif - if( globalInformation.reconfig() ) { - finishMsg = "Qt has been reconfigured and rebuilt, and is ready for use."; - } else { -#if defined(Q_OS_MAC) - finishMsg = QString( "Qt has been installed to " ) + optionsPage->installPath->text() + - " and is ready to use.\n\nPlease try out the developer tools in the bin folder and example " - "programs in the examples folder.\n\nFor further information please consult the " - "README.txt file included in the installation folder."; -#else - finishMsg = QString( "Qt has been installed to %1 and is ready to use.\n" - "You might have to logoff and logon for changes to the environment to have an effect."). - arg(optionsPage->installPath->text()); -# if defined(QSA) - finishMsg = QString( "\nQSA has been installed to " ) + optionsPageQsa->installPath->text() + " and is ready to use."; -# endif -#endif - } - } else { - if( globalInformation.reconfig() ) { - finishMsg = "The new configuration has been written.\nThe library needs to be rebuilt to activate the "; - finishMsg += "new configuration."; -#if defined(Q_OS_WIN32) - finishMsg += "To rebuild it, use the \"Build Qt "; - finishMsg += globalInformation.qtVersionStr(); - finishMsg += "\" icon in the Qt program group in the start menu."; -#endif - } else { - finishMsg = QString( "The Qt files have been installed to " ) + optionsPage->installPath->text() + " and is ready to be compiled.\n"; -#if defined(Q_OS_WIN32) - if( persistentEnv && qWinVersion() & WV_DOS_based ) { - finishMsg += "The environment variables needed to use Qt have been recorded into your AUTOEXEC.BAT file.\n"; - finishMsg += "Please review this file, and take action as appropriate depending on your operating system to get them into the persistent environment. (Windows Me users, run MsConfig)\n\n"; - } -# if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - finishMsg += QString( "To build the examples and tutorials, use the " - "\"Build the Qt Examples and Tutorials\"" - " icon which has been installed into your Start-Menu." ); -# else - finishMsg += QString( "To build Qt, use the " - "\"Build Qt " ) + globalInformation.qtVersionStr() + "\"" - " icon which has been installed into your Start-Menu."; -# endif -#endif - } - } -#if defined(EVAL_CD) - finishMsg += "\n\n" - "The Trolltech technical support service is available to " - "Qt Professional and Enterprise Edition licensees. As an " - "evaluation user, you can register for 30 days of evaluation " - "support at\n" - "http://qtsoftware.com/products/qt/evaluate.html"; -#endif - finishPage->finishText->setText( finishMsg ); -} - -void SetupWizardImpl::licenseChanged() -{ -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - int ret = trCheckIt( -# if defined(EVAL) - licensePage->evalName->text().latin1(), - licensePage->evalCompany->text().latin1(), - licensePage->serialNumber->text().latin1() -# elif defined(EDU) - "", - licensePage->university->text().latin1(), - licensePage->serialNumber->text().latin1() -# else - "", - "", - "" -# endif - ); - - if ( ret == 0 ) - setNextEnabled( licensePage, true ); - else - setNextEnabled( licensePage, false ); - return; -#else - QDate date; - uint features; - uint testFeature; - QString platformString; - QString licenseKey = licensePage->key->text().stripWhiteSpace(); - if ( licenseKey.length() != 14 ) { - goto rejectLicense; - } - features = featuresForKey( licenseKey.upper() ); - date = decodedExpiryDate( licenseKey.mid(9) ); - if ( !date.isValid() ) { - goto rejectLicense; - } -# if defined(Q_OS_MAC) - testFeature = Feature_Mac; - platformString = "Mac OS X"; -# elif defined(Q_OS_WIN32) - testFeature = Feature_Windows; - platformString = "Windows"; -# else - testFeature = Feature_Unix; - platformString = "UNIX"; -# ifdef Q_CC_GNU -# warning "What about Qtopia Core?" -# endif -# endif - if ( !(features&testFeature) && currentPage() == licensePage ) { - if ( features & (Feature_Unix|Feature_Windows|Feature_Mac|Feature_Embedded) ) { - int ret = QMessageBox::information( this, - tr("No %1 license").arg(platformString), - tr("You are not licensed for the %1 platform.\n" - "Please contact sales@trolltech.com to upgrade\n" - "your license to include the Windows platform.").arg(platformString), - tr("Try again"), - tr("Abort installation") - ); - if ( ret == 1 ) { - QApplication::exit(); - } else { - licensePage->key->setText( "" ); - } - } - goto rejectLicense; - } - if ( date < QDate::currentDate() && currentPage() == licensePage ) { - static bool alreadyShown = false; - if ( !alreadyShown ) { - QMessageBox::warning( this, - tr("Support and upgrade period has expired"), - tr("Your support and upgrade period has expired.\n" - "\n" - "You may continue to use your last licensed release\n" - "of Qt under the terms of your existing license\n" - "agreement. But you are not entitled to technical\n" - "support, nor are you entitled to use any more recent\n" - "Qt releases.\n" - "\n" - "Please contact sales@trolltech.com to renew your\n" - "support and upgrades for this license.") - ); - alreadyShown = true; - } - } - if ( features & Feature_US ) - usLicense = true; - else - usLicense = false; - - licensePage->expiryDate->setText( date.toString( Qt::ISODate ) ); - if( features & Feature_Enterprise ) { - licensePage->productsString->setCurrentItem( 1 ); - emit editionString( "Enterprise Edition" ); - } else { - licensePage->productsString->setCurrentItem( 0 ); - emit editionString( "Professional Edition" ); - } - setNextEnabled( licensePage, true ); - return; - -rejectLicense: - licensePage->expiryDate->setText( "" ); -# if defined(Q_OS_WIN32) - //TODO: Is this a bug? It bus errors on MACX, ask rms. - // it should work -- if it doesn't this seems to be a bug in the MACX code, - // I guess (rms) - licensePage->productsString->setCurrentItem( -1 ); -# endif - emit editionString( "" ); - setNextEnabled( licensePage, false ); - return; -#endif -} - -void SetupWizardImpl::logFiles( const QString& entry, bool close ) -{ - if( !fileLog.isOpen() ) { - fileLog.setName( optionsPage->installPath->text() + QDir::separator() + "install.log" ); - if( !fileLog.open( IO_WriteOnly | IO_Translate ) ) - return; - } - -#if 1 - progressPage->filesDisplay->append(entry); -#else - progressPage->filesDisplay->setText( "Installing files...\n" + entry + "\n" ); -#endif - - static QTextStream outstream; - outstream.setDevice( &fileLog ); - outstream << ( entry + "\n" ); - - if( close ) - fileLog.close(); -} - -void SetupWizardImpl::logOutput( const QString& entry, bool close ) -{ - if( !outputLog.isOpen() ) { - QDir installDir; - if ( optionsPage ) - installDir.setPath( optionsPage->installPath->text() ); - else - installDir.setPath( QEnvironment::getEnv( "QTDIR" ) ); - outputLog.setName( installDir.filePath("build.log") ); - if( !outputLog.open( IO_WriteOnly | IO_Translate ) ) - return; - } - - buildPage->outputDisplay->append(entry); - - static QTextStream outstream; - outstream.setDevice( &outputLog ); - outstream << ( entry + "\n" ); - - if( close ) - outputLog.close(); -} - -void SetupWizardImpl::archiveMsg( const QString& msg ) -{ - if( msg.right( 7 ) == ".cpp..." || msg.right( 5 ) == ".c..." || msg.right( 7 ) == ".pro..." || msg.right( 6 ) == ".ui..." ) - filesToCompile++; - qApp->processEvents(); - if ( msg.startsWith("Expanding") ) - // only show the "Expanding" entries to avoid flickering - logFiles( msg ); -} - -#ifdef Q_WS_WIN -static HANDLE createFile( const QString &entryName, DWORD attr1, DWORD attr2 ) -{ - QT_WA({ - return ::CreateFileW( entryName.ucs2(), attr1, attr2, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - }, { - return ::CreateFileA( entryName.local8Bit(), attr1, attr2, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - }) -} -#endif - -bool SetupWizardImpl::copyFiles( const QString& sourcePath, const QString& destPath, bool topLevel ) -{ - QDir dir( sourcePath ); - const QFileInfoList* list = dir.entryInfoList(); - QFileInfoListIterator it( *list ); - QFileInfo* fi; - bool doCopy; - - while( ( fi = it.current() ) ) { - if( fi->fileName()[ 0 ] != '.' ) { - QString entryName = sourcePath + QDir::separator() + fi->fileName(); - QString targetName = destPath + QDir::separator() + fi->fileName(); - doCopy = true; - if( fi->isDir() ) { - if( !dir.exists( targetName ) ) - createDir( targetName ); - if( topLevel ) { - if ( fi->fileName() == "doc" ) - doCopy = optionsPage->installDocs->isChecked(); - else if ( fi->fileName() == "tools" ) - doCopy = optionsPage->installTools->isChecked(); - else if ( fi->fileName() == "tutorial" ) - doCopy = optionsPage->installTutorials->isChecked(); - else if ( fi->fileName() == "examples" ) - doCopy = optionsPage->installExamples->isChecked(); - } - if( doCopy ) - if( !copyFiles( entryName, targetName, false ) ) - return false; - } else { - if( qApp && isShown() ) { - qApp->processEvents(); - progressPage->operationProgress->setProgress( totalFiles ); - logFiles( targetName ); - } else { - return false; - } - if( entryName.right( 4 ) == ".cpp" || - entryName.right( 2 ) == ".c" || - entryName.right( 4 ) == ".pro" || - entryName.right( 3 ) == ".ui" ) - filesToCompile++; - bool res = true; - if ( !QFile::exists( targetName ) ) - res = copyFile( entryName, targetName ); -#if defined(Q_OS_WIN32) - if ( res ) { - totalFiles++; - HANDLE inFile, outFile; - if( inFile = createFile( entryName, GENERIC_READ, FILE_SHARE_READ ) ){ - if( outFile = createFile( targetName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE ) ){ - FILETIME createTime, accessTime, writeTime; - ::GetFileTime( inFile, &createTime, &accessTime, &writeTime ); - ::SetFileTime( outFile, &createTime, &accessTime, &writeTime ); - ::CloseHandle( outFile ); - } - ::CloseHandle( inFile ); - } - } else { - QString error = QEnvironment::getLastError(); - logFiles( QString( " ERROR: " ) + error + "\n" ); - if( QMessageBox::warning( this, "File copy error", entryName + ": " + error, "Continue", "Cancel", QString(), 0 ) ) - return false; - } -#elif defined( Q_OS_UNIX ) - // ### TODO: keep file date the same, handle errors -#endif - } - } - ++it; - } - return true; -} - -void SetupWizardImpl::setInstallStep( int step ) -{ - QString captionTxt; -#if defined(QSA) - captionTxt = tr("QSA Evaluation Version Installation Wizard"); -#elif defined(EVAL) - captionTxt = tr("Qt Evaluation Version Installation Wizard"); -#elif defined(EDU) - captionTxt = tr("Qt Educational Edition Installation Wizard"); -#elif defined(NON_COMMERCIAL) - captionTxt = tr("Qt Non-Commercial Edition Installation Wizard"); -#else - if( globalInformation.reconfig() ) - captionTxt = tr("Qt Configuration Wizard"); - else - captionTxt = tr("Qt Installation Wizard"); -#endif - setCaption( tr("%1 - Step %2 of %3").arg( captionTxt ).arg( step ).arg( pageCount() ) ); - emit wizardPageShowed( step-1 ); -} - -void SetupWizardImpl::timerFired() -{ - QString tmp( "Next %1 >" ); - - timeCounter--; - - if( timeCounter ) - nextButton()->setText( tmp.arg( timeCounter ) ); - else { - next(); - autoContTimer.stop(); - } -} - -void SetupWizardImpl::readLicense( QString filePath) -{ -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - QFile licenseFile( filePath ); - - if( licenseFile.open( IO_ReadOnly ) ) { - QString buffer; - - while( licenseFile.readLine( buffer, 1024 ) != -1 ) { - if( buffer[ 0 ] != '#' ) { - QStringList components = QStringList::split( '=', buffer ); - QStringList::Iterator it = components.begin(); - QString keyString = (*it++).stripWhiteSpace().replace( QRegExp( QString( "\"" ) ), QString() ).upper(); - QString value = (*it++).stripWhiteSpace().replace( QRegExp( QString( "\"" ) ), QString() ); - - licenseInfo[ keyString ] = value; - } - } - licenseFile.close(); - - if ( licensePage ) { - licensePage->customerID->setText( licenseInfo[ "CUSTOMERID" ] ); - licensePage->licenseID->setText( licenseInfo[ "LICENSEID" ] ); - licensePage->licenseeName->setText( licenseInfo[ "LICENSEE" ] ); - if( licenseInfo[ "PRODUCTS" ] == "qt-enterprise" ) { - licensePage->productsString->setCurrentItem( 1 ); - emit editionString( "Enterprise Edition" ); - } else { - licensePage->productsString->setCurrentItem( 0 ); - emit editionString( "Professional Edition" ); - } - licensePage->expiryDate->setText( licenseInfo[ "EXPIRYDATE" ] ); - licensePage->key->setText( licenseInfo[ "LICENSEKEY" ] ); - } - } -#endif -} - -void SetupWizardImpl::writeLicense( QString filePath ) -{ -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - QFile licenseFile( filePath ); - - if( licenseFile.open( IO_WriteOnly | IO_Translate ) ) { - QTextStream licStream( &licenseFile ); - - licenseInfo[ "CUSTOMERID" ] = licensePage->customerID->text(); - licenseInfo[ "LICENSEID" ] = licensePage->licenseID->text(); - licenseInfo[ "LICENSEE" ] = licensePage->licenseeName->text(); - if( licensePage->productsString->currentItem() == 0 ) { - licenseInfo[ "PRODUCTS" ] = "qt-professional"; - emit editionString( "Professional Edition" ); - } else { - licenseInfo[ "PRODUCTS" ] = "qt-enterprise"; - emit editionString( "Enterprise Edition" ); - } - - licenseInfo[ "EXPIRYDATE" ] = licensePage->expiryDate->text(); - licenseInfo[ "LICENSEKEY" ] = licensePage->key->text(); - - licStream << "# Toolkit license file" << endl; - licStream << "CustomerID=\"" << licenseInfo[ "CUSTOMERID" ].latin1() << "\"" << endl; - licStream << "LicenseID=\"" << licenseInfo[ "LICENSEID" ].latin1() << "\"" << endl; - licStream << "Licensee=\"" << licenseInfo[ "LICENSEE" ].latin1() << "\"" << endl; - licStream << "Products=\"" << licenseInfo[ "PRODUCTS" ].latin1() << "\"" << endl; - licStream << "ExpiryDate=" << licenseInfo[ "EXPIRYDATE" ].latin1() << endl; - licStream << "LicenseKey=" << licenseInfo[ "LICENSEKEY" ].latin1() << endl; - - licenseFile.close(); - } -#endif -} - -void SetupWizardImpl::clickedLicenseFile() -{ - QString licensePath = QFileDialog::getOpenFileName( optionsPage->installPath->text(), QString(), this, NULL, "Browse for license file" ); - - if( !licensePath.isEmpty() ) - readLicense( licensePath ); - -} - -void SetupWizardImpl::readLicenseAgreement() -{ - // Intropage - ResourceLoader *rcLoader; -#if defined(QSA) - LicenseAgreementPageImpl *lap; - if ( currentPage() == licenseAgreementPageQsa ) { - lap = licenseAgreementPageQsa; - rcLoader = new ResourceLoader( "LICENSE_QSA" ); - } else { - lap = licenseAgreementPage; - rcLoader = new ResourceLoader( "LICENSE" ); - } -#elif defined(EVAL) || defined(EDU) - LicenseAgreementPageImpl *lap = licenseAgreementPage; - rcLoader = new ResourceLoader( "LICENSE" ); -#elif defined(NON_COMMERCIAL) - LicenseAgreementPageImpl *lap = licenseAgreementPage; - if ( lap->countryCombo->currentItem() == 0 ) - rcLoader = new ResourceLoader( "LICENSE-US" ); - else - rcLoader = new ResourceLoader( "LICENSE" ); -#else - LicenseAgreementPageImpl *lap = licenseAgreementPage; - if ( usLicense ) { - rcLoader = new ResourceLoader( "LICENSE-US" ); - } else { - rcLoader = new ResourceLoader( "LICENSE" ); - } -#endif - if ( rcLoader->isValid() ) { - lap->introText->setText( rcLoader->data() ); - lap->acceptLicense->setEnabled( true ); - } else { - emit wizardPageFailed( indexOf(currentPage()) ); - QMessageBox::critical( this, tr("Package corrupted"), - tr("Could not find the LICENSE file in the package.\nThe package might be corrupted.") ); - lap->acceptLicense->setEnabled( false ); - } - delete rcLoader; -} - -void SetupWizardImpl::accept() -{ -#if defined(Q_OS_WIN32) - if ( finishPage->showReadmeCheck->isChecked() ) { - QProcess proc( QString("notepad.exe") ); -#if defined(QSA) - QString qsaDir = optionsPageQsa->installPath->text(); - proc.addArgument( qsaDir + "\\README" ); -#else - QString qtDir = QEnvironment::getEnv( "QTDIR" ); - proc.addArgument( qtDir + "\\README" ); -#endif - proc.start(); - } -#endif - QDialog::accept(); -} diff --git a/util/install/win/setupwizardimpl.h b/util/install/win/setupwizardimpl.h deleted file mode 100644 index 1c86f74..0000000 --- a/util/install/win/setupwizardimpl.h +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SETUPWIZARDIMPL_H -#define SETUPWIZARDIMPL_H - -#include "pages/pages.h" -#include "shell.h" - -#include <qprocess.h> -#include <qtimer.h> -#include <qmap.h> -#include <qptrdict.h> -#include <qwizard.h> -#include <qlistview.h> - -class QCheckListItem; -class QListView; - -class CheckListItem : public QCheckListItem -{ -public: - CheckListItem(QListView *listview, const QString &text, Type = RadioButtonController); - CheckListItem(QCheckListItem *parent, const QString &text, Type = RadioButtonController); - - void setHelpText(const QString &help, QTextView *display); - void setWarningText(const QString &warning, CheckListItem *conflict = 0); - void addRequiredFiles(const QString &file); - void setRequiredFileLocation(const QString &location); - - void setOpen(bool on); - void setOn(bool on); - void setCritical(bool on); - - int rtti() const; - static int RTTI; - - void displayHelp(); - bool verify() const; - - void paintCell( QPainter *, const QColorGroup & cg, int column, int width, int alignment ); - -protected: - bool testAndWarn(); - void activate(); - -private: - QString help_text; - QString warning_text; - QTextView *help_display; - QStringList required_files; - QString file_location; - CheckListItem *conflict_with; - bool critical; -}; - -class SetupWizardImpl : public QWizard -{ - Q_OBJECT -public: - SetupWizardImpl( QWidget* parent = 0, const char* name = NULL, bool modal = false, WindowFlags f = 0 ); - - void showPage( QWidget* ); - void stopProcesses(); - - void optionClicked( CheckListItem * ); - -signals: - void wizardPages( const QPtrList<Page>& ); - void wizardPageShowed( int ); - void wizardPageFailed( int ); - void editionString( const QString& ); - -private: - int totalFiles; - QProcess configure; - QProcess make; - QProcess cleaner; -#if defined(QSA) - QProcess assistant; -#endif - - QString programsFolder; - QString devSysFolder; - QString tmpPath; - - WinShell shell; - - void saveSettings(); - void saveSet( QListView* list ); - -protected slots: - void accept(); // reimplemented from QDialog - -private slots: - void clickedSystem( int ); - void sysOtherComboChanged( int ); - void clickedFolderPath(); - void clickedDevSysPath(); - void clickedLicenseFile(); - void cleanDone(); - void configDone(); - void makeDone(); - void assistantDone(); - void restartBuild(); - void readConfigureOutput(); - void readConfigureError(); - void readCleanerOutput(); - void readCleanerError(); - void readMakeOutput(); - void readMakeError(); - void readAssistantOutput(); - void readAssistantError(); - void timerFired(); - void configPageChanged(); - void archiveMsg(const QString &); - void licenseChanged(); - bool verifyConfig(); - -private: - void showPageLicense(); - void showPageOptions(); - void showPageFolders(); - void showPageConfig(); - void showPageProgress(); - void showPageBuild(); - void showPageFinish(); - - void initPages(); - void initConnections(); - - void fixEnvironment(const QString &var, const QString &file = QString()); - void prepareEnvironment(); - - void makeDone( bool error ); - - void setStaticEnabled( bool se ); - void setJpegDirect( bool jd ); - void readLicenseAgreement(); - - bool copyFiles( const QString& sourcePath, const QString& destPath, bool topLevel ); - int totalRead; - - QString buildQtShortcutText; - bool fixedPath; - bool filesCopied; - bool persistentEnv; - int filesToCompile; - int filesCompiled; -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - bool usLicense; -#endif - - QString currentOLine; - QString currentELine; - - void updateDisplay(const QString &input, QString &output); -#if defined(Q_OS_WIN32) - void installIcons( const QString& iconFolder, const QString& dirName, bool common ); -#endif - void doIDEIntegration(); - void doStartMenuIntegration(); - void logFiles( const QString& entry, bool close = false ); - void logOutput( const QString& entry, bool close = false ); - - void setInstallStep( int step ); - void readLicense( QString filePath ); - void writeLicense( QString filePath ); - - QFile fileLog; - QFile outputLog; - QMap<QString,QString> licenseInfo; - QTimer autoContTimer; - int timeCounter; - QStringList allModules; - - CheckListItem *accOn, *accOff; - CheckListItem *bigCodecsOn, *bigCodecsOff; - CheckListItem *tabletOn, *tabletOff; - CheckListItem *advancedSTL, *advancedExceptions, *advancedRTTI; - - CheckListItem /* *mngPresent, */ *mngDirect, *mngPlugin, *mngOff; - CheckListItem /* *jpegPresent, */ *jpegDirect, *jpegPlugin, *jpegOff; - CheckListItem /* *pngPresent, */ *pngDirect, *pngPlugin, *pngOff; - CheckListItem *gifDirect, *gifOff; - - CheckListItem *sgiDirect, *sgiPlugin, *sgiOff; - CheckListItem *cdeDirect, *cdePlugin, *cdeOff; - CheckListItem *motifplusDirect, *motifplusPlugin, *motifplusOff; - CheckListItem *platinumDirect, *platinumPlugin, *platinumOff; - CheckListItem *motifDirect, *motifPlugin, *motifOff; - CheckListItem *xpDirect, *xpPlugin, *xpOff; - - CheckListItem *mysqlDirect, *mysqlPlugin, *mysqlOff; - CheckListItem *ociDirect, *ociPlugin, *ociOff; - CheckListItem *odbcDirect, *odbcPlugin, *odbcOff; - CheckListItem *psqlDirect, *psqlPlugin, *psqlOff; - CheckListItem *tdsDirect, *tdsPlugin, *tdsOff; - CheckListItem *db2Direct, *db2Plugin, *db2Off; - CheckListItem *sqliteDirect, *sqlitePlugin, *sqliteOff; - CheckListItem *ibaseDirect, *ibasePlugin, *ibaseOff; - - CheckListItem *zlibDirect, *zlibSystem, *zlibOff; - - CheckListItem *dspOff, *dspOn; - CheckListItem *vcprojOff, *vcprojOn; - - CheckListItem *staticItem; - -#if defined(EVAL) || defined(EDU) - CheckListItem *mysqlPluginInstall; - CheckListItem *ociPluginInstall; - CheckListItem *odbcPluginInstall; - CheckListItem *psqlPluginInstall; - CheckListItem *tdsPluginInstall; - CheckListItem *db2PluginInstall; - CheckListItem *sqlitePluginInstall; - CheckListItem *ibasePluginInstall; -#elif defined(NON_COMMERCIAL) - CheckListItem *sqlitePluginInstall; -#endif - - // wizard pages - LicenseAgreementPageImpl *licenseAgreementPage; - LicenseAgreementPageImpl *licenseAgreementPageQsa; - LicensePageImpl *licensePage; - OptionsPageImpl *optionsPage; - OptionsPageImpl *optionsPageQsa; - FoldersPageImpl *foldersPage; - ConfigPageImpl *configPage; - ProgressPageImpl *progressPage; - BuildPageImpl *buildPage; - FinishPageImpl *finishPage; -#if defined(Q_OS_WIN32) - WinIntroPageImpl *winIntroPage; -#endif -}; - -#endif diff --git a/util/install/win/setupwizardimpl_config.cpp b/util/install/win/setupwizardimpl_config.cpp deleted file mode 100644 index a5959fb..0000000 --- a/util/install/win/setupwizardimpl_config.cpp +++ /dev/null @@ -1,1564 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "setupwizardimpl.h" -#include "environment.h" -#include <qfiledialog.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qprogressbar.h> -#include <qtextview.h> -#include <qmultilineedit.h> -#include <qbuttongroup.h> -#include <qsettings.h> -#include <qlistview.h> -#include <qlistbox.h> -#include <qapplication.h> -#include <qcheckbox.h> -#include <qtextstream.h> -#include <qpushbutton.h> -#include <qcombobox.h> -#include <qmessagebox.h> -#include <qregexp.h> -#include <qtabwidget.h> -#include <qarchive.h> -#include <qvalidator.h> -#include <qdatetime.h> -#include <qpainter.h> - -bool findFile(const QString &); - -CheckListItem::CheckListItem(QListView *listview, const QString &text, Type type) -: QCheckListItem(listview, text, type), help_display(0), conflict_with(0), critical(false) -{ - if (type == RadioButtonController || type == CheckBoxController) - setOpen(true); -} - -CheckListItem::CheckListItem(QCheckListItem *parent, const QString &text, Type type) -: QCheckListItem(parent, text, type), help_display(0), conflict_with(0), critical(false) -{ - if (type == RadioButtonController || type == CheckBoxController) - setOpen(true); -} - -int CheckListItem::RTTI = 666; - -int CheckListItem::rtti() const -{ - return RTTI; -} - -void CheckListItem::setHelpText(const QString &help, QTextView *display) -{ - help_text = help; - help_display = display; -} - -void CheckListItem::setWarningText(const QString &warning, CheckListItem *conflict) -{ - conflict_with = conflict; - warning_text = warning; -} - -void CheckListItem::addRequiredFiles(const QString &file) -{ - QStringList files = QStringList::split(",", file); - for (QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { - QString f(*it); - required_files << f; - if (!findFile(f)) { - if (type() == QCheckListItem::RadioButtonController - || type() == QCheckListItem::CheckBoxController) { - setOpen(false); - } else { - setOn(false); - setEnabled(false); - } - } - } -} - -void CheckListItem::setRequiredFileLocation(const QString &location) -{ - file_location = location; -} - -bool CheckListItem::verify() const -{ - if (text(0) == "Off") - return true; - - if (!required_files.count()) { - if (parent() && parent()->rtti() == RTTI) - return ((CheckListItem*)parent())->verify(); - return true; - } - - QStringList::ConstIterator it; - for (it = required_files.begin(); it != required_files.end(); ++it) { - QString file(*it); - if (!findFile(file)) - return false; - } - return true; -} - -bool CheckListItem::testAndWarn() -{ - if (!warning_text.isEmpty()) { - if (!conflict_with || conflict_with->isOn()) { - int r = QMessageBox::warning(listView()->window(), "Warning", - warning_text + "<br>Select anyway?", "Yes", "No" ); - return r == 0; - } else { - return true; - } - } - - QStringList files(required_files); - if (!required_files.count() && text(0) != "Off") { - if (parent() && parent()->rtti() == RTTI) - return ((CheckListItem*)parent())->testAndWarn(); - return true; - } - - if (!verify()) { - QString message = QString("<p>The option '%1' is <b>not verified</b> by the installer. One or more of the following " - "files could not be located on the system:" - "<p>%2" - "<p>Continuing with this option selected might <b>break the installation</b> process.") - .arg(text(0)).arg(required_files.join(", ")); - if (!file_location.isEmpty()) { - message += QString("<p>The requested files are %1 and need to be installed " - "in the INCLUDE, PATH and LIBS environment as appropriate.").arg(file_location); - } - - int r = QMessageBox::warning(listView()->window(), "Option not Verified", - message + "<p>Select anyway?", "Yes", "No" ); - return r == 0; - } - return true; -} - -void CheckListItem::displayHelp() -{ - if (help_display) { - help_display->setText(help_text); - return; - } - QListViewItem *p = parent(); - if (p && p->rtti() == RTTI) - ((CheckListItem*)p)->displayHelp(); -} - -void CheckListItem::setOn(bool on) -{ - if (on && (type() == RadioButton || type() == CheckBox) && !testAndWarn()) - return; - QCheckListItem::setOn(on); - - SetupWizardImpl* wizard = qobject_cast<SetupWizardImpl*>(listView()->window()); - if (wizard && listView()->isVisible() && listView()->updatesEnabled()) - wizard->optionClicked(this); -} - -void CheckListItem::activate() -{ - displayHelp(); - QCheckListItem::activate(); -} - -void CheckListItem::setOpen(bool on) -{ - if (on && listView()->isVisible()) { - if (!testAndWarn()) - return; - displayHelp(); - } - QCheckListItem::setOpen(on); -} - -void CheckListItem::setCritical(bool on) -{ - if (critical == on) - return; - - critical = on; - repaint(); -} - -void CheckListItem::paintCell( QPainter *p, const QColorGroup & cg, int column, int width, int alignment ) -{ - QColorGroup group(cg); - if (critical) - group.setColor(QColorGroup::Text, red); - QCheckListItem::paintCell(p, group, column, width, alignment); -} - - - -void SetupWizardImpl::setStaticEnabled( bool se ) -{ - bool enterprise = licenseInfo[ "PRODUCTS" ] == "qt-enterprise"; - if ( se ) { - if ( accOn->isOn() ) { - accOn->setOn( false ); - accOff->setOn( true ); - } - if ( bigCodecsOff->isOn() ) { - bigCodecsOn->setOn( true ); - bigCodecsOff->setOn( false ); - } - if ( mngPlugin->isOn() ) { - mngDirect->setOn( true ); - mngPlugin->setOn( false ); - mngOff->setOn( false ); - } - if ( pngPlugin->isOn() ) { - pngDirect->setOn( true ); - pngPlugin->setOn( false ); - pngOff->setOn( false ); - } - if ( jpegPlugin->isOn() ) { - jpegDirect->setOn( true ); - jpegPlugin->setOn( false ); - jpegOff->setOn( false ); - } - if ( sgiPlugin->isOn() ) { - sgiPlugin->setOn( false ); - sgiDirect->setOn( true ); - } - if ( cdePlugin->isOn() ) { - cdePlugin->setOn( false ); - cdeDirect->setOn( true ); - } - if ( motifplusPlugin->isOn() ) { - motifplusPlugin->setOn( false ); - motifplusDirect->setOn( true ); - } - if ( motifPlugin->isOn() ) { - motifPlugin->setOn( false ); - motifDirect->setOn( true ); - } - if ( platinumPlugin->isOn() ) { - platinumPlugin->setOn( false ); - platinumDirect->setOn( true ); - } - if ( xpPlugin->isOn() ) { - xpPlugin->setOn( false ); - xpOff->setOn( true ); - } - if ( enterprise ) { - if ( mysqlPlugin->isOn() ) { - mysqlPlugin->setOn( false ); - mysqlDirect->setOn( true ); - } - if ( ociPlugin->isOn() ) { - ociPlugin->setOn( false ); - ociDirect->setOn( true ); - } - if ( odbcPlugin->isOn() ) { - odbcPlugin->setOn( false ); - odbcDirect->setOn( true ); - } - if ( psqlPlugin->isOn() ) { - psqlPlugin->setOn( false ); - psqlDirect->setOn( true ); - } - if ( tdsPlugin->isOn() ) { - tdsPlugin->setOn( false ); - tdsDirect->setOn( true ); - } - if ( db2Plugin->isOn() ) { - db2Plugin->setOn( false ); - db2Direct->setOn( true ); - } - if ( sqlitePlugin->isOn() ) { - sqlitePlugin->setOn( false ); - sqliteDirect->setOn( true ); - } - if ( ibasePlugin->isOn() ) { - ibasePlugin->setOn( false ); - ibaseDirect->setOn( true ); - } - } - accOn->setEnabled( false ); - bigCodecsOff->setEnabled( false ); - mngPlugin->setEnabled( false ); - pngPlugin->setEnabled( false ); - jpegPlugin->setEnabled( false ); - sgiPlugin->setEnabled( false ); - cdePlugin->setEnabled( false ); - motifPlugin->setEnabled( false ); - motifplusPlugin->setEnabled( false ); - motifPlugin->setEnabled( false ); - platinumPlugin->setEnabled( false ); - xpPlugin->setEnabled( false ); - if ( enterprise ) { - mysqlPlugin->setEnabled( false ); - ociPlugin->setEnabled( false ); - odbcPlugin->setEnabled( false ); - psqlPlugin->setEnabled( false ); - tdsPlugin->setEnabled( false ); - db2Plugin->setEnabled( false ); - sqlitePlugin->setEnabled( false ); - ibasePlugin->setEnabled( false ); - } - } else { - accOn->setEnabled( true ); - bigCodecsOff->setEnabled( true ); - mngPlugin->setEnabled( true ); - pngPlugin->setEnabled( true ); - jpegPlugin->setEnabled( true ); - sgiPlugin->setEnabled( true ); - cdePlugin->setEnabled( true ); - motifplusPlugin->setEnabled( true ); - motifPlugin->setEnabled( true ); - platinumPlugin->setEnabled( true ); - xpPlugin->setEnabled( true ); - if ( enterprise ) { - mysqlPlugin->setEnabled( true ); - ociPlugin->setEnabled( true ); - odbcPlugin->setEnabled( true ); - psqlPlugin->setEnabled( true ); - tdsPlugin->setEnabled( true ); - db2Plugin->setEnabled( true ); - sqlitePlugin->setEnabled( true ); - ibasePlugin->setEnabled( true ); - } - } - setJpegDirect( mngDirect->isOn() ); -} - -void SetupWizardImpl::setJpegDirect( bool jd ) -{ - // direct MNG support requires also direct JPEG support - if ( jd ) { - jpegOff->setOn( false ); - jpegPlugin->setOn( false ); - jpegDirect->setOn( true ); - - jpegOff->setEnabled( false ); - jpegPlugin->setEnabled( false ); - jpegDirect->setEnabled( true ); - } else { - jpegOff->setEnabled( true ); - if ( !staticItem->isOn() ) - jpegPlugin->setEnabled( true ); - jpegDirect->setEnabled( true ); - } -} - -void SetupWizardImpl::optionClicked( CheckListItem *item ) -{ - if ( !item || item->type() != CheckListItem::RadioButton ) - return; - - if ( item->text(0) == "Static" && item->isOn() ) { - setStaticEnabled( true ); - return; - } else if ( item->text( 0 ) == "Shared" && item->isOn() ) { - setStaticEnabled( false ); - return; - } else if ( item==mngDirect || item==mngPlugin || item==mngOff ) { - setJpegDirect( mngDirect->isOn() ); - } else if ( item==db2Direct && odbcDirect->isOn() ) { - if ( odbcPlugin->isEnabled() ) - odbcPlugin->QCheckListItem::setOn(true); - else - odbcOff->QCheckListItem::setOn(true); - } else if ( item==odbcDirect && db2Direct->isOn() ) { - if ( db2Plugin->isEnabled() ) - db2Plugin->QCheckListItem::setOn(true); - else - db2Off->QCheckListItem::setOn(true); - } -} - - -void SetupWizardImpl::configPageChanged() -{ - if ( configPage->configList->isVisible() ) { - configPage->configList->setSelected( configPage->configList->currentItem(), true ); - } else if ( configPage->advancedList->isVisible() ) { - configPage->advancedList->setSelected( configPage->advancedList->currentItem(), true ); - } -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - else if ( configPage->installList->isVisible() ) { - configPage->installList->setSelected( configPage->installList->currentItem(), true ); - } -#endif -} - -void SetupWizardImpl::cleanDone() -{ -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - prepareEnvironment(); -# if defined(Q_OS_WIN32) - QString qtdir = QEnvironment::getEnv( "QTDIR" ); - - // adjust the .qmake.cache - QFile qmakeCache( qtdir + "/.qmake.cache" ); - if ( qmakeCache.open( IO_ReadOnly ) ) { - QString content = qmakeCache.readAll(); - qmakeCache.close(); - if ( globalInformation.sysId() == GlobalInformation::Borland ) - content.replace( "C:\\QtEvaluation\\qtborland", qtdir ); - else - content.replace( "C:\\QtEvaluation\\qtmsvc", qtdir ); - - if ( qmakeCache.open( IO_WriteOnly ) ) { - QTextStream ts( &qmakeCache ); - ts << content; - qmakeCache.close(); - } else { - logOutput( QString("Warning: can't open the .qmake.cache file for writing: %1\n").arg( qmakeCache.errorString() ) ); - } - } else { - logOutput( QString("Warning: can't open the .qmake.cache file for reading: %1\n").arg( qmakeCache.errorString() ) ); - } - - QStringList args; - args << ( qtdir + "\\bin\\configure.exe" ); - args << "-spec"; - args << globalInformation.text(GlobalInformation::Mkspec); - if ( globalInformation.sysId() == GlobalInformation::MSVC ) - args << "-dsp"; - else if ( globalInformation.sysId() == GlobalInformation::MSVCNET ) - args << "-vcproj"; - - if( qWinVersion() & WV_NT_based ) { - logOutput( "Execute configure...\n" ); - logOutput( args.join( " " ) + "\n" ); - - configure.setWorkingDirectory( qtdir ); - configure.setArguments( args ); - // Start the configure process - buildPage->compileProgress->setTotalSteps( int(double(filesToCompile) * 2.6) ); - buildPage->restartBuild->setText( "Stop configure" ); - buildPage->restartBuild->setEnabled( true ); - buildPage->restartBuild->show(); - buildPage->compileProgress->show(); - if( !configure.start() ) { - logOutput( "Could not start configure process" ); - emit wizardPageFailed( indexOf(currentPage()) ); - } - } else { // no proper process handling on DOS based systems - create a batch file instead - logOutput( "Generating batch file...\n" ); - QDir installDir; - if ( optionsPage ) - installDir.setPath( optionsPage->installPath->text() ); - else - installDir.setPath( qtdir ); - QFile outFile( installDir.filePath("build.bat") ); - QTextStream outStream( &outFile ); - - if( outFile.open( IO_WriteOnly | IO_Translate ) ) { - if ( installDir.absPath()[1] == ':' ) - outStream << installDir.absPath().left(2) << endl; - outStream << "cd %QTDIR%" << endl; - outStream << args.join( " " ) << endl; - if( !globalInformation.reconfig() ) { - outStream << globalInformation.text(GlobalInformation::MakeTool) << endl; - } - outFile.close(); - } - logOutput( "Doing the final integration steps..." ); - doIDEIntegration(); - buildPage->compileProgress->setTotalSteps( buildPage->compileProgress->totalSteps() ); - showPage( finishPage ); - } -# elif defined(Q_OS_UNIX) - buildPage->compileProgress->show(); - buildPage->restartBuild->show(); - - buildPage->compileProgress->setProgress( 0 ); - buildPage->compileProgress->setTotalSteps( int(double(filesToCompile) * 1.8) ); - configDone(); -# endif -#else - QStringList args; - QStringList entries; - QSettings settings; - QString entry; - QStringList::Iterator it; - QFile tmpFile; - QTextStream tmpStream; - bool settingsOK; - -# if defined(Q_OS_WIN32) - args << ( QEnvironment::getEnv( "QTDIR" ) + "\\bin\\configure.exe" ); -# elif defined(Q_OS_UNIX) - args << ( QEnvironment::getEnv( "QTDIR" ) + QDir::separator() + "configure" ); -# endif - - entry = settings.readEntry( "/Trolltech/Qt/Build", "Debug", &settingsOK ); - if ( entry == "Debug" ) - args += "-debug"; - else - args += "-release"; - - entry = settings.readEntry( "/Trolltech/Qt/Library", "Shared", &settingsOK ); - if ( entry == "Static" ) - args += "-static"; - else - args += "-shared"; - - entry = settings.readEntry( "/Trolltech/Qt/Threading", QString(), &settingsOK ); - if ( entry == "Threaded" ) - args += "-thread"; - else - args += "-no-thread"; - - entries = settings.readListEntry( "/Trolltech/Qt/Modules", ',', &settingsOK ); - for( it = allModules.begin(); it != allModules.end(); ++it ) { - entry = *it; - if ( entries.find( entry ) != entries.end() ) - args += QString( "-enable-" ) + entry; - else - args += QString( "-disable-") + entry; - } - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/MySQL", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-mysql"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-mysql"; - else if ( entry == "Off" ) - args += "-no-sql-mysql"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/OCI", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-oci"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-oci"; - else if ( entry == "Off" ) - args += "-no-sql-oci"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/ODBC", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-odbc"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-odbc"; - else if ( entry == "Off" ) - args += "-no-sql-odbc"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/PostgreSQL", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-psql"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-psql"; - else if ( entry == "Off" ) - args += "-no-sql-psql"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/TDS", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-tds"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-tds"; - else if ( entry == "Off" ) - args += "-no-sql-tds"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/DB2", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-db2"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-db2"; - else if ( entry == "Off" ) - args += "-no-sql-db2"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/SQLite", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-sqlite"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-sqlite"; - else if ( entry == "Off" ) - args += "-no-sql-sqlite"; - - entry = settings.readEntry( "/Trolltech/Qt/SQL Drivers/iBase", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-sql-ibase"; - else if ( entry == "Plugin" ) - args += "-plugin-sql-ibase"; - else if ( entry == "Off" ) - args += "-no-sql-ibase"; - -# if defined(Q_OS_WIN32) -//TODO: Win only, remove these options from wizard on mac? - entry = settings.readEntry( "/Trolltech/Qt/Accessibility", "On", &settingsOK ); - if ( entry == "On" ) - args += "-accessibility"; - else - args += "-no-accessibility"; -# endif - - entry = settings.readEntry( "/Trolltech/Qt/Big Textcodecs", "On", &settingsOK ); - if ( entry == "On" ) - args += "-big-codecs"; - else - args += "-no-big-codecs"; - - entry = settings.readEntry( "/Trolltech/Qt/Tablet Support", "Off", &settingsOK ); - if ( entry == "On" ) - args += "-tablet"; - else - args += "-no-tablet"; - - entries = settings.readListEntry( "/Trolltech/Qt/Advanced C++", ',', &settingsOK ); - if ( entries.contains( "STL" ) ) - args += "-stl"; - else - args += "-no-stl"; - if ( entries.contains( "Exceptions" ) ) - args += "-exceptions"; - else - args += "-no-exceptions"; - if ( entries.contains( "RTTI" ) ) - args += "-rtti"; - else - args += "-no-rtti"; - -# if defined(Q_OS_WIN32) -//TODO: Win only, remove these options from wizard on mac? - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/PNG", "Direct", &settingsOK ); - if ( entry == "Plugin" ) - args += "-plugin-imgfmt-png"; - else if ( entry == "Direct" ) - args += "-qt-imgfmt-png"; - else if ( entry == "Off" ) - args += "-no-imgfmt-png"; - args += "-qt-png"; - - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/JPEG", "Direct", &settingsOK ); - if ( entry == "Plugin" ) - args += "-plugin-imgfmt-jpeg"; - else if ( entry == "Direct" ) - args += "-qt-imgfmt-jpeg"; - else if ( entry == "Off" ) - args += "-no-imgfmt-jpeg"; - args += "-qt-jpeg"; - - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/MNG", "Direct", &settingsOK ); - if ( entry == "Plugin" ) - args += "-plugin-imgfmt-mng"; - else if ( entry == "Direct" ) - args += "-qt-imgfmt-mng"; - else if ( entry == "Off" ) - args += "-no-imgfmt-mng"; - args += "-qt-mng"; -# endif - - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/GIF", "Direct", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-gif"; - else if ( entry == "Off" ) - args += "-no-gif"; - -# if defined(Q_OS_WIN32) -//TODO: Win only, remove these options from wizard on mac? - entry = settings.readEntry( "/Trolltech/Qt/Styles/Windows", "Direct", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-windows"; - else if ( entry == "Plugin" ) - args += "-plugin-style-windows"; - else if ( entry == "Off" ) - args += "-no-style-windows"; - - entry = settings.readEntry( "/Trolltech/Qt/Styles/Windows XP", "Off", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-windowsxp"; - else if ( entry == "Plugin" ) - args += "-plugin-style-windowsxp"; - else if ( entry == "Off" ) - args += "-no-style-windowsxp"; - - entry = settings.readEntry( "/Trolltech/Qt/Styles/Motif", "Plugin", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-motif"; - else if ( entry == "Plugin" ) - args += "-plugin-style-motif"; - else if ( entry == "Off" ) - args += "-no-style-motif"; - - entry = settings.readEntry( "/Trolltech/Qt/Styles/Platinum", "Plugin", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-platinum"; - else if ( entry == "Plugin" ) - args += "-plugin-style-platinum"; - else if ( entry == "Off" ) - args += "-no-style-platinum"; - - entry = settings.readEntry( "/Trolltech/Qt/Styles/MotifPlus", "Plugin", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-motifplus"; - else if ( entry == "Plugin" ) - args += "-plugin-style-motifplus"; - else if ( entry == "Off" ) - args += "-no-style-motifplus"; - - entry = settings.readEntry( "/Trolltech/Qt/Styles/CDE", "Plugin", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-cde"; - else if ( entry == "Plugin" ) - args += "-plugin-style-cde"; - else if ( entry == "Off" ) - args += "-no-style-cde"; - - entry = settings.readEntry( "/Trolltech/Qt/Styles/SGI", "Plugin", &settingsOK ); - if ( entry == "Direct" ) - args += "-qt-style-sgi"; - else if ( entry == "Plugin" ) - args += "-plugin-style-sgi"; - else if ( entry == "Off" ) - args += "-no-style-sgi"; -# endif - - if ( globalInformation.sysId() == GlobalInformation::MSVC ) { - entry = settings.readEntry( "/Trolltech/Qt/DSP Generation", "On", &settingsOK ); - if ( entry == "On" ) - args += "-dsp"; - else if ( entry == "Off" ) - args += "-no-dsp"; - } else if ( globalInformation.sysId() == GlobalInformation::MSVCNET ) { - entry = settings.readEntry( "/Trolltech/Qt/VCPROJ Generation", "On", &settingsOK ); - if ( entry == "On" ) - args += "-vcproj"; - else if ( entry == "Off" ) - args += "-no-vcproj"; - } else if ( globalInformation.sysId() != GlobalInformation::MSVC && globalInformation.sysId() == GlobalInformation::MSVCNET ) { - args += "-no-dsp"; - args += "-no-vcproj"; - } - - if ( ( ( !globalInformation.reconfig() && !optionsPage->skipBuild->isChecked() ) - || ( globalInformation.reconfig() && configPage->rebuildInstallation->isChecked() ) ) -# if defined(Q_OS_WIN32) - && qWinVersion() & WV_NT_based ) { -# else - ) { -# endif - logOutput( "Execute configure...\n" ); - logOutput( args.join( " " ) + "\n" ); - - configure.setWorkingDirectory( QEnvironment::getEnv( "QTDIR" ) ); - configure.setArguments( args ); - // Start the configure process - buildPage->compileProgress->setTotalSteps( int(double(filesToCompile) * 2.6) ); - buildPage->restartBuild->setText( "Stop configure" ); - buildPage->restartBuild->setEnabled( true ); - buildPage->restartBuild->show(); - buildPage->compileProgress->show(); - if( !configure.start() ) { - logOutput( "Could not start configure process" ); - emit wizardPageFailed( indexOf(currentPage()) ); - } - } else { // no proper process handling on DOS based systems - create a batch file instead - logOutput( "Generating batch file...\n" ); - QDir installDir; - if ( optionsPage ) - installDir.setPath( optionsPage->installPath->text() ); - else - installDir.setPath( QEnvironment::getEnv( "QTDIR" ) ); - QFile outFile( installDir.filePath("build.bat") ); - QTextStream outStream( &outFile ); - - if( outFile.open( IO_WriteOnly | IO_Translate ) ) { - if ( installDir.absPath()[1] == ':' ) - outStream << installDir.absPath().left(2) << endl; - outStream << "cd %QTDIR%" << endl; - - if ( globalInformation.reconfig() ) - outStream << globalInformation.text(GlobalInformation::MakeTool) << " clean" << endl; - - // There is a limitation on Windows 9x regarding the length of the - // command line. So rather use the configure.cache than specifying - // all configure options on the command line. - QFile configureCache( installDir.filePath("configure.cache") ); - if( configureCache.open( IO_WriteOnly | IO_Translate ) ) { - QTextStream confCacheStream( &configureCache ); - QStringList::Iterator it = args.begin(); - ++it; // skip args[0] (configure) - while ( it != args.end() ) { - confCacheStream << *it << endl; - ++it; - } - configureCache.close(); - outStream << args[0] << " -redo" << endl; - } else { - outStream << args.join( " " ) << endl; - } - - outStream << globalInformation.text(GlobalInformation::MakeTool) << endl; - outFile.close(); - } - logOutput( "Doing the final integration steps..." ); - // No need to redo the integration step - if ( !globalInformation.reconfig() ) - doIDEIntegration(); - buildPage->compileProgress->setTotalSteps( buildPage->compileProgress->totalSteps() ); - showPage( finishPage ); - } -#endif -} - -void SetupWizardImpl::prepareEnvironment() -{ - QByteArray pathBuffer; - QStringList path; - QString qtDir; - int envSpec = QEnvironment::LocalEnv; - - if( globalInformation.reconfig() ) { - qtDir = QEnvironment::getEnv( "QTDIR" ); - if ( configPage ) { - configPage->currentInstallation->setText( qtDir ); - } - } - else { - qtDir = QDir::toNativeSeparators( QEnvironment::getFSFileName( optionsPage->installPath->text() ) ); - } - -#if defined(Q_OS_WIN32) - if( qWinVersion() & Qt::WV_NT_based ) { - // under Windows 9x, we don't compile from the installer -- so there is - // no need to set the local environment; and doing so, results in not - // setting the persistent since qtDir\bin is already in the PATH - path = QStringList::split( QRegExp("[;,]"), QEnvironment::getEnv( "PATH" ) ); - if( path.findIndex( qtDir + "\\bin" ) == -1 ) { - path.prepend( qtDir + "\\bin" ); - QEnvironment::putEnv( "PATH", path.join( ";" ) ); - } - } -#elif defined(Q_OS_UNIX) - path = QStringList::split( QRegExp("[:]"), QEnvironment::getEnv( "PATH" ) ); - if( path.findIndex( qtDir + "/bin" ) == -1 ) { - path.prepend( qtDir + "/bin" ); - QEnvironment::putEnv( "PATH", path.join( ":" ) ); - } - QStringList dyld = QStringList::split( QRegExp("[:]"), QEnvironment::getEnv( "DYLD_LIBRARY_PATH" ) ); - if( dyld.findIndex( qtDir + "/lib" ) == -1 ) { - dyld.prepend( qtDir + "/lib" ); - QEnvironment::putEnv( "DYLD_LIBRARY_PATH", dyld.join( ":" ) ); - } -#endif - -#if defined(Q_OS_WIN32) - if( foldersPage && foldersPage->qtDirCheck->isChecked() ) { - envSpec |= QEnvironment::PersistentEnv; -/* - if( folderGroups->currentItem() == 0 ) - envSpec |= QEnvironment::GlobalEnv; -*/ - path.clear(); - - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - path = QStringList::split( ';', QEnvironment::getEnv( "PATH", QEnvironment::PersistentEnv ) ); - if( path.findIndex( qtDir + "\\bin" ) == -1 ) { - path.prepend( qtDir + "\\bin" ); - QEnvironment::putEnv( "PATH", path.join( ";" ), QEnvironment::PersistentEnv ); - } - } else { - if( path.findIndex( qtDir + "\\bin" ) == -1 ) { - QEnvironment::putEnv( "PATH", qtDir + "\\bin;%PATH%", QEnvironment::PersistentEnv ); - } - } - } -#elif defined(Q_OS_UNIX) -//Persistent environment not supported -#endif - - QEnvironment::putEnv( "QTDIR", qtDir, envSpec ); - if ( globalInformation.sysId() != GlobalInformation::Other ) - QEnvironment::putEnv( "QMAKESPEC", globalInformation.text(GlobalInformation::Mkspec), envSpec ); - else - QEnvironment::putEnv( "QMAKESPEC", optionsPage->sysOtherCombo->currentText(), envSpec ); -#if defined(Q_OS_WIN32) - if( qWinVersion() & WV_NT_based ) { - SendNotifyMessageA( HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)"Environment" ); - SendNotifyMessageA( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 ); - } -#endif -} - -void SetupWizardImpl::showPageConfig() -{ - if (autoContTimer.isActive()) { - autoContTimer.stop(); - timeCounter = 30; - nextButton()->setText("Next >"); - } -#if defined(EVAL) || defined(EDU) || defined(NON_COMMERCIAL) - setBackEnabled( buildPage, false ); - - static bool alreadyInitialized = false; - if ( !alreadyInitialized ) { - configPage->installList->setSorting( -1 ); - configPage->installList->setUpdatesEnabled(false); - - CheckListItem *item; - CheckListItem *folder; - - folder = new CheckListItem( configPage->installList, "Database drivers" ); - -#if !defined(NON_COMMERCIAL) -#if !defined(Q_OS_MACX) - item = new CheckListItem( folder, "DB2", QCheckListItem::CheckBox ); - item->addRequiredFiles("db2cli.dll"); - db2PluginInstall = item; - db2PluginInstall->setHelpText( tr( - "Installs the DB2 driver. This driver can " - "be used to access DB2 databases." - "<p><font color=\"red\">Choosing this option requires " - "that the DB2 Client is installed and set up. " - "The driver depends on the db2cli.dll.</font></p>" - ), configPage->explainOption ); - - item = new CheckListItem( folder, "TDS", QCheckListItem::CheckBox ); - item->addRequiredFiles("ntwdblib.dll"); - tdsPluginInstall = item; - tdsPluginInstall->setHelpText( tr( - "Installs the TDS driver to access Sybase Adaptive " - "Server and Microsoft SQL Server (it is recommended " - "to rather use ODBC instead of TDS where applicable). " - "<p><font color=\"red\">Choosing this option requires " - "that the ntwdblib.dll is available.</font></p>" - ), configPage->explainOption ); - - item = new CheckListItem( folder, "Oracle (OCI)", QCheckListItem::CheckBox ); - item->addRequiredFiles( "oci.dll" ); - ociPluginInstall = item; - ociPluginInstall->setHelpText( tr( - "<p>Installs the Oracale Call Interface (OCI) driver.</p> " - "<p><font color=\"red\">Choosing this option requires " - "that the Oracle Client is installed and set up. " - "The driver depends on the oci.dll.</font></p>" - ), configPage->explainOption ); -#endif - - if ( globalInformation.sysId() != GlobalInformation::Borland ) { - // I was not able to make Postgres work with Borland - item = new CheckListItem( folder, "PostgreSQL", QCheckListItem::CheckBox ); -#ifndef Q_OS_MACX - item->addRequiredFiles( "libpq.dll" ); -#endif - item->setOn( item->verify() ); - psqlPluginInstall = item; - psqlPluginInstall->setHelpText( tr( - "Installs the PostgreSQL 7.x driver. This driver can " - "be used to access PostgreSQL 6 databases as well " - "as PostgreSQL 7 databases." -#ifdef Q_OS_MACX - "\n\nRequires a proper PostgreSQL installation." -#endif - ), configPage->explainOption ); - } else { - psqlPluginInstall = 0; - } - - item = new CheckListItem( folder, "MySQL", QCheckListItem::CheckBox ); -#ifndef Q_OS_MACX - item->addRequiredFiles( "libmySQL.dll" ); -#endif - item->setOn( item->verify() ); - mysqlPluginInstall = item; - mysqlPluginInstall->setHelpText( tr( - "Installs the MySQL 3.x database driver." -#ifdef Q_OS_MACX - "\n\nRequires a proper MySQL installation." -#endif - ), configPage->explainOption ); - -#if !defined(Q_OS_MAC) - item = new CheckListItem( folder, "ODBC", QCheckListItem::CheckBox ); - item->setOn( findFile( "odbc32.dll" ) ); - odbcPluginInstall = item; - odbcPluginInstall->setHelpText( tr( - "Installs the Open Database Connectivity (ODBC) driver. " - "This driver depends on the odbc32.dll which should be " - "available on all modern Windows installations." - ), configPage->explainOption ); -#endif -#else - item = new CheckListItem( folder, "SQLite", QCheckListItem::CheckBox ); - item->setOn( true ); - sqlitePluginInstall = item; - sqlitePluginInstall->setHelpText( tr( - "Installs the SQLite driver.\n" - "This driver is an in-process SQL database " - "driver. It is needed for some of the " - "examples used in the book." - ), configPage->explainOption ); -#endif - - configPage->installList->setUpdatesEnabled(true); - alreadyInitialized = true; - } -#else - - prepareEnvironment(); - - bool enterprise = licenseInfo[ "PRODUCTS" ] == "qt-enterprise"; - configPage->configList->setUpdatesEnabled(false); - configPage->advancedList->setUpdatesEnabled(false); - - if( configPage->configList->childCount() ) { - QListViewItem* current = configPage->configList->firstChild(); - - while( current ) { - QListViewItem* next = current->nextSibling(); - delete current; - current = next; - } - - current = configPage->advancedList->firstChild(); - while( current ) { - QListViewItem* next = current->nextSibling(); - delete current; - current = next; - } - } - QSettings settings; - configPage->configList->setSorting( -1 ); - configPage->advancedList->setSorting( -1 ); - CheckListItem *item; - CheckListItem *folder; - QStringList::Iterator it; - - // general - folder = new CheckListItem ( configPage->configList, "Modules" ); - folder->setHelpText(tr("<p>Some of these modules are optional." - "<p>You can deselect the modules that you " - "don't require for your development." - "<p>By default, all modules are selected."), configPage->explainOption); - bool settingsOK; - QStringList entries = settings.readListEntry( "/Trolltech/Qt/Modules", ',', &settingsOK ); - QStringList licensedModules = QStringList::split( " ", "network canvas table xml opengl sql" ); - for( it = licensedModules.begin(); it != licensedModules.end(); ++it ) { - item = new CheckListItem( folder, (*it), QCheckListItem::CheckBox ); - bool on = entries.isEmpty() || entries.find( *it ) != entries.end(); - item->setOn( enterprise && on ); - item->setEnabled( enterprise ); - if ( enterprise ) - allModules << *it; - } - - licensedModules = QStringList::split( " ", "iconview workspace" ); - for( it = licensedModules.begin(); it != licensedModules.end(); ++it ) { - item = new CheckListItem( folder, (*it), QCheckListItem::CheckBox ); - bool on = entries.isEmpty() || entries.find( *it ) != entries.end(); - item->setOn( on ); - allModules << *it; - } - - QStringList requiredModules = QStringList::split( " ", "styles dialogs widgets tools kernel" ); - for( it = requiredModules.begin(); it != requiredModules.end(); ++it ) { - item = new CheckListItem( folder, (*it), QCheckListItem::CheckBox ); - bool on = entries.isEmpty() || entries.find( *it ) != entries.end(); - item->setOn( on ); - item->setEnabled( false ); - allModules << *it; - } - - folder = new CheckListItem ( configPage->configList, "Threading" ); - folder->setHelpText(tr("<p>Build the Qt library with or without thread support." - "<p>By default, threading is supported. Some classes will " - "not be available without thread support."), configPage->explainOption); - QString entry = settings.readEntry( "/Trolltech/Qt/Threading", "Threaded", &settingsOK ); - item = new CheckListItem( folder, "Threaded", QCheckListItem::RadioButton ); - item->setOn( entry == "Threaded" ); - item = new CheckListItem( folder, "Non-threaded", QCheckListItem::RadioButton ); - item->setOn( entry == "Non-threaded" ); - CheckListItem *singleThreaded = item; - - folder = new CheckListItem ( configPage->configList, "Library" ); - folder->setHelpText(tr("<p>Build a shared or a static Qt library." - "<p>A shared Qt library makes it necessary to " - "distribute the Qt DLL together with your software. " - "Applications and libraries linked against a shared Qt library " - "are small and can make use of components and plugins." - "<p>All applications created with a static " - "library will be at least 1.5MB big. " - "<font color=\"red\">It is not possible to " - "build or use any components or plugins with a " - "static Qt library!</font>"), configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Library", "Shared", &settingsOK ); - staticItem = new CheckListItem( folder, "Static", QCheckListItem::RadioButton ); - staticItem->setOn( entry == "Static" ); - staticItem->setWarningText("<p>It will not be possible to build components " - "or plugins if you select the static build of the Qt library." - "<p>New features, e.g souce code editing in Qt Designer, will not " - "be available, and you or users of your software might not be able " - "to use all or new features, e.g. new styles."); - - item = new CheckListItem( folder, "Shared", QCheckListItem::RadioButton ); - item->setOn( entry == "Shared" ); - item->setWarningText("<p>Single-threaded, shared configurations " - "may cause instabilities because of runtime " - "library conflicts.", singleThreaded); - singleThreaded->setWarningText("<p>Single-threaded, shared configurations " - "may cause instabilities because of runtime " - "library conflicts.", item); - - folder = new CheckListItem ( configPage->configList, "Build" ); - folder->setHelpText(tr("<p>Build a Qt library with or without debug symbols." - "<p>Use the debug build of the Qt library to enhance " - "debugging of your application. The release build " - "is both smaller and faster."), configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Build", "Release", &settingsOK ); - item = new CheckListItem( folder, "Debug", QCheckListItem::RadioButton ); - item->setOn( entry == "Debug" ); - item = new CheckListItem( folder, "Release", QCheckListItem::RadioButton ); - item->setOn( entry == "Release" ); - - // Advanced options - if ( globalInformation.sysId() == GlobalInformation::MSVC ) { - entry = settings.readEntry( "/Trolltech/Qt/DSP Generation", "On", &settingsOK ); - folder = new CheckListItem( configPage->advancedList, "DSP Generation" ); - folder->setHelpText(tr("qmake can generate the Visual Studio 6 project files (dsp) as well " - "as makefiles when Qt is being configured."), - configPage->explainOption); - dspOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - dspOff->setOn( entry == "Off" ); - dspOn = new CheckListItem( folder, "On", QCheckListItem::RadioButton ); - dspOn->setOn( entry == "On" ); - } else if ( globalInformation.sysId() == GlobalInformation::MSVCNET ) { - entry = settings.readEntry( "/Trolltech/Qt/VCPROJ Generation", "On", &settingsOK ); - folder = new CheckListItem( configPage->advancedList, "VCPROJ Generation" ); - folder->setHelpText(tr("qmake can generate the Visual Studio.NET project files (vcproj) as well " - "as makefiles when Qt is being configured."), - configPage->explainOption); - vcprojOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - vcprojOff->setOn( entry == "Off" ); - vcprojOn = new CheckListItem( folder, "On", QCheckListItem::RadioButton ); - vcprojOn->setOn( entry == "On" ); - } - - CheckListItem *imfolder = new CheckListItem( configPage->advancedList, "Image Formats" ); - imfolder->setHelpText(tr("<p>Qt ships with support for a wide range of common image formats. " - "<p>Standard formats are always included in Qt, and some more special formats " - "can be left out from the Qt library itself and provided by a plugin instead."), - configPage->explainOption); - - folder = new CheckListItem( imfolder, "GIF" ); - folder->setHelpText(tr("<p>Support for GIF images in Qt." - "<p><font color=\"red\">If you are in a country " - "which recognizes software patents and in which " - "Unisys holds a patent on LZW compression and/or " - "decompression and you want to use GIF, Unisys " - "may require you to license the technology. Such " - "countries include Canada, Japan, the USA, " - "France, Germany, Italy and the UK.</font>"), - configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/GIF", "Off", &settingsOK ); - gifOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - gifOff->setOn( entry == "Off" ); - gifDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - gifDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( imfolder, "MNG" ); - folder->setHelpText(tr("<p>Qt can support the \"Multiple-Image Network Graphics\" format." - "<p>MNG support can be compiled into Qt, provided by a plugin ", - "or turned off completely."), - configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/MNG", "Plugin", &settingsOK ); -#if 0 - // ### disable using system MNG for now -- please someone take a closer look - entryPresent = settings.readEntry( "/Trolltech/Qt/Image Formats/MNG Present", "No", &settingsOK ); - mngPresent = new CheckListItem( folder, "Present", QCheckListItem::CheckBox ); - mngPresent->setOn( entry == "Yes" ); -#endif - mngOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - mngOff->setOn( entry == "Off" ); - mngPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - mngPlugin->setOn( entry == "Plugin" ); - mngDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - mngDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( imfolder, "JPEG" ); - folder->setHelpText(tr("<p>Qt can support the \"Joint Photographic Experts Group\" format." - "<p>JPEG support can be compiled into Qt, provided by a plugin ", - "or turned off completely."), - configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/JPEG", "Direct", &settingsOK ); -#if 0 - // ### disable using system JPEG for now -- please someone take a closer look - entryPresent = settings.readEntry( "/Trolltech/Qt/Image Formats/JPEG Present", "No", &settingsOK ); - jpegPresent = new CheckListItem( folder, "Present", QCheckListItem::CheckBox ); - jpegPresent->setOn( entry == "Yes" ); -#endif - jpegOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - jpegOff->setOn( entry == "Off" ); - jpegPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - jpegPlugin->setOn( entry == "Plugin" ); - jpegDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - jpegDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( imfolder, "PNG" ); - folder->setHelpText(tr("<p>Qt can support the \"Portable Network Graphics\" format." - "<p>PNG support can be compiled into Qt, provided by a plugin ", - "or turned off completely."), - configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Image Formats/PNG", "Direct", &settingsOK ); -#if 0 - // ### disable using system PNG for now -- please someone take a closer look - entryPresent = settings.readEntry( "/Trolltech/Qt/Image Formats/PNG Present", "No", &settingsOK ); - pngPresent = new CheckListItem( folder, "Present", QCheckListItem::CheckBox ); - pngPresent->setOn( entry == "Yes" ); -#endif - pngOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - pngOff->setOn( entry == "Off" ); - // PNG is required by the build system (ie. we use PNG), so don't allow it to be turned off - pngOff->setEnabled( false ); - pngPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - pngPlugin->setOn( entry == "Plugin" ); - pngDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - pngDirect->setOn( entry == "Direct" ); - - CheckListItem *sqlfolder = new CheckListItem( configPage->advancedList, "Sql Drivers" ); - sqlfolder->setHelpText(tr("<p>Select the SQL Drivers you want to support." - "<p>SQL Drivers can be built into Qt or built as plugins to be more flexible " - "for later extensions." - "<p><font color=#FF0000>You must have the appropriate client libraries " - "and header files installed correctly before you can build the Qt SQL drivers.</font>"), - configPage->explainOption); - - folder = new CheckListItem( sqlfolder, "iBase" ); - folder->addRequiredFiles("ibase.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/iBase", "Off", &settingsOK ); - ibaseOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - ibaseOff->setOn( true ); - ibaseOff->setEnabled( enterprise ); - ibasePlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - ibasePlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - ibasePlugin->setEnabled( enterprise ); - ibaseDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - ibaseDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - ibaseDirect->setEnabled( enterprise ); - if (globalInformation.sysId() == GlobalInformation::Borland) - folder->addRequiredFiles("gds32.lib"); - else - folder->addRequiredFiles("gds32_ms.lib"); - - folder = new CheckListItem( sqlfolder, "DB2" ); - folder->addRequiredFiles("db2cli.lib,sqlcli1.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/DB2", "Off", &settingsOK ); - db2Off = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - db2Off->setOn( true ); - db2Off->setEnabled( enterprise ); - db2Plugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - db2Plugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - db2Plugin->setEnabled( enterprise ); - db2Direct = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - db2Direct->setOn( entry == "Direct" && folder->verify() && enterprise ); - db2Direct->setEnabled( enterprise ); - - folder = new CheckListItem( sqlfolder, "TDS" ); - folder->addRequiredFiles("ntwdblib.lib,sqldb.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/TDS", "Off", &settingsOK ); - tdsOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - tdsOff->setOn( true ); - tdsOff->setEnabled( enterprise ); - tdsPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - tdsPlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - tdsPlugin->setEnabled( enterprise ); - tdsDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - tdsDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - tdsDirect->setEnabled( enterprise ); - - folder = new CheckListItem( sqlfolder, "PostgreSQL" ); - folder->addRequiredFiles("libpqdll.lib,libpq-fe.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/PostgreSQL", "Off", &settingsOK ); - psqlOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - psqlOff->setOn( true ); - psqlOff->setEnabled( enterprise ); - psqlPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - psqlPlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - psqlPlugin->setEnabled( enterprise ); - psqlDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - psqlDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - psqlDirect->setEnabled( enterprise ); - - folder = new CheckListItem( sqlfolder, "OCI" ); - folder->addRequiredFiles("oci.lib,oci.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/OCI", "Off", &settingsOK ); - ociOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - ociOff->setOn( true ); - ociOff->setEnabled( enterprise ); - ociPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - ociPlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - ociPlugin->setEnabled( enterprise ); - ociDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - ociDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - ociDirect->setEnabled( enterprise ); - - folder = new CheckListItem( sqlfolder, "MySQL" ); - folder->addRequiredFiles("libmysql.lib,mysql.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/MySQL", "Off", &settingsOK ); - mysqlOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - mysqlOff->setOn( true ); - mysqlOff->setEnabled( enterprise ); - mysqlPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - mysqlPlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - mysqlPlugin->setEnabled( enterprise ); - mysqlDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - mysqlDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - mysqlDirect->setEnabled( enterprise ); - - folder = new CheckListItem( sqlfolder, "SQLite" ); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/SQLite", "Off", &settingsOK ); - sqliteOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - sqliteOff->setOn( true ); - sqliteOff->setEnabled( enterprise ); - sqlitePlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - sqlitePlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - sqlitePlugin->setEnabled( enterprise ); - sqliteDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - sqliteDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - sqliteDirect->setEnabled( enterprise ); - - folder = new CheckListItem( sqlfolder, "ODBC" ); - folder->addRequiredFiles("odbc32.lib,sql.h"); - entry = settings.readEntry( "/Trolltech/Qt/Sql Drivers/ODBC", "Off", &settingsOK ); - odbcOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - odbcOff->setOn( true ); - odbcOff->setEnabled( enterprise ); - odbcPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - odbcPlugin->setOn( entry == "Plugin" && folder->verify() && enterprise ); - odbcPlugin->setEnabled( enterprise ); - odbcDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - odbcDirect->setOn( entry == "Direct" && folder->verify() && enterprise ); - odbcDirect->setEnabled( enterprise ); - - CheckListItem *stfolder = new CheckListItem( configPage->advancedList, "Styles" ); - stfolder->setHelpText(tr("Select support for the various GUI styles that Qt supports." ),configPage->explainOption); - - folder = new CheckListItem( stfolder, "SGI" ); - entry = settings.readEntry( "/Trolltech/Qt/Styles/SGI", "Plugin", &settingsOK ); - sgiOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - sgiOff->setOn( entry == "Off" ); - sgiPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - sgiPlugin->setOn( entry == "Plugin" ); - sgiDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - sgiDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( stfolder, "CDE" ); - entry = settings.readEntry( "/Trolltech/Qt/Styles/CDE", "Plugin", &settingsOK ); - cdeOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - cdeOff->setOn( entry == "Off" ); - cdePlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - cdePlugin->setOn( entry == "Plugin" ); - cdeDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - cdeDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( stfolder, "MotifPlus" ); - entry = settings.readEntry( "/Trolltech/Qt/Styles/MotifPlus", "Plugin", &settingsOK ); - motifplusOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - motifplusOff->setOn( entry == "Off" ); - motifplusPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - motifplusPlugin->setOn( entry == "Plugin" ); - motifplusDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - motifplusDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( stfolder, "Platinum" ); - entry = settings.readEntry( "/Trolltech/Qt/Styles/Platinum", "Plugin", &settingsOK ); - platinumOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - platinumOff->setOn( entry == "Off" ); - platinumPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - platinumPlugin->setOn( entry == "Plugin" ); - platinumDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - platinumDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( stfolder, "Motif" ); - entry = settings.readEntry( "/Trolltech/Qt/Styles/Motif", "Plugin", &settingsOK ); - motifOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - motifOff->setOn( entry == "Off" ); - motifPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - motifPlugin->setOn( entry == "Plugin" ); - motifDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - motifDirect->setOn( entry == "Direct" ); - - folder = new CheckListItem( stfolder, "Windows XP" ); - folder->addRequiredFiles("uxtheme.h"); - folder->setRequiredFileLocation("part of the Microsoft Platform SDK, which is usually available for " - "download from the following location:" - "<p>http://www.microsoft.com/msdownload/platformsdk/sdkupdate/<p>"); - - entry = settings.readEntry( "/Trolltech/Qt/Styles/Windows XP", "Direct", &settingsOK ); - xpOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - xpOff->setOn( true ); - xpPlugin = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - xpPlugin->setOn( entry == "Plugin" && folder->verify() ); - xpPlugin->setEnabled( folder->verify() ); - xpDirect = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - xpDirect->setOn( entry == "Direct" && folder->verify() ); - xpDirect->setEnabled( folder->verify() ); - - folder = new CheckListItem( stfolder, "Windows" ); - entry = settings.readEntry( "/Trolltech/Qt/Styles/Windows", "Direct", &settingsOK ); - item = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - item->setEnabled( false ); - item->setOn( entry == "Off" ); - item = new CheckListItem( folder, "Plugin", QCheckListItem::RadioButton ); - item->setEnabled( false ); - item->setOn( entry == "Plugin" ); - item = new CheckListItem( folder, "Direct", QCheckListItem::RadioButton ); - item->setOn( entry == "Direct" ); - - entries = settings.readListEntry( "/Trolltech/Qt/Advanced C++", ',', &settingsOK ); - folder = new CheckListItem( configPage->advancedList, "Advanced C++" ); - folder->setHelpText(tr("Qt can be built with exception handling, STL support and RTTI support " - "enabled or disabled. Qt itself doesn't use any of those features." - "The default is to disable all advanced C++ features."), - configPage->explainOption); - advancedRTTI = new CheckListItem( folder, "RTTI", QCheckListItem::CheckBox ); - advancedRTTI->setOn( entries.contains( "RTTI" ) ); - advancedExceptions = new CheckListItem( folder, "Exceptions", QCheckListItem::CheckBox ); - advancedExceptions->setOn( entries.contains( "Exceptions" ) ); - advancedSTL = new CheckListItem( folder, "STL", QCheckListItem::CheckBox ); - advancedSTL->setOn( entries.contains( "STL" ) ); - - folder = new CheckListItem( configPage->advancedList, "Tablet Support" ); - folder->addRequiredFiles("wintab.h,wintab.lib"); - folder->setRequiredFileLocation("available at http://www.pointing.com/FTP.HTM"); - folder->setHelpText(tr("Qt can support the Wacom brand tablet device."), configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Tablet Support", "Off", &settingsOK ); - tabletOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - tabletOff->setOn( true ); - tabletOn = new CheckListItem( folder, "On", QCheckListItem::RadioButton ); - tabletOn->setOn( entry == "On" && folder->verify() ); - - folder = new CheckListItem( configPage->advancedList, "Accessibility" ); - folder->setHelpText(tr("<p>Accessibility means making software usable and accessible to a wide " - "range of users, including those with disabilities." - "This feature is only available with a shared Qt library."), - configPage->explainOption); - entry = settings.readEntry( "/Trolltech/Qt/Accessibility", "On", &settingsOK ); - accOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - accOff->setOn( entry == "Off" ); - accOn = new CheckListItem( folder, "On", QCheckListItem::RadioButton ); - accOn->setOn( entry == "On" ); - - entry = settings.readEntry( "/Trolltech/Qt/Big Textcodecs", "On", &settingsOK ); - folder = new CheckListItem( configPage->advancedList, "Big Textcodecs" ); - folder->setHelpText(tr("Textcodecs provide translations between text encodings. For " - "languages and script systems with many characters it is necessary " - "to have big data tables that provide the translation. Those codecs " - "can be left out of the Qt library and will be loaded on demand.\n" - "Having the codecs in a plugin is not available with a static Qt " - "library."), configPage->explainOption); - bigCodecsOff = new CheckListItem( folder, "Off", QCheckListItem::RadioButton ); - bigCodecsOff->setOn( entry == "Off" ); - bigCodecsOn = new CheckListItem( folder, "On", QCheckListItem::RadioButton ); - bigCodecsOn->setOn( entry == "On" ); - - setStaticEnabled( staticItem->isOn() ); - setJpegDirect( mngDirect->isOn() ); - - configPage->configList->setUpdatesEnabled(true); - configPage->advancedList->setUpdatesEnabled(true); - - // Needed to force the scrollbars to appear on Windows 9x... - QListViewItem *dummy = new QListViewItem(configPage->configList, "Dummy Item"); - delete dummy; - - setBackEnabled( buildPage, false ); -#endif -} - -void SetupWizardImpl::showPageBuild() -{ - autoContTimer.stop(); - nextButton()->setText( "Next >" ); - saveSettings(); - -#if defined(Q_OS_WIN32) - if( globalInformation.reconfig() && configPage->rebuildInstallation->isChecked() && qWinVersion() & WV_NT_based ) { - QStringList args; - - buildPage->compileProgress->hide(); - buildPage->restartBuild->hide(); - - args << globalInformation.text(GlobalInformation::MakeTool) << "clean"; - logOutput( "Starting cleaning process" ); - connect( &cleaner, SIGNAL( processExited() ), this, SLOT( cleanDone() ) ); - connect( &cleaner, SIGNAL( readyReadStdout() ), this, SLOT( readCleanerOutput() ) ); - connect( &cleaner, SIGNAL( readyReadStderr() ), this, SLOT( readCleanerError() ) ); - cleaner.setWorkingDirectory( QEnvironment::getEnv( "QTDIR" ) ); - cleaner.setArguments( args ); - if( !cleaner.start() ) { - logOutput( "Could not start cleaning process" ); - emit wizardPageFailed( indexOf(currentPage()) ); - } - } else -#endif - cleanDone(); // We're not doing a reconfig, so skip the clean step - -} - -static bool verifyHelper(QListView *listview, bool result) -{ - QListViewItemIterator it(listview); - while (it.current()) { - QListViewItem *item = it.current(); - ++it; - if (item->rtti() != CheckListItem::RTTI) - continue; - - CheckListItem *checkItem = (CheckListItem*)item; - if (!checkItem->isOn()) - continue; - - bool r = checkItem->verify(); - checkItem->setCritical(!r); - if (result) result = r; - } - return result; -} - -bool SetupWizardImpl::verifyConfig() -{ - bool result = true; -#if !defined(EVAL) && !defined(EDU) && !defined(NON_COMMERCIAL) - result = verifyHelper(configPage->configList, result); - result = verifyHelper(configPage->advancedList, result); -#endif - return result; -} diff --git a/util/install/win/shell.cpp b/util/install/win/shell.cpp deleted file mode 100644 index b1303a7..0000000 --- a/util/install/win/shell.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "shell.h" -#include "environment.h" -#include "dialogs/folderdlgimpl.h" -#include <qnamespace.h> -#include <qdir.h> -#include <qlibrary.h> -#if defined(Q_OS_WIN32) -#include <windows.h> -#include <shlobj.h> -#else -#include <sys/param.h> -#include <sys/mount.h> -#endif - -static const char* folder_closed_xpm[]={ - "16 16 9 1", - "g c #808080", - "b c #c0c000", - "e c #c0c0c0", - "# c #000000", - "c c #ffff00", - ". c None", - "a c #585858", - "f c #a0a0a4", - "d c #ffffff", - "..###...........", - ".#abc##.........", - ".#daabc#####....", - ".#ddeaabbccc#...", - ".#dedeeabbbba...", - ".#edeeeeaaaab#..", - ".#deeeeeeefe#ba.", - ".#eeeeeeefef#ba.", - ".#eeeeeefeff#ba.", - ".#eeeeefefff#ba.", - ".##geefeffff#ba.", - "...##gefffff#ba.", - ".....##fffff#ba.", - ".......##fff#b##", - ".........##f#b##", - "...........####." -}; - -static const char* folder_open_xpm[]={ - "16 16 11 1", - "# c #000000", - "g c #c0c0c0", - "e c #303030", - "a c #ffa858", - "b c #808080", - "d c #a0a0a4", - "f c #585858", - "c c #ffdca8", - "h c #dcdcdc", - "i c #ffffff", - ". c None", - "....#ab##.......", - "....###.........", - "....#acab####...", - "###.#acccccca#..", - "#ddefaaaccccca#.", - "#bdddbaaaacccab#", - ".eddddbbaaaacab#", - ".#bddggdbbaaaab#", - "..edgdggggbbaab#", - "..#bgggghghdaab#", - "...ebhggghicfab#", - "....#edhhiiidab#", - "......#egiiicfb#", - "........#egiibb#", - "..........#egib#", - "............#ee#" -}; - -static const char* file_xpm []={ - "16 16 7 1", - "# c #000000", - "b c #ffffff", - "e c #000000", - "d c #404000", - "c c #c0c000", - "a c #ffffc0", - ". c None", - "................", - ".........#......", - "......#.#a##....", - ".....#b#bbba##..", - "....#b#bbbabbb#.", - "...#b#bba##bb#..", - "..#b#abb#bb##...", - ".#a#aab#bbbab##.", - "#a#aaa#bcbbbbbb#", - "#ccdc#bcbbcbbb#.", - ".##c#bcbbcabb#..", - "...#acbacbbbe...", - "..#aaaacaba#....", - "...##aaaaa#.....", - ".....##aa#......", - ".......##......." -}; - -static const char* info_xpm[] = { - "16 16 6 1", - "# c #0000ff", - "a c #6868ff", - "b c #d0d0ff", - "c c #ffffff", - "- c #000000", - ". c none", - ".....------.....", - "...--######--...", - "..-###acca###-..", - ".-####cccc####-.", - ".-####acca####-.", - "-##############-", - "-######bcc#####-", - "-####ccccc#####-", - "-#####cccc#####-", - "-#####cccc#####-", - "-#####cccc#####-", - ".-####cccc####-.", - ".-###cccccc###-.", - "..-##########-..", - "...--#######-...", - ".....------....." -}; - -static QPixmap* closedImage = NULL; -static QPixmap* openImage = NULL; -static QPixmap* fileImage = NULL; -static QPixmap* infoImage = NULL; - -#if defined(Q_OS_WIN32) -typedef BOOL (WINAPI *PtrSHGetPathFromIDListW)(LPITEMIDLIST,LPWSTR); -static PtrSHGetPathFromIDListW ptrSHGetPathFromIDListW = 0; - -static void resolveLibs() -{ - static bool triedResolve = false; - - if ( !triedResolve ) { - triedResolve = true; - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - QLibrary lib("shell32"); - lib.setAutoUnload( false ); - ptrSHGetPathFromIDListW = (PtrSHGetPathFromIDListW) lib.resolve( "SHGetPathFromIDListW" ); - } - } -} -#endif - -WinShell::WinShell() -{ -#if defined(Q_OS_WIN32) - HRESULT hr; - LPITEMIDLIST item; -#endif - - localProgramsFolderName.clear(); - commonProgramsFolderName.clear(); - windowsFolderName.clear(); - -#if defined(Q_OS_WIN32) - resolveLibs(); - if( ptrSHGetPathFromIDListW && int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - ushort buffer[MAX_PATH]; - if( SUCCEEDED( hr = SHGetSpecialFolderLocation( NULL, CSIDL_PROGRAMS, &item ) ) ) { - if( ptrSHGetPathFromIDListW( item, (wchar_t*) buffer ) ) { - localProgramsFolderName = QString::fromUcs2( buffer ); - if( SUCCEEDED( hr = SHGetSpecialFolderLocation( NULL, CSIDL_COMMON_PROGRAMS, &item ) ) ) { - if( ptrSHGetPathFromIDListW( item, (wchar_t*) buffer ) ) - commonProgramsFolderName = QString::fromUcs2( buffer ); - else - qDebug( "Could not get name of common programs folder" ); - } - else - qDebug( "Could not get common programs folder location" ); - - if( GetWindowsDirectoryW( (wchar_t*) buffer, MAX_PATH ) ) - windowsFolderName = QString::fromUcs2( buffer ); - else - qDebug( "Could not get Windows directory" ); - } - else - qDebug( "Could not get name of programs folder" ); - } - else - qDebug( "Could not get programs folder location" ); - } - else { - QByteArray buffer( MAX_PATH ); - if( SUCCEEDED( hr = SHGetSpecialFolderLocation( NULL, CSIDL_PROGRAMS, &item ) ) ) { - if( SHGetPathFromIDListA( item, buffer.data() ) ) { - localProgramsFolderName = buffer.data(); - commonProgramsFolderName = buffer.data(); - } - else - qDebug( "Could not get name of programs folder" ); - } - else - qDebug( "Could not get programs folder location" ); - } -#endif - - closedImage = new QPixmap( folder_closed_xpm ); - openImage = new QPixmap( folder_open_xpm ); - fileImage = new QPixmap( file_xpm ); - infoImage = new QPixmap( info_xpm ); -} - -WinShell::~WinShell() -{ -} - -QString WinShell::selectFolder( QString folderName, bool common ) -{ - QStringList folders; - FolderDlgImpl dlg; - - if( common ) - dlg.setup( commonProgramsFolderName, folderName ); - else - dlg.setup( localProgramsFolderName, folderName ); - - if( dlg.exec() ) { - return dlg.getFolderName(); - } - else - return folderName; -} - -QString WinShell::createFolder( QString folderName, bool common ) -{ - QDir folderDir; - QString folderPath; - - if( common ) - folderPath = commonProgramsFolderName + QString( "\\" ) + folderName; - else - folderPath = localProgramsFolderName + QString( "\\" ) + folderName; - - folderDir.setPath( folderPath ); - - if( !folderDir.exists( folderPath ) ) - if( !createDir( folderPath ) ) - return QString(); - - return folderPath; -} - - -#if defined(Q_OS_WIN32) -HRESULT WinShell::createShortcut( QString folderName, bool, QString shortcutName, QString target, QString description, QString arguments, QString wrkDir ) -{ - IPersistFile* linkFile; - HRESULT hr; - - // Add .lnk to shortcut name if needed - if( shortcutName.right( 4 ) != ".lnk" ) - shortcutName += ".lnk"; - - folderName = QEnvironment::getFSFileName( folderName ); - if( int( qWinVersion() ) & int( Qt::WV_NT_based ) ) { - IShellLinkW* link; - if( SUCCEEDED( hr = CoCreateInstance( CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (void**)&link ) ) ) { - if( SUCCEEDED( hr = link->QueryInterface( IID_IPersistFile, (void**)&linkFile ) ) ) { - link->SetPath( (const wchar_t*) target.ucs2() ); - QString _wrkDir = wrkDir; - if( !_wrkDir.length() ) { - _wrkDir = QDir::toNativeSeparators( target ); - // remove the filename - int pos = _wrkDir.findRev( '\\' ); - if ( pos > 0 ) - _wrkDir = _wrkDir.left( pos ); - else - _wrkDir = ""; - } - - link->SetWorkingDirectory( (const wchar_t*) _wrkDir.ucs2() ); - if( description.length() ) - link->SetDescription( (const wchar_t*) description.ucs2() ); - if( arguments.length() ) - link->SetArguments( (const wchar_t*) arguments.ucs2() ); - - hr = linkFile->Save( (const wchar_t*) QString( folderName + QString( "\\" ) + shortcutName ).ucs2(), false ); - - linkFile->Release(); - } - else - qDebug( "Could not get link file interface" ); - - link->Release(); - } - else - qDebug( "Could not instantiate link object" ); - } - else { - IShellLinkA* link; - if( SUCCEEDED( hr = CoCreateInstance( CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkA, (void**)&link ) ) ) { - if( SUCCEEDED( hr = link->QueryInterface( IID_IPersistFile, (void**)&linkFile ) ) ) { - link->SetPath( target.local8Bit().data() ); - QString wrkDir = QDir::toNativeSeparators( target ); - - // remove the filename - int pos = wrkDir.findRev( '\\' ); - if ( pos > 0 ) - wrkDir = wrkDir.left( pos ); - else - wrkDir = ""; - - link->SetWorkingDirectory( wrkDir ); - if( description.length() ) - link->SetDescription( description.local8Bit() ); - if( arguments.length() ) - link->SetArguments( arguments.local8Bit() ); - - hr = linkFile->Save( (const wchar_t*) QString( folderName + QString( "\\" ) + shortcutName ).ucs2(), false ); - - linkFile->Release(); - } - else - qDebug( "Could not get link file interface" ); - - link->Release(); - } - else - qDebug( "Could not instantiate link object" ); - } - - return hr; -} -#endif - -#if defined(Q_OS_WIN32) -void WinShell::createInternetShortcut( QString folderName, bool, QString shortcutName, QString url ) -{ - // Add .url to shortcut name if needed - if( shortcutName.right( 4 ) != ".url" ) - shortcutName += ".url"; - - // ### maybe we should use some Microsoft API instead (IShellLink, e.g.)? - QDir dir( folderName ); - QFile f( dir.filePath( shortcutName ) ); - if ( f.open( IO_WriteOnly | IO_Translate ) ) { - QTextStream ts( &f ); - ts << "[InternetShortcut]" << endl - << "URL=" << url; - } -} -#endif - -bool WinShell::createDir( QString fullPath ) -{ - QStringList hierarchy = QStringList::split( QString( "\\" ), fullPath ); - QString pathComponent, tmpPath; - QDir dirTmp; - bool success; - - for( QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it ) { - pathComponent = *it + "\\"; - tmpPath += pathComponent; - success = dirTmp.mkdir( tmpPath ); - } - return success; -} - -QPixmap* WinShell::getClosedFolderImage() -{ - return closedImage; -} - -QPixmap* WinShell::getOpenFolderImage() -{ - return openImage; -} - -QPixmap* WinShell::getFileImage() -{ - return fileImage; -} - -QPixmap* WinShell::getInfoImage() -{ - return infoImage; -} - -#if defined(Q_OS_WIN32) -QString WinShell::OLESTR2QString( LPOLESTR str ) -{ - QString tmp; - - for( int i = 0; str[ i ]; i++ ) - tmp += QChar( str[ i ] ); - - return tmp; -} -#endif - -/*! - Returns the free space for the directory. The space is returned in bytes, - and should only be considered valid for this particular directory. -*/ -#if defined(Q_OS_WIN32) -ULARGE_INTEGER WinShell::dirFreeSpace( QString dirPath ) -{ - QString drive = dirPath.left( dirPath.find( '\\' ) ); - ULARGE_INTEGER freeSpace; - - freeSpace.QuadPart = 0; - - if( GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetDiskFreeSpaceExA" ) ) { - ULARGE_INTEGER ulBytesAvailable, ulBytesTotal; - if( GetDiskFreeSpaceExA( drive.local8Bit(), &ulBytesAvailable, &ulBytesTotal, NULL ) ) - freeSpace = ulBytesAvailable; - } - else if( GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetDiskFreeSpaceA" ) ) { - DWORD dwSPC, dwBPS, dwClusters, dwTotalClusters; - if( GetDiskFreeSpaceA( drive.local8Bit(), &dwSPC, &dwBPS, &dwClusters, &dwTotalClusters ) ) - freeSpace.QuadPart = dwSPC * dwBPS * dwClusters; - } - return freeSpace; -} -#elif defined(Q_OS_MAC) -long WinShell::dirFreeSpace( QString dirPath ) -{ - struct statfs buf; - if (statfs( dirPath.local8Bit(), &buf ) != -1) - return buf.f_bavail * buf.f_bsize; - return 0; -} -#endif - diff --git a/util/install/win/shell.h b/util/install/win/shell.h deleted file mode 100644 index 4d5f9af..0000000 --- a/util/install/win/shell.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SHELL_H -#define SHELL_H - -#include <qstring.h> -#include <qstringlist.h> -#include <qpixmap.h> -#if defined(Q_OS_WIN32) -#include <windows.h> -#include <shlobj.h> -#endif - -class WinShell -{ -public: - WinShell(); - ~WinShell(); - -private: - bool createDir( QString fullPath ); -#if defined(Q_OS_WIN32) - QString OLESTR2QString( LPOLESTR str ); -#endif -public: - QString localProgramsFolderName; - QString commonProgramsFolderName; - QString windowsFolderName; - QString selectFolder( QString folderName, bool common ); - - QString createFolder( QString folderName, bool common ); - -#if defined(Q_OS_WIN32) - HRESULT createShortcut( QString folderName, bool common, QString shortcutName, QString target, QString description = QString(), QString arguments = QString(), QString wrkDir = QString() ); - void createInternetShortcut( QString folderName, bool common, QString shortcutName, QString url ); -#endif - - static QPixmap* getOpenFolderImage(); - static QPixmap* getClosedFolderImage(); - static QPixmap* getFileImage(); - static QPixmap* getInfoImage(); -#if defined(Q_OS_WIN32) - static ULARGE_INTEGER dirFreeSpace( QString dirPath ); -#elif defined(Q_OS_MAC) - static long dirFreeSpace( QString dirPath ); -#endif -}; - -#endif diff --git a/util/install/win/uninstaller/quninstall.pro b/util/install/win/uninstaller/quninstall.pro deleted file mode 100644 index c64e8d2..0000000 --- a/util/install/win/uninstaller/quninstall.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -CONFIG += qt -HEADERS = ../environment.h uninstallimpl.h -SOURCES = uninstaller.cpp ../environment.cpp uninstallimpl.cpp -INTERFACES = uninstall.ui -TARGET = quninstall -DESTDIR = ../../../../dist/win/bin diff --git a/util/install/win/uninstaller/uninstall.ui b/util/install/win/uninstaller/uninstall.ui deleted file mode 100644 index 88f27a7..0000000 --- a/util/install/win/uninstaller/uninstall.ui +++ /dev/null @@ -1,167 +0,0 @@ -<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> -<class>UninstallDlg</class> -<widget class="QDialog"> - <property name="name"> - <cstring>UninstallDlg</cstring> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>527</width> - <height>365</height> - </rect> - </property> - <property name="caption"> - <string>Uninstalling Qt</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QLabel" row="0" column="0" rowspan="2" colspan="1"> - <property name="name"> - <cstring>sideBar</cstring> - </property> - <property name="pixmap"> - <pixmap>image0</pixmap> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>AlignTop</set> - </property> - </widget> - <widget class="QGroupBox" row="0" column="1"> - <property name="name"> - <cstring>progressBox</cstring> - </property> - <property name="title"> - <string>Uninstallation progress</string> - </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <property name="margin"> - <number>11</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <widget class="QTextView"> - <property name="name"> - <cstring>filesDisplay</cstring> - </property> - <property name="font"> - <font> - <family>Courier</family> - </font> - </property> - <property name="wordWrap"> - <enum>NoWrap</enum> - </property> - </widget> - </vbox> - </widget> - <widget class="QLayoutWidget" row="1" column="1"> - <property name="name"> - <cstring>layout2</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <spacer> - <property name="name"> - <cstring>Spacer1</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>90</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="QPushButton"> - <property name="name"> - <cstring>cleanRegButton</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Clean Registry</string> - </property> - </widget> - <widget class="QPushButton"> - <property name="name"> - <cstring>okButton</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - <spacer> - <property name="name"> - <cstring>Spacer2</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>100</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - </grid> -</widget> -<images> - <image name="image0"> - <data format="XPM.GZ" length="26835">789ced5c595323bb927e3fbfa2e3e8edc6842ed8982526e601b0318bd97726e62125956df0868d59cc8df9ef93ca452e6f34f4e1ccf4c37405747fae2a293fe5a24c49ee7ffee3c7cdc9e18f7ffcf38fa7210ceffd0fdf84c18f7f84e74e67f49ffff51ffffae3cfe5a5a51ff1a7b8b1f1a3f0e7bffdf1a7811ffe8759a23f842b09af13be51bcccf78de015797e27617efe5ab13c6f05afcbf3eb09d3f3f0a0989ff7cd84f9fea360cfef879030dfef335e16f9bd172cf2c125e1f524ef6dc22cef9a62e9ff30616eff4ab0ca5f4d98efaf2a96f7af13e6fb15c122bfbf4f98fbbf532ce355669cf81c27cced9d28e6f68d132cfcec86609117b6044bff8efac7d6a43f7fc358fb0be78af9beeb09d6f1eb0bd6f1180896f6cd2ae382b467af04cbfb595bb0bcef6b84d7f579680896e7c32061e26b2f056bffbb82d53e2e222e2cebfbb02158c7635bb03c6faf1917d5febd6079df497b45ed8fdfdfd0e7c36dc2ac9f4cb0eae342b0f67f2c58ede18d319a1ff747fe541cf7772258f5779430f75767acefdb9b84d93eae0497e4fd52c2743ff4148bbedf046fc8f3649fc5241f5c0bd6f61e12e6fe1e15737b765db0b4679e12e6e797040791ff3c61baef8b8ab9bdb0c1b824fd7b8a072b056dcfef0a96f6fc4ac2ccf75531b707cf8c4bcacf254ccfbb8162f14fe92ff55f4a989fbf51cccf674dc1c2dfde26cccf9f12067d1e7604ebfd57c5c27f59b0f07119e35591cf913d940aa5c0f1213c292e6c90bc7b8c57d53e8e158bbece048b3ce12061eeef50716199da7b16acfadd502cf25c0ad6f1e7f651de22bdefac60b59f9262894f2058ed654bb1c8e7046bfb7a5ff4ebd37d89c79b8a597e77ce784dc7634fb1c8ff9e30bf7fa498df0f6b82d51eb61366794031bfefc9de578bab1b45d6c750b0c8e7cf14cbf8de2ae6f10a59c2f47e28325679a19530b7b7af58f8ae254cefc3bd60912f5414f3f3504a98fb6b286679b28e60d1bfdf51ccedd953c5dc5ea6f2a93ec85f565deaff5eb18c6f2b61eebfad58fad7e7c51e7c3b61e67fa958c6f324616acf6482351e0c1266f9de15cbfbdd84599e3ae3f582f0bd532ccfaf27ccfd51bc5d2beafb6e55b1e8b7c038bd6f13e6f79705aff27dbb9630cb73ad98db83a66090fb778aa5bf15c199d8073fefd2f325c5d25e59b03c6f2e13667b0a8ac5bf1f196fc8f86446b1f02b24ccef8f14f3fbf644b0f009f23e1464fe23fb5a5f49efbf28e6e7fd51c274df2e0996f18243c5624f8d84d93fdf05cb78002816796cc23c5ebb82753cf719abbc7ea458f8937daffbf4fe9260194fbbaa58ee737b1e94af572c7cb384f9f9a160b58fae62d1e75bc26c8f34be1b2bda7e962996f1a80b96f7dd71c22ccfabe215aa2fc263c240f6a2efeb78d6144bff4131bfef5612a6f7dd48b08ecfb26296c79c26ccf755be4cda1b32760589572f8a25de541366be65c5a2ef31e6f6453eb72af9d046c2acef55c532de5630c87c799830c7bf9162997f760567d2de9d62c947683edbf03a7efe5cb1f07d4a98c60f2e04cbf89815c5fc7cc6e3ef95af394a989fef2a16fd5e264cedfb8660198ff09230cb7fa058e66f9f30c707ab58e2db96628907db09b33cfb8a459ee384499e50535ce27af741b08eff5bc21cbf1f154b3e344c98e5bf502cfedb4f98ed6153b1f8632f61bedf129c493ed84b98fbd7f115fdda4ec29c9f14154b7c394898fd27bd2fe3c5f6e57d51fa6b24ccfdd5154b7fed8439dfeb2816ffd84e98f948ff7e4dc6f33e6196f755b1d86b53b093f84df90d94923ddd24ccf6baa698f517fa82355e9d29e6f7cd30618e17d78af97d58162cfa74a058f479a558f455562cfeb49930dbfb4031b7ef2a82459f50502cfeec12e6feb57dd127ec25ccf1f149b1e8f33d6196afa498e5f3a97fe19ffa17f99e19277b6826ccf610148b3db884f9fe9362f1cfd784599e37c5226f2161e673a098e5b535c1623f1612a6fe4e878a451e9330cbd3572ce3b79f30dbc78b62f1c76ac23c1fea7838e97f9030b7ef154bff59c27c5ffb73e28f7b09733c5e532cfdeb78d5a5bfe784d95f54debad8cb56c21c7f78fc83eadf9f2ae6f1846ac26c9f5b8a59ff9eed37a8fe602961d6cf9d6289ffe709b37e2b8ac5df2e12667b2b2a167b6b0b16fd413161f68f8e62c927d3f3228ff62ffab3a384f9be512cfc571266fe0f8a85bff627fa75278a45bff709b37e5f14cb78f512e6f1d8532cf2ed26ccf3d3b362b1f79d8479bcd6154b7cea0a16fbf08f09b37db4148bbc0f09f3fd9a62f1cfa384595e1dffbae46fd58459de03c5920fb0ff8720f1c12d2996f8b5ad58e687a384d9ff68be7125d58f3709f3fcbcaa58f4b3ac78d5d1fd75c132deaea558f2b1f78459fe8e62b18776c23cde5eb1cc27cd84e97e0682653c61a858f4aff2c8f89946c2dcff9962d17735616ebfae58fadf4b98e5bb659cc6b7af58eabf9162d15f2d611e9f65c5325f5d25cce3fd2658fc2bec2816f90b8ae579b22f17923e3a8ad78a844f05bb35ba0fbb8295df49c2cc9fc73fa83c70a658f4bf9130f77f2558ec276c26ccf70f154b7e47f6e05715670f8245dfa7c3bfefb226ff6fbe1206bdbea7afbf9bcb873c7f3b2e6389f2d7d7defbbdb94c4a19fffe2e89ff4e2e3f67b7f0b9e83d2eef51bf1f9769361f3c67be8fc9ff0e97cf58e1efcbe56bec7e372ed6d3ef803f99cdf0771d2f379e51d49a6cc0cf3dfe3408d51167bf1717dbb40dbc82c857174ef77865c22590dc863ee57f33e7f05d4cbe878b7dd091c6bf513fc42b5a4f64d8b22d7a263047d154db76f0a74bd7b7b1f9361b6b3213e2a29ed0144ebda83389c01dfb88bf9dede365488b8ddf870bca1a251e208f28355eb97b461844cf89d23f219721fe76a88ff86c7ceff9b79af7077479b224635f50d627fb6adfec08af77bb89d796ddc6ab6c2b76c756f1d35dbb67f7f1598fef1dfc665c6af610ff756f8f50c6114a7c6c4feca93db3e7f6c25eda2bba2eedb5bdc14f6eed9d5db2cbb6608bf87cb02bdfc3e4735c16cd03b939a28136f3842c4a76d5aed975947a038dcbd08f31902e439f59e38c37c164a66e47a64136e7c62dfe7d5c62eba6893ff78464c6c088da340f76605af8bb6bdaa663baa6671e4ddfe4ffc082cb08ab8179b2a766689e519f6df49f8179c17189712e4687f849dd3e7c3717bceecdab796526e60d6de3017b5ab1c18cccbbd9345b66db9449fa8a5cf359e8dd1d53256c91fdaed933fbe600a5c788877d64e44b6deca7763a34877f0797a9cf7b18938aa88f23736c4e8407a08c1f311973613e207ca2cded99537386fa79b45d8aef4d9a6f8d7dfc3e2e910deae45e6c2c5a345a16feab63cecd85b93457288bdacdce420e7936d7e6062f66738bfab9a3b79d5932cb76db144c112d4bfd9074f37d5c50cfaf631de175883a79428dac989259257d5c9bb54ff198af9fc86c9dc66260363006eedabef4e52503fa543efa152ed44acd0258fb82e200b8e4213acef33d7e9ed5ed4c71b9a127908dbd006f0b6684f6d520368dcfe6d65f995f948b7d4261026424355bd6acacd3e39e8f0855bc7684d10ebd0de91e4637a8e30cf46e62bed68833d7dfc605305a8eec1d348409cbcd32cdf298c479a620acc6ade4e23564d0b465d3c63ebf990bc5e1a8e926c6e2275b817b7b99fa372411244b1beb607a36512daec3c384eceb53fae4c8368016b4a1631ea01b638048d28b59c25fe3821cc0b46c0f7ad8cd9d30614de4b513795ce335b69647bcfa6695b31894af9f63b54eefb39759c910d48bf0137b0d037882a191b99233f158612c92f3937a0914f19d39473f6924bb998cb3636d187844b93378c6b17d81579c81f6f1eac21b8ce01d368d872d923d8ec7383aabff2832b00d65d3414b88594686b3f3540d3a6d6f9fe2d2c339be8133e3ae5d128fbf9e60b233c1a38223ba831caab08b71fb1cf630677e857d9c0563de398203a8c1211cc13132c6c7e184343a393215eac5e233a77046f99ae64e58d1fd152e1883bbd6c1395cc0738ac131285fc2a530d9812bd6075cc30ddcda77b8832558b68f508022e6cf5c6dc68aa58bd21c9906acc02b94306fde9016d76035c727d91db6b786d583c36ca013ab37bcee7f9d0be5f42bb06e2eec19ce27b9a8434c40626a1cc50d4c778d1d3970b1fa8a36d1c46b1c7d6a78c54a07301b2dda5de75d7099ccb69022a17a21406cb7ecea186d7a54c3f5a9aa7b99643266f3192e3163710dd7a45e351ae5628fbb8f4cdc03bcd88a6bd9e0dae38b183562fea31534e7429841765cc7beb9ae3d866bd74b3151a322a47efaeed1ee219b2155a59db4a2b390cbfc3827cfb65c1fedab2e79faa45d9304f0e806ee09da76e886f4fc336924c895f25264508fb646ccf8efccbd9815f74abe63a83dcea04dcab98d7b7358e5a0263be437d98c7c135ca62d0f7b7aa0d5141fad020a98d51f4b5fe319f136f61475027df7ee36cd798c38d33dc41acbdcdb81dbc2485427ddc4567beac7b6e1b63132acb8776403e4339319048fd6b1adbab2abd07a889f9275ca5fe6cda6d4a7c759b78995d6a6db99885e791b2b9b3d3772558c545df6ef311f696980ad34a256dc2e3eb3eff6dcbe3b7035db41dbddc2cfeaf6d59cba43f2c6e90c957a7447ee18ce5dc53dbb13f5405d3f9cf5fd692e512bf89eb72ddb8536565a65b2e44a9a1d53ede14edd1946eb23b29eb13ef2baf1d1e7b0b55e8c86b6e4cedd85bbb4658c4f435a8b69d8babb72d7ee862cd8cce1d2335bb612e389bb8dda1119a7d6d5e771a19991b8c4bf016739ac19c7d589915c9066007707afb680d6554f2b4b7e0e97815bc2df1db7ec0af694d6020670e48a587be13c8e36e863beea565c89e65998b90c4ab082e3e030be371745a9b95ceae358807adc75ab512b3c83249fa7fc1e67e65317d71e7aa293c3b4129bcf0407a8dd1eb5b4e9d6900979b6dd4036eb68391bf8ce3356db43388391e44733191d3ce22099983b2f8eb8f3b990a7504687b1b0e41e482bf9e842f334b60f18abcb927946af68e98aea049798eb764cc315bdc3ead1c4bc05f34be33d66a965f782b3cd7dacefb0af0a3e61139bc405c7d1f86086381a1bd15a66ed6b968be822482dd7b37d38f71945ff9d892c728dc6aaeeebb0ee1b1421984b8357c3a7b99c4629cedc1aadd2ecf8267259f5f7d842c39efa07f49b3aaf7aba1abcd98b592e64dd03dfc2ececf1e75cf29a49b27471a40ad09c8ac540d930c62fdf76719db8e63bc2a541ab0d7569ad46751bb588ba2bfb2ee52beb390b224bf3ce791be71d6cc3d47ccfdba499299f895606058d6193f178924bce4732f1e410ab15bb4e5cf2b912fd1b33c85b8cf96d9c1761721c38eff18fc40545432b2f430b7532ae4fc6d50fd271efb6644698f51d5aeffb7e60af932de73583f5266671059a63781eceb15ac8c5c4bc23fe1b73dc636a79ba468cd9d78e7f722ecf25f95b13a53ac08b2201ce1d177e680624dd0d6998ffac4b1566ec957ff62ff625b680b35419b3ecc789fc42ac0c2539c248f6352e7564136533c8e5842c23af15cecf0798d5df59e432e1191ab70efc2b45af3aeaa4847e32c8555a9c3bdae47b7189fccd8f6c912478c1faeb0533bf692ed827dae3bbdf642e7979177121a61db432e2825e799a7a555fb9a178bcedb76029e691b35cd0ba0e69a6e9da2266ffef34cf82bfcf79b4b6c9bc56fdb62fbb3249807a749b5825cdd10b0ef000e798e698cb22dfcf718933127319619e6f66b8c4569f6117eb93c8a539473387942f9cfb8adfc11a723a1bd55c987e63cdf38e1e5fb5d1b6c13cd8bef37e773a17e7c8e9b19a438f69ce9f2fe772c17a876cdda0e79fcfd14b9c59f6a1ed0f629b5098994f6256d2715564e290c958aaea4c9c35bee687b68439fd3e56270fb427d8c76a744ff492bcd41f92069750a238677c854b866dc6d5a37789f6d35c2afe08abdf3842017f4fed38e2db9477d9d3c8c41f27265593d750b4bb9a3f3117d08bb500e76d3886680de831e5296f21cbb617fef4ab5cf087b8f85e6ef548b950b58715ee1356bf8099deccde2946f2375b82f71835fcf18cb568348eda3d33170e682dbc213b7ed163defc39653aa9c214ebc49c09e7a90baa5703658d33be9f8f07c42748ad14b95c4d8d0f676203d3c5f9ed9eaca919eb13ca7a0632c7efa1846b98ade8cad8e42a66bcee62eeeb2ffd55f439aa64d016503b9e6a9b27bb8d3d68ed92e30f0dcc1eca24a7a3e83c91dde7b950d536ced963fbdb73b850e431fb36f65c8bbb326419547fc69d3e57f6a738330ee4f97c362a6bad1eb3067fe36f3d4525df31affe8e6cac473553166d1b7b48fa1b5fbef6552eb46ad2a4597f5b56c326ed1c6737b38fde4a5a20ff68989669d17acd9e3b8396afcd5421f919ea9a3c6ec92f9b4e8c1f51bba4939e39a4117cb225e132a5196c17ed81463a71996f63b19e652e34ef13177b39870b604f2835ad5c7baec089bfc3aa7c1fbd39669096e693d93a91dbd8211bdb47de7bf63166c9a8df17b2af9e6dc7b97f3e171cd92e2c7dc425f98ae694bc9a15b9948d9fcba58ff9ec1ef6cb5c62dd1e57be767d45ea135d1f9a8c5dd3ad386841d58e5027713e8a7b95b1e73eec432dd9e824976d64cf5ccc4fe6fddc7d64e2ec93b9b03773a290813ec4bdfb5eb4b1681d58b33bb71ce713ca5676644556198ded6b1cd3382b1bf87d8c137bb4e3daa295278c0438c716a03f6399f1ed13cc09f6347e7d860bb61bada66b3b381f1693f7e6e3a9c1883bc2e706317b4349ea581f16a12459fde4eaf26495388eb13b340bf7fd99ddc2da621f47a6c5f9821df91dcad8c66fc93abc5f714517a3f657b8dca3e520175bf5a539352b5601b00907685903b4f506feecdb12fac94098e47763e654bc546d4b4484b8dbb9ec57fd9a6d4bef31db38a33a769a0be6e638ba179c214f3359646314f3a3778dfc3a6513158e3e867328e482f9f729f468ed0be328f41ccf6ed7fe7ac2c6c5c66095b2b87ced32b12b00f77e036b65ac196d0b3a18d3b74d7eb7ad223fb430825e1ce631c9d7c853fe1253f1981d16bc97fa85d7c36505db6e046b77a586ac07e32ec862388baeca1ca9bab9a3dfb713316d3ce3c4bd968d0058b79cd3999f57ff2e33a572d9911f0760474ea3ed4fb8089b40d598b1bd1851a816d35d09b59db84f74845e5b8e953ace8f0781bdfe5ab8b2eda4f8eb6f40a59a7792816a65cc272fcc79f080d970b285c425ae5ea02438ba792e9355ff78dd32c7a54e3b3731bfecdb8209c976930c013f83637835cfe85371a5aee62bc8cda177de8b4759d105c5de90858c6ae4f1a84c44465ac7d8827b3374de0cc9c2c69625f6859f05da594a6b563c23cece95e2757a263272f174f66837d48d31d3e729e2483d864668ba0e9d5979c47cf001eb80be548cb9fac494c3bdbb0e0fa145eb49f35625a4d2c416dba1e34f2447ce5b24a9ce64a6813d8dcf4cb80fb938e16288cb01d6dfbdd095550765531564422f3cba17591b1cba65b70ef7b4bf9cab1931ab3f0b7dcce2dbee0ce792c1148bf1dc110712c2203c996d33b32f12239faf852156076fb2a6c435e34fb968c61c9e914dd756cc13594c75c263aea3ffbbcc75e94cc1033ef74875e4258dbe445168f813a8622edc0c2fb0075564d39f5b01ac139f9b5c9c9bcaf671705f6dc5391b7ce7335c267dc9367ccc2d56dc55e0f520e5c2b6738dd189727fd80f6f9855229f30827358c15af2912d8deb139ea7d1f71ec3bb2be227d367cad4ce62a45ccb696aacb5e87565bf1f36dd068e5a3355b1661197e90897f83d61deb04d5e2d71992c425794eb66c5be9957136b9903f49d57f41b17d751ec15d6f157710e42e1b12e88b5a35f3347762db706336b6bf36dd0982b8ca87b719e10d9682551e3d5ec5c39ffc24cab1178cfe246b9a0fd5634db75a7e6226cdb36fa57b4c93ad6352577e9dfdca5dd76555a9fad637dd2c0bf0fd11ef7423954c6b5b3c4bdc96b5a6fd17de3690f8763a52bbcc265d1fad8222e582776692ffc36ed5d731c208b404b7250735718bf57ec8169d910764235ecfa327a7cdc5fea51ce1635d742a6fbbe1af6bca319787ef59ce724cce038ecbb3e8d869fb49a4539cc022ec139ac998654f3e6aac3fcbc1d0e420d87af432bb787e60df3b322f2883ba571353766f21e3350debb6863b65272716eb733ab60f3195918d85d6ca386d1a8c12bf7f9959fcf7389b52b2c99158c66d32710d9ce622470eec6ad844388b514d52274923c9e637c88a7e87844cd4bccdeb0bdb82fbc82f19b56fd930fceea43d1921b8523db0acf188d7a93fb3b5fd40bf80e143063b6a93e9aae2beea2a59927ac692a389bbd9ceaf96bde278b3bfa8714e978cd08fbc7d8fa168e431b6b5e909c75f6d2334c58f741f4fa1a5d1336f62b5c5cc5b542df94d25afdf45e2fcd8bf612fd20b3dbd833ed286335f0403a1aa41d70a0b5aa26ce1217e1249c86b3dcf8cf6a07d984f370112e319e681696fd35bd60ff4d28842bb34911c08ca5cff9afe159c55e846b33c40a64944eb1c4d3ee9eeacf8c90818e7d05136e3063b99dcbc44cfcee873b5ba27dda8c2cb79ee7b2a8de5f74b9b6bd376f387b8fc29239c9d51ff99ec7d114f9986338c4f93e9e5a3ea7d32c2656f1a68d33c42e3e7401876119f80c703aef30e327a94dac6f8efc168e0e674b8df1ac32c9e753beefa018d78da1034fa1202795389b3126bff39776bba00f0d7b01cfa1c867aeecb6efd9edd00d2b98d91fc3b6ecc6c4eb26c76591ad617e019b7e60ce62a4744bb23ae67e89cb13edb3c4b5e3755b0e258aa6e3b596492e12a5f942bb73e863ab66151a98750e481379b9179f63ce5f96779d7d05e75e23fb152ebf2bfa697f09d089395ddc298022d67e9819718501bca6397bce72d2eea7adb06ac6275fa76bb2ea825c2d66775b7ec716ec4bfefb32bf30bf38bfc967745c0596e13cacc23bd0770fa0924e5c4df63d89afa7e49ec7587fcf5d4fa33d3fccf0c29a1dcaded02fc5319adb5e502385b8328b6c8a61dd3f41597633ccbc3a51fc293fa74eea6c71f6b2e0f31825b156dbc8ec787dff97b8c4dd2f172300fe8df39579806178cf0c5c93fd7f7c823f56fe553927fa310bba1bce17446964622fdc23c6423e3bf4933df1455706e60173ac389ff7dcb3ad650e671c97f970e9ea0b6aab8f477ad2fb75a5c9d05c7221df3a99e0819eff68af83b5551cd37a9ecb97e3d8cc7e646ccb95e10973c447f7f65336d30ca6b954e47b3f4bf0162ec3ddc4c95f5af18d7316bc99675a1b7b9895ead7b9d02ec50b7d93ad688b59b067eec8f5a4ef49df9d97edec4c31a281876318b811d6d17b31878ef50dd612c774d7114b0f712fa39b4e5dc3f770a1959718581eed10f6b12e6e6759d8c25830fe0e0c9d8d356bfe70e6b42eafcfc673b3fcc7e25b57c1857dbb8bb9705c2d7d7345d8a49569cb1e1fbfad8039f879acf778de9f94ec2bfe32c988a3017d5faf4f15ca10f38173730e711ff50933dfc9aa645e54d075166b2fc36bace4ecc8c56f89b4688770689efd80d858ca20b63d3a2c32c17e4deb23097fe57b7c5895189a6f0cd999336ff19c3f46b6badbcce2ca4b3d7df76dba7634921338c8b266768fdaa8640f98a539ac0562a555a34c7868776d296b656dd2c921f9499b7aa66f917c2b178e8a3dfd0eae3b89fbc958e33ca17e3ad0861573e4df61e0f7cc12cab20d0d5ff335cc62b6cd895f811d2c63c09d61e6d9809e8ba7a84dace0a8d2e2d34021ee15da42d6c99a188523932e8d6083f2ca6fb0b1f185759527dddcd3faa6c1eae6c4dde22721bc8417db45569829a0558cc0f8535b7667eecc744d17e5afbaa2f358b19ddb5757768ecf06d82e65f371573ceebcd6716c1ae891fd80c510f42876d573f2f7266dfe6bbe3f473319ed686696ce50b35e62ce879c4e520f58f3a0b50cfd054a5dc62abb0d4bc4009ce373e52a91ec30f08e7da073be4b74a2f881b4dfa3bff99bdb916ff6bd5c26753ca969cb67a29ae3d3d6136fcc7c92eecc9cd4fbf9b746ffba8d7dc4843e6f4e5ed3cfce709f7edf8cbf053bf1e94ffe6f8cefe52265cbc4c8d32e2e5f33e7f0e5d23548c5462bad31afefe2323b72935c663e5fc065fe08d87432339757b8f1897065f01d5ce6dbd124978fff97a485d625dafac8fabe32ce5fe1f2c1fab9997dfe6326b2b7bb405f133afa80d157e3d867b87cae8585f7276a11f120c8e3c5ed86e7f0fc9d5ce6c42133fdd4873d4c7d5f624a83dfc8e5e7e3faddd767fb9b1ec9ffcbff7fecbbafffe7f27b5e7ffef7bffff13fdcf4c93e</data> - </image> -</images> -<connections> - <connection> - <sender>okButton</sender> - <signal>clicked()</signal> - <receiver>UninstallDlg</receiver> - <slot>accept()</slot> - </connection> - <connection> - <sender>cleanRegButton</sender> - <signal>clicked()</signal> - <receiver>UninstallDlg</receiver> - <slot>cleanRegistry()</slot> - </connection> -</connections> -<slots> - <slot access="protected">init()</slot> - <slot access="protected">destroy()</slot> - <slot>cleanRegistry()</slot> -</slots> -<layoutdefaults spacing="6" margin="11"/> -</UI> diff --git a/util/install/win/uninstaller/uninstaller.cpp b/util/install/win/uninstaller/uninstaller.cpp deleted file mode 100644 index 9a7c529..0000000 --- a/util/install/win/uninstaller/uninstaller.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qapplication.h> -#include <qlabel.h> -#include <qdir.h> -#include <qtextview.h> -#include <qpushbutton.h> -#include <qmessagebox.h> -#include "uninstallimpl.h" -#include "../environment.h" - -#ifdef Q_OS_WIN32 -#include <windows.h> -#endif - -QApplication* app; -UninstallDlg* progress; - -void rmDirRecursive( const QDir &dir ) -{ - const QFileInfoList* list = dir.entryInfoList( QDir::All | QDir::System | QDir::Hidden ); - if ( list ) { - QFileInfoListIterator it( *list ); - QFileInfo* fi; - - while( ( fi = it.current() ) ) { - if( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ){ - progress->filesDisplay->append( fi->absFilePath() + "\n" ); - progress->filesDisplay->scrollToBottom(); - app->processEvents(); - if( fi->isDir() ) - rmDirRecursive( QDir(fi->absFilePath()) ); - else - QFile::remove( fi->absFilePath() ); - } - ++it; - } - } - // Remove this dir as well - dir.rmdir( dir.absPath() ); -} - -int main( int argc, char** argv ) -{ - app = new QApplication( argc, argv ); - progress = new UninstallDlgImpl( 0, 0, 0, Qt::WStyle_Customize|Qt::WStyle_NormalBorder|Qt::WStyle_Title); - - if( argc != 4 ) - qFatal( "Incorrect parameters" ); - - if( !QMessageBox::information( 0, - QString( "Uninstalling Qt %1" ).arg(argv[3]), - QString("Are you sure you want to uninstall Qt %1?\n" - "This will remove the directory this version\n" - "of Qt was installed to, along with ALL its contents.").arg(argv[3]), - "Yes", "No" ) ) - { - progress->setCaption( QString( "Uninstalling Qt " ) + argv[ 3 ] ); - progress->show(); - - app->setMainWidget( progress ); - - // Delete the two directories we have written files to during the installation. - // The OK button is disabled at this point. - // Messages will be processed during the delete process. - - // Check if moc.exe exists, if not this could potentially be a - // corrupted registry setting - - if ( QFile::exists( QString( argv[1] ) + QString( "\\bin\\moc.exe" ) ) ) - rmDirRecursive( QDir(argv[1]) ); - else - QMessageBox::warning( 0, "Uninstalling failed", "Qt could not be uninstalled, you will " - "need to remove Qt manually" ); - - rmDirRecursive( QDir(argv[2]) ); - - progress->okButton->setEnabled( true ); - progress->cleanRegButton->setEnabled( true ); - /* - ** Just hang around until someone clicks the "OK" button - */ - app->exec(); -#if defined(Q_OS_WIN32) - QEnvironment::removeUninstall( QString( "Qt " ) + argv[ 3 ] ); - QString qtEnv = QEnvironment::getEnv( "QTDIR", QEnvironment::LocalEnv ); - QString pathEnv = QEnvironment::getEnv( "PATH", QEnvironment::PersistentEnv ); - if ( qtEnv == QString(argv[1]) ) - QEnvironment::removeEnv( "QTDIR", QEnvironment::LocalEnv | QEnvironment::PersistentEnv ); - else - qtEnv = argv[1]; - - qtEnv.append("\\bin;"); - pathEnv.replace( qtEnv, "" ); - QEnvironment::putEnv( "PATH", pathEnv, QEnvironment::PersistentEnv ); - if( qWinVersion() & Qt::WV_NT_based ) { - SendNotifyMessageA( HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)"Environment" ); - SendNotifyMessageA( HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0 ); - } -#endif - } - - return 0; -} diff --git a/util/install/win/uninstaller/uninstallimpl.cpp b/util/install/win/uninstaller/uninstallimpl.cpp deleted file mode 100644 index d30358b..0000000 --- a/util/install/win/uninstaller/uninstallimpl.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "uninstallimpl.h" -#include <qsettings.h> -#include <qmessagebox.h> - -UninstallDlgImpl::UninstallDlgImpl( QWidget* parent, const char* name, bool modal, WindowFlags f ) - : UninstallDlg( parent, name, modal, f ) -{ -} - -UninstallDlgImpl::~UninstallDlgImpl() -{ -} - -void UninstallDlgImpl::cleanRegistry() -{ - cleanRegistryHelper( "/Trolltech/Qt" ); - cleanRegistryHelper( "/Trolltech/Qt Designer" ); - cleanRegistryHelper( "/Trolltech/Qt Assistant" ); - cleanRegistryHelper( "/Trolltech/Qt Linguist" ); -} - -void UninstallDlgImpl::cleanRegistryHelper( const QString& key ) -{ - QSettings settings; - QStringList::Iterator it; - QStringList keys = settings.subkeyList( key ); - for ( it = keys.begin(); it != keys.end(); ++it ) { - cleanRegistryHelper( key + "/" + *it ); - } - QStringList entries = settings.entryList( key ); - for ( it = entries.begin(); it != entries.end(); ++it ) { - settings.removeEntry( key + "/" + *it ); - } - settings.removeEntry( key + "/." ); -} diff --git a/util/install/win/uninstaller/uninstallimpl.h b/util/install/win/uninstaller/uninstallimpl.h deleted file mode 100644 index b3bff36..0000000 --- a/util/install/win/uninstaller/uninstallimpl.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the utils of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, 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. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "uninstall.h" - -class UninstallDlgImpl : public UninstallDlg -{ - Q_OBJECT -public: - UninstallDlgImpl( QWidget* parent = 0, const char* name = 0, bool modal = false, WindowFlags fl = 0 ); - ~UninstallDlgImpl(); -public slots: - void cleanRegistry(); -private: - void cleanRegistryHelper( const QString& key ); - -}; diff --git a/util/install/win/win.pro b/util/install/win/win.pro deleted file mode 100644 index 470fa03..0000000 --- a/util/install/win/win.pro +++ /dev/null @@ -1,136 +0,0 @@ -TEMPLATE = app -CONFIG += windows qt - -HEADERS = globalinformation.h \ - setupwizardimpl.h \ - environment.h \ - shell.h \ - resource.h \ - dialogs/folderdlgimpl.h \ - pages/pages.h \ - pages/sidedecorationimpl.h - -SOURCES = main.cpp \ - globalinformation.cpp \ - setupwizardimpl.cpp \ - setupwizardimpl_config.cpp \ - environment.cpp \ - shell.cpp \ - resource.cpp \ - dialogs/folderdlgimpl.cpp \ - pages/pages.cpp \ - pages/sidedecorationimpl.cpp - -INTERFACES = dialogs/folderdlg.ui \ - pages/buildpage.ui \ - pages/configpage.ui \ - pages/finishpage.ui \ - pages/folderspage.ui \ - pages/licenseagreementpage.ui \ - pages/licensepage.ui \ - pages/optionspage.ui \ - pages/progresspage.ui \ - pages/sidedecoration.ui \ - pages/winintropage.ui - -win32 { - SOURCES += archive.cpp - HEADERS += archive.h -} - -TARGET = install -DESTDIR = ../../../dist/win -INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty $$QT_SOURCE_TREE/util/install/archive - -win32:RC_FILE = install.rc - -# Comment out one of the following lines to build the installer for: -# -# - a Qt/Windows evaluation version (eval), -# - a Qt/Windows evaluation version that can be burned on CD and -# distributed on tradeshows (eval-cd) -# - the QSA evaluation version (qsa) -# - educational version (edu) -# - non-commercial version (noncommercial) -# -#CONFIG += eval -#CONFIG += eval-cd -#CONFIG += qsa -#CONFIG += edu -#CONFIG += noncommercial - - -unix:LIBS += -L$$QT_BUILD_TREE/util/install/archive -larq -win32:LIBS += ../archive/arq.lib -INCLUDEPATH += ../keygen - -# We have the following dependencies on config: -# -# qsa -> eval -# eval-cd -> eval -# eval -> (none) -# edu -> (none) -# noncommercial -> (none) -# -# For the code this means that the following defines are defined: -# -# eval : EVAL -# eval-cd : EVAL, EVAL_CD -# qsa : EVAL, QSA -# edu : EDU -# noncommercial: NON_COMMERCIAL -# - -qsa { - CONFIG += eval - DEFINES += QSA -} - -eval-cd { - CONFIG += eval - DEFINES += EVAL_CD -} - -eval { - !exists($(QTEVAL)/src) { - error(You must set the QTEVAL environment variable to the directory where you checked out //depot/qteval/main in order to be able to build the evaluation version of install.) - } - DEFINES += EVAL - qsa { - win32:RC_FILE = install-qsa.rc - } else { - win32:RC_FILE = install-eval.rc - } - mac:RC_FILE = ../../../tools/designer/app/designer.icns - SOURCES += $(QTEVAL)/src/check-and-patch.cpp - INCLUDEPATH += $(QTEVAL)/src - DESTDIR = ../../../bin -} - -edu { - !exists($(QTEVAL)/src) { - error(You must set the QTEVAL environment variable to the directory where you checked out //depot/qteval/main in order to be able to build the evaluation version of install.) - } - DEFINES += EDU - win32:RC_FILE = install-edu.rc - SOURCES += $(QTEVAL)/src/check-and-patch.cpp - INCLUDEPATH += $(QTEVAL)/src - DESTDIR = ../../../bin -} - -noncommercial { - !exists($(QTEVAL)/src) { - error(You must set the QTEVAL environment variable to the directory where you checked out //depot/qteval/main in order to be able to build the evaluation version of install.) - } - DEFINES += NON_COMMERCIAL - win32:RC_FILE = install-noncommercial.rc - SOURCES += $(QTEVAL)/src/check-and-patch.cpp - INCLUDEPATH += $(QTEVAL)/src - DESTDIR = ../../../bin -} - -mystaticconfig { - QMAKE_LIBS_QT = - QMAKE_LIBS_QT_THREAD = - LIBS += ../../../lib/libqt-mt.a -lz -framework Carbon -} diff --git a/util/webkit/mkdist-webkit b/util/webkit/mkdist-webkit index 701133e..6e8add9 100755 --- a/util/webkit/mkdist-webkit +++ b/util/webkit/mkdist-webkit @@ -46,6 +46,7 @@ excluded_directories="$excluded_directories JavaScriptCore/wtf/wx" excluded_directories="$excluded_directories JavaScriptCore/wtf/gtk" excluded_directories="$excluded_directories JavaScriptCore/wtf/mac" excluded_directories="$excluded_directories JavaScriptCore/wtf/win" +excluded_directories="$excluded_directories JavaScriptCore/wtf/chromium" excluded_directories="$excluded_directories WebCore/WebCore.vcproj" excluded_directories="$excluded_directories WebCore/DerivedSources.make" @@ -57,6 +58,7 @@ excluded_directories="$excluded_directories WebCore/Configurations" excluded_directories="$excluded_directories WebCore/bridge/objc" excluded_directories="$excluded_directories WebCore/bridge/testbindings.pro" excluded_directories="$excluded_directories WebCore/bindings/objc" +excluded_directories="$excluded_directories WebCore/bindings/v8" excluded_directories="$excluded_directories JavaScriptCore/icu" @@ -70,6 +72,7 @@ excluded_directories="$excluded_directories WebCore/loader/win" excluded_directories="$excluded_directories WebCore/page/gtk" excluded_directories="$excluded_directories WebCore/page/mac" excluded_directories="$excluded_directories WebCore/page/wx" +excluded_directories="$excluded_directories WebCore/page/chromium" excluded_directories="$excluded_directories WebCore/history/mac" @@ -78,6 +81,7 @@ excluded_directories="$excluded_directories WebCore/editing/wx" excluded_directories="$excluded_directories WebCore/platform/text/wx" excluded_directories="$excluded_directories WebCore/platform/text/gtk" +excluded_directories="$excluded_directories WebCore/platform/text/chromium" excluded_directories="$excluded_directories WebCore/manual-tests" @@ -87,6 +91,7 @@ excluded_directories="$excluded_directories WebCore/platform/network/curl" excluded_directories="$excluded_directories WebCore/platform/network/mac" excluded_directories="$excluded_directories WebCore/platform/network/win" excluded_directories="$excluded_directories WebCore/platform/network/soup" +excluded_directories="$excluded_directories WebCore/platform/network/chromium" excluded_directories="$excluded_directories WebCore/platform/graphics/cg" excluded_directories="$excluded_directories WebCore/platform/graphics/cairo" @@ -95,6 +100,7 @@ excluded_directories="$excluded_directories WebCore/platform/graphics/wx" excluded_directories="$excluded_directories WebCore/platform/graphics/mac" excluded_directories="$excluded_directories WebCore/platform/graphics/win" excluded_directories="$excluded_directories WebCore/platform/graphics/skia" +excluded_directories="$excluded_directories WebCore/platform/graphics/chromium" excluded_directories="$excluded_directories WebCore/platform/image-decoders/bmp" excluded_directories="$excluded_directories WebCore/platform/image-decoders/gif" @@ -105,6 +111,7 @@ excluded_directories="$excluded_directories WebCore/platform/image-decoders/jpeg excluded_directories="$excluded_directories WebCore/platform/image-decoders/xbm" excluded_directories="$excluded_directories WebCore/plugins/gtk" +excluded_directories="$excluded_directories WebCore/plugins/chromium" excluded_directories="$excluded_directories WebCore/platform/symbian WebCore/platform/wx" excluded_directories="$excluded_directories WebKit/gtk" @@ -142,13 +149,11 @@ files_to_remove="$files_to_remove WebKit/qt/QtLauncher/QtLauncher.pro" files_to_remove="$files_to_remove WebKit/qt/QtLauncher/main.cpp" files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp" -files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCore.scons" files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl" files_to_remove="$files_to_remove JavaScriptCore/SConstruct" files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl" files_to_remove="$files_to_remove WebCore/SConstruct" -files_to_remove="$files_to_remove WebCore/WebCore.scons" files_to_remove="$files_to_remove WebCore/WebCoreSources.bkl" files_to_remove="$files_to_remove WebCore/webcore-base.bkl" files_to_remove="$files_to_remove WebCore/webcore-wx.bkl" |